-
1. Re: rewrite with param - not REST !
dhinojosa Feb 20, 2010 11:26 PM (in response to nimo22)
but when I go to the address bar and manually overwrite 'nimo' with 'steve', then the link 'teststeve' is shown and the lastname is changed.So what you are saying is that the underscore is getting removed when you go to the page?
-
2. Re: rewrite with param - not REST !
nimo22 Feb 22, 2010 9:41 PM (in response to nimo22)hello daniel,
the underscore is not the matter for my problem.
The url works and looks like
www.mypage.com/nimo
with this pages.xml:
<page view-id="/actualUser.xhtml" login-required="true"> <param name="actual_user" value="#{loggedInUser.name}"/> <rewrite pattern="/{actual_user}"/> </page>
nimo is the name of the registered user (
loggedInUser
) and this is stored in a sessions property.Now, you go to the site
www.mypage.com/nimo
and within the site there is the same:
<h:outputText value="Hello #{loggedInUser.name}"/>
which prints
Hello nimo!
loggedInUser
All fine, BUT when I go the addressbar and overwrite
www.mypage.com/nimo
with whatever other name
www.mypage.com/steve
then the site is again rendered and replaces the value stored infrom nimo to steve and I will see:
Hello stefan!How can I avoid such behaviour?
If the user overwrites the name in the addressbar, the property should not be changed - the site name should be changed.How can I do that?
-
3. Re: rewrite with param - not REST !
dhinojosa Feb 23, 2010 4:02 AM (in response to nimo22)You can avoid that by not even having the rewrite pattern:
pages.xml
from:
<page view-id="/actualUser.xhtml" login-required="true"> <param name="actual_user" value="#{loggedInUser.name}"/> <rewrite pattern="/{actual_user}"/> </page>
to:
<page view-id="/actualUser.xhtml" login-required="true"/>
Because if you want this to only work for the person that is logged why make the url dependent on any other name, since you already know who is logged in? Is that what you are looking for, or am I missing something?
-
4. Re: rewrite with param - not REST !
nimo22 Feb 23, 2010 8:55 AM (in response to nimo22)I want a pretty url with the name of the logged in user - so I need to want to use the rewrite pattern.
Maybe, I have to copy the param name loggedInUser.name to a RequestScope-Variable (for example
requestName
) - would it be help?<param name="actual_user" value="#{loggedInUser.name}"/>
Or should I use something like PrettyFaces with inbound/outbound url? I have red, that PrettyFaces is also a lot of faster than jboss rewriting as it does not need the two requests for making the rewrite (http://www.slideshare.net/lincolnthree/pretty-bookmarkable-jsf-prettyfaces-presentation). However, I have not tried it with seam yet and I do not know, if JSF 2.0 has some tequniques which eliminates the need of extra lib prettyfaces.