views:

107

answers:

1

MyFaces Orchestra adds a ?conversationContext=x to each resource on a page. Since I'm not using the conversation scope for the public part of my project (only for the admin part), I'd like to get rid of that parameter for two reasons:

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

I'm now going to take a look at Orchestra's source-code, and perhaps bypass something, but it would be best if there is an option for this I'm unaware of

A: 

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

There are two options of using Orchestra - with an interceptor (JSF) and a Filter. Both of them try to wrap the response, if it isn't already wrapped. So if both the orchestra Filter and the interceptor are used, the Filter comes firest, wraps the response object, and sets an attribute in the request, which indicates to the interceptor, that it shouldn't wrap the response again.

The Filter can be configured to match a certain URL pattern if conversationContext is to be added. However, for my needs, that pattern matcher was too simple, so I made my own filter instead. So in order to tell the interceptor NOT to wrap the response, all that has to be done is this:

httpRequest.setAttribute(
                RequestParameterServletFilter.REQUEST_PARAM_FILTER_CALLED,
                Boolean.TRUE);
Bozho