Reply To: Get view-id from arbitrary pretty-url

Splash Forums Rewrite Users Get view-id from arbitrary pretty-url Reply To: Get view-id from arbitrary pretty-url

#24752

djmj
Participant

Yeah you are right, second option is the one to go. But this functionality could be maybe useful for others…

… and there is a reason not to use it:

Generating a valid view-id from the view-param is some kind of validation, since the view-id must be valid for h:link, else a “bad” user could input “hack” anything he wants in the view-parameter that will be used as a src including javascriptcode!

For my use case the threat is minimal but there could be other use-cases and for now i will use option II.

————————————————————————————————————

Using history.back(); is also an alternative but each of those alternatives have drawbacks.
If redirection takes place in a Filter is the url in the browsers history?, I do not know right now.
It is not guaranteed and also more often not the case that it really is the last url in history. I prefer the most generic versions as always.

Long story short, I would prefer a public method like this. I would even go so far that the faces implementation should be responsible of it since it is just the reverse of “getBookmarkableURL()”.