Re: ADF, PrettyFaces and a persistent query param

Splash Forums PrettyFaces Users ADF, PrettyFaces and a persistent query param Re: ADF, PrettyFaces and a persistent query param

#21579

I think it is important to understand the difference between inbound and outbound rewrites.

Inbound rewriting happens whenever a request is received and processed by the container. It works on the URL the container receives from the client. It happens very early in the request processing. If a inbound rewrite is of type “chain”, the rewritten request is “forwarded”, which will mean that it is handles as a new requests which will also pass the filter.

Outbound rewriting happens when the container writes an URL to the resulting HTML page. Therefore outbound rewriting happens very often during request processing, as it has to be done for each link in the output document.

ADF will propably use a technique similar to outbound rewriting to add the “_adf.ctrl-state” parameter to all links of a rendered HTML page. If the user now clicks on one of those links, the query parameter will be included in the request to the server and ADF will identify the correct context. Therefore the query parameter definitively has to be included even in the pretty links.

So it is reasonable that you see the “_adf.ctrl-state” parameter in an outbound method first. Initially there is no query parameter in the very first request. So ADF will create one by adding them to the links written to the HTML document.

I think for you it is important to identify the reason why the query parameter gets lost.

Lincoln’s idea was to do something like this.

  • In processInbound() retrieve the query parameter and save it somewhere. I think it would make sense to store it as an attribute in the request so you can easily retrieve it later.
  • In processOutbound() you will have to make sure that the query parameter is correctly added to the URL. You can get the original query parameter by reading the attribute from the request.

But as I mentioned before: The most important point for you is to find the place where the parameter gets lost because in theory the ADF query parameter should work out of the box without any hacks.

I hope this helps

Christian