url rewriting - Rewrite Url Twice ocpsoft first Rewrite then PrettyFaces -


currently i'm using prettyfaces, nowadays have add prefix urls pretty-config based on information retrieved user session. purpose decided use rewrite. example in pretty-config have many entries this:

<url-mapping id="notepad">      <pattern value="/my/notepad/#{num}" />      <view-id value="/notepad.xhtml" /> </url-mapping>  <url-mapping id="book">      <pattern value="/my/book/#{isbn}" />     <view-id value="/book.xhtml" /> </url-mapping> 

and when user john login application want have urls containing prefixed john while still using features of prettyfaces. achive goal have written these rules:

.addrule()//number 1          //to compatibile entries pretty-config          .when(direction.isinbound()             .and(path.matches("/{username}/my/{rest}")             .and(usernameinurlmatchesusernameinsession)))          .perform(substitute.with("/my/{rest}"))          .where("username").matches(".+")          .where("rest").matches(".+") .addrule()//number 2          //to display user url's username          .when(direction.isoutbound()             .and(path.matches("/my/{rest}")             .and(hasusernameinsession)))          .perform(addusernameprefixfromsessiontourl)          .where("rest").matches(".+") 

so when logged user goes example.com/john/my/notepad/12 , server should internally substitute

/john/my/notepad/12 

to

/my/notepad/12 

by rewrite, , resolve

/my/notepad/12  

to

/notepad.xhtml  

with request containing value 12 key num, can accessed later httpservletrequest.getparameter("num")

but end in

/notepad.xhtml  

with request containing value john key username, , value notepad/12 key rest tried set event folow unchandled after substitute and/or

join.pathwithoutbinding("/{username}/my/{rest}").to("/my/{rest}").allowchaining() 

with no positive results.

how achive above goal while still using prettyfaces before?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -