Url Rewrite Filter 310 ManualWord文档下载推荐.docx
《Url Rewrite Filter 310 ManualWord文档下载推荐.docx》由会员分享,可在线阅读,更多相关《Url Rewrite Filter 310 ManualWord文档下载推荐.docx(20页珍藏版)》请在冰豆网上搜索。
![Url Rewrite Filter 310 ManualWord文档下载推荐.docx](https://file1.bdocx.com/fileroot1/2022-10/29/7efd0433-270a-40b9-a557-021460e6ce5a/7efd0433-270a-40b9-a557-021460e6ce5a1.gif)
4.<
filter>
5.<
filter-name>
UrlRewriteFilter<
/filter-name>
6.<
filter-class>
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter<
/filter-class>
7.<
/filter>
8.<
filter-mapping>
9.<
10.<
url-pattern>
/*<
/url-pattern>
11.<
/filter-mapping>
12.AddyourownconfigurationtotheWEB-INF/urlrewrite.xmlthatwascreated.
13.Restartthecontext.
Youcanvisithttp:
//127.0.0.1:
8080/rewrite-status(orwhatevertheaddressofyourlocalwebappandcontext)toseeoutput(note:
thispageisonlyviewablefromlocalhost).
FilterParameters
Thereareafewadvancedfilterparametersforenablingconffilereloadingetc.Thereareself-explanatory.
<
!
--settheamountofsecondstheconffilewillbecheckedforreload
canbeavalidinteger(0denotescheckeverytime,
-1denotesnoreloadcheck,default-1)-->
init-param>
param-name>
confReloadCheckInterval<
/param-name>
param-value>
60<
/param-value>
/init-param>
--ifyouneedtotheconffilepathcanbechanged
itisspecifiedasapathrelativetotherootofyourcontext
(default/WEB-INF/urlrewrite.xml)-->
confPath<
/WEB-INF/urlrewrite.xml<
--setsuploglevel(willbeloggedtocontextlog)
canbe:
TRACE,DEBUG,INFO(default),WARN,ERROR,FATAL,log4j,commons,
sysout:
{level}(ie,sysout:
DEBUG)
ifyouarehavingtroubleusingnormallevelsusesysout:
DEBUG
(defaultWARN)-->
logLevel<
DEBUG<
--youcanchangestatuspathsothatitdoesnot
conflictwithyourinstalledapps(note,defaults
to/rewrite-status)note,muststartwith/-->
statusPath<
/status<
--youcandisablestatuspageifdesired
true,false(defaulttrue)-->
statusEnabled<
true<
--youmaywanttoallowmorehoststolookatthestatuspage
statusEnabledOnHostsisacommadelimitedlistofhosts,*can
beusedasawildcard(defaultsto"
localhost,local,127.0.0.1"
)-->
statusEnabledOnHosts<
localhost,dev.*,*<
--defaultstofalse.usemod_rewritestyleconfigurationfile(ifthisistrueandconfPath
isnotspecifiedconfPathwillbesetto/WEB-INF/.htaccess)-->
modRewriteConf<
false<
--loadmod_rewritestyleconfigurationfromthisparameter'
svalue.
note,Settingthisparameterwillmeanthatallotherconfparametersareignored.
modRewriteConfText<
RewriteRule^/~([^/]+)/?
(.*)/u/$1/$2[R]
RewriteRule^/([uge])/([^/]+)$/$1/$2/[R]
-->
Note,settinglogLeveltolog4jorcommonswillcausethebuiltinlogingtocalleitherlog4jorcommons-loggingasiftheyweretheloggingframework,obviouslyyouwillneedtohavethejarforlog4jorcommons-logginginyourclasspath.
ConfigurationFileWEB-INF/urlrewrite.xml
ConfigurationisdoneviaasimpleXMLfilethatlivesinyourWEB-INFfolder.Itshouldbenamedurlrewrite.xml.ItmaybehelpfultoreadtheUrlRewriteFilterDTD(DocumentTypeDefinition).Pleasealsomakesureyoulookattheexamples.Asimpleconfigurationfilelookslike:
?
xmlversion="
1.0"
encoding="
utf-8"
>
DOCTYPEur