First of all: Thanks (Christopher, Andre, Bill and everybody) !
The complete solution is compound of 3 parts:
1. The Valve to process &jsessionid (just a piece of the source code)
if (!request.isRequestedSessionIdFromCookie()) {
String jsessionid = request.getParameter("jsessionid");
if (jsessionid != null &&
request.getRequestedSessionId() == null) {
request.setRequestedSessionId(jsessionid);
request.setRequestedSessionURL(true);
}
}
Valve nextValve = getNext();
if (nextValve != null) {
nextValve.invoke(request, response);
}
I've configured this Valve in Tomcat specific webapp deployment
descriptor (context.xml)
2. The Servlet Filter to overwrite URL encoding (just a piece)
HttpServletRequest request = (HttpServletRequest) aRequest;
String jsessionid = request.getParameter("jsessionid");
String sessionId = request.getRequestedSessionId();
if (request.isRequestedSessionIdFromURL() && jsessionid != null
&& jsessionid.equals(sessionId)) {
aResponse = new HttpServletResponseWrapper((HttpServletResponse)
aResponse) {
@Override
public String encodeRedirectURL(String url) {
return this.encodeURLImpl(super.encodeRedirectURL(url));
}
private String encodeURLImpl(String url) {
StringBuilder newURL = new StringBuilder(url);
final String searchString = ";jsessionid=";
int i = newURL.indexOf(searchString);
if (i >= 0) {
int j = newURL.indexOf("?", i);
newURL.replace(i, i + 1, "?");
if (j >= 0) {
newURL.replace(j, j + 1, "&");
}
}
return newURL.toString();
}
3. Tag libraries to handle url encoding properly
This was the easy part. We're using the grandpa of all Java web MVC
frameworks: Struts 1.x :-)
So i've just used 'html:' tags and the magic is done !
Now OO is happy and i (really) need to sleep.
Thanks !
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]