夢幻之旅

          DEBUG - 天道酬勤

             :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            671 隨筆 :: 6 文章 :: 256 評論 :: 0 Trackbacks
          其實就是一個過濾器從代理URL轉到目標URL.
          使用方法如下:
          1.web.xml里加入
          <filter>
              <filter-name>UrlRewriteFilter</filter-name>
             
          <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
             
          <init-param>
                 
          <param-name>logLevel</param-name>
                 
          <param-value>WARN</param-value>
             
          </init-param>
          </filter>
          <filter-mapping>
              <filter-name>UrlRewriteFilter</filter-name>
             
          <url-pattern>/*</url-pattern>
          </filter-mapping>
          2.配置urlrewrite.xml
          <?xml version="1.0" encoding="utf-8"?>
          <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.1//EN" "http://tuckey.org/res/dtds/urlrewrite3.1.dtd">
          <urlrewrite>
              <rule>
                  
          <from>/r/(.*).jpg</from>
                  
          <to >/register.do?$1</to>
              
          </rule>
              <outbound-rule>
                  
          <note>
                      The outbound-rule specifies that when response.encodeURL is called (if you are using JSTL c:url)
                      the url /rewrite-status will be rewritten to /test/status/.

                      The above rule and this outbound-rule means that end users should never see the
                      url /rewrite-status only /test/status/ both in thier location bar and in hyperlinks
                      in your pages.
                  
          </note>
                  
          <from>/rewrite-status</from>
                  
          <to>/test/status/</to>
              
          </outbound-rule>
          </urlrewrite>
          3.最后別忘了導入urlrewrite.jar包哦


          posted on 2008-08-13 09:36 HUIKK 閱讀(2930) 評論(0)  編輯  收藏 所屬分類: TOOL
          主站蜘蛛池模板: 莱西市| 葫芦岛市| 清苑县| 温州市| 怀宁县| 精河县| 宜宾市| 颍上县| 黄山市| 眉山市| 靖边县| 贵定县| 镇雄县| 阜康市| 昭苏县| 镇原县| 阿克苏市| 新和县| 景泰县| 琼结县| 腾冲县| 登封市| 莫力| 万源市| 富锦市| 昌都县| 宜阳县| 荃湾区| 凤台县| 弥勒县| 锡林郭勒盟| 大理市| 正镶白旗| 天峻县| 依安县| 公安县| 开远市| 楚雄市| 吴旗县| 民勤县| 呼伦贝尔市|