url重写
我们公司的人事系统,而他还没登录就访问页面时,就会报错.但现在他不用登录直接在IE地址栏敲上附件的URL, 就能直接查看此附件的内容
,如http://.....我们公司的系统网址..../file/0/9/FA686229.ppt,他就能看到FA686229.ppt的内容。现在我想如果他还没登录就不准查
看/file/下面的所有内容,而跳到http://.....我们公司的系统网址..../wf/login.jsp。我用urlrewritefilter做,但一点反应都没有。以下
是我步骤:请各位达人帮我看看,请将你们的宝贵意见提出来, 明后两天休息, 周一回公司等你好消息....
1.将urlrewritefilter-2.6.zip放到/web-inf/lib/下面.
2.在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>
3. 将urlrewrite.xml放在与web.xml同一个目录下.
4.改动urlrewrite.xml 如下面:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 2.6//EN"
"http://tuckey.org/res/dtds/urlrewrite2.6.dtd">
<!--
Configuration file for UrlRewriteFilter
http://tuckey.org/urlrewrite/
-->
<urlrewrite>
<rule>
<note>
The rule means that requests to /test/status/ will be redirected to /rewrite-status
the url will be rewritten.
</note>
<from>/test/status/</from>
<to type="redirect">%{context-path}/rewrite-status</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>
<rule>
<from>file/0/9/*.ppt</from>
<to>/wf/login.jsp</to>
</rule>
</urlrewrite>