梦幻之旅

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 阅读(2921) 评论(0)  编辑  收藏 所属分类: TOOL

只有注册用户登录后才能发表评论。


网站导航: