标签:
如果实在着急上Restful的URL在项目里 , 可以使用turkey的urlrewrite.
先在web.xml中加入如下代码
<!-- URL ReWrite --> <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> <!-- URL ReWrite -->
然后再在WEB-INF目录中新建一个urlrewrite.xml , 内容类似如下
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd"> <!-- Configuration file for UrlRewriteFilter http://tuckey.org/urlrewrite/ --> <urlrewrite> <rule> <note>XXX Restful</note> <from>^/nihao$</from> <to>/user/nihao.do</to> </rule> </urlrewrite>
标签:
原文地址:http://www.cnblogs.com/taojintianxia/p/4238519.html