Removing MyFaces Orchestra "talkContext" GET parameter from static resources (css, images)

MyFaces Orchestra adds ?conversationContext=x to each resource on the page. Since I do not use the talk area for the public part of my project (only for the administrator part), I would like to get rid of this parameter for two reasons:

  • it interrupts browser caching of static resources
  • it's ugly :)

Now I’m going to take a look at the source code of the orchestra and maybe get around something, but it would be better if there was an option for this, I don’t know about

+4
source share
1 answer

The answer to this question is simple and at the same time a bit of a workaround. The MyFaces orchestra uses a wrapper around the original HttpServletResponse to encode the contesationContext parameter.

There are two options for using the orchestra - with an interceptor (JSF) and Filter . Both of them try to wrap the answer if it is not already wrapped. So, if both the Filter orchestra and the interceptor are used, Filter goes most energetically, wraps the response object and sets an attribute in the request that tells the interceptor that it should not complete the response again.

Filter can be configured to match a specific URL pattern if you need to add conversationContext . However, for my needs this template template was too simple, so instead I made my own filter. Therefore, to tell the interceptor NOT to wrap the response, all you need to do is the following:

 httpRequest.setAttribute( RequestParameterServletFilter.REQUEST_PARAM_FILTER_CALLED, Boolean.TRUE); 
+1
source

All Articles