java - creating XML file inside WEB-INF -
im using http://tuckey.org/urlrewrite/ create map of website, have lot of links , cant write rules hand, example:
<rule> <from>^/about-us$</from> <to type="redirect">/myweb/controller?page=forwardabout</to> </rule> tuckey uses file called urlrewrite.xml inside web-inf folder.
the redirect rules come database, example: whenever article created, insert row desired link like:
/about-potatoes and rule become this
<rule> <from>^/about-us$</from> <to type="redirect">/myweb/controller?page=forwardpotatoes</to> </rule> then urlrewrite.xml should written redirect new article applies.
the main question is: how can create urlrewrite.xml inside web-inf?
secondary question: suposing new articles made every week, creating urlrewrite.xml every week update rules, rules apply without having re-deploy web-app again?
on application servers, can't dynamically change inside web application, unless re-package , re-deploy application.
even if change file, e.g. in unpacked wars, tuckey still read file once, , not pick new rules unless restart application.
why don't make more dynamic rule matches requests? in rewrite rule can use backreferences e.g. '$1' match first regular expression between brackets, like:
<rule> <from>^/about-(.*)$</from> <to type="redirect">/myweb/controller?page=forward$1</to> </rule>
Comments
Post a Comment