Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a JSF URL without the windowid parameter

Tags:

jsf-2

cdi

codi

In my JSF web-app, I want to create a URL for the user to bookmark or copy. That part is easy enough, like this:

<h:link value="Permanent Link"
        outcome="/showStuff"> 
    <f:param name="recID" value="#{bean.recordID}" />
</h:link>

Although that link has the desired parameter (recID) in it, it also has the windowid parameter generated by the JSF Servlet. Is there any convenient way to generate the URL without the windowid parameter? Or does this make any difference?

(This is with Mojarra)

like image 536
AlanObject Avatar asked Dec 07 '25 21:12

AlanObject


1 Answers

You can remove the WindowId using a URLRewriteFilter framework such as OCPsoft Rewrite URLRewriteFilter

Doing something like this should be fairly straightforward using a single configuration rule. You can obviously fiddle if this rule is either too strict or too general.

.defineRule()
.when(Direction.isOutbound().and(
        URL.matches("{prefix}{windowId}{suffix}")
         .where("windowId").matches("windowId=[^&]+")))
.perform(Substitute.with("{prefix}{suffix}"))

Check out the rewrite site. It's pretty easy to set up. http://ocpsoft.org/rewrite/

like image 181
Lincoln Avatar answered Dec 13 '25 01:12

Lincoln



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!