Hi, I use the code at end of this message to strip the Jsessionid, it works very well, however it started to have error when I call this in my T5 app:
Session session = request.getSession(false); if (session != null) { session.invalidate(); } cookies.removeCookieValue(logKey); can this problem be fixed? Thanks, Angelo [ERROR] [default] Servlet.service() for servlet default threw exception java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2221) at org.apache.catalina.connector.Request.getSession(Request.java:2031) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:832) at org.apache.tapestry5.internal.services.RequestImpl.getSession(RequestImpl.java:99) ... at org.myapp.Filter.doFilter(Filter.java:37) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) ... at java.lang.Thread.run(Thread.java:613) // http://www.nabble.com/T5%3A-what-part-of-tapestry-adds-Jsessionid-td18385573.html#a18388334 Code from Filip S. Adamsen-2 public class Filter implements javax.servlet.Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest)) { chain.doFilter(request, response); return; } HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; if (httpRequest.isRequestedSessionIdFromURL()) { HttpSession session = httpRequest.getSession(); if (session != null) session.invalidate(); } HttpServletResponseWrapper wrappedResponse = new StripUrlSessionIdHttpServletResponseWrapper(httpResponse); chain.doFilter(request, wrappedResponse); } public void init(FilterConfig config) throws ServletException { } public void destroy() { } private static class StripUrlSessionIdHttpServletResponseWrapper extends HttpServletResponseWrapper { public StripUrlSessionIdHttpServletResponseWrapper(HttpServletResponse httpResponse) { super(httpResponse); } public String encodeRedirectUrl(String url) { return url; } public String encodeRedirectURL(String url) { return url; } public String encodeUrl(String url) { return url; } public String encodeURL(String url) { return url; } } } -- View this message in context: http://www.nabble.com/t5%3A-Filter-and-Session-conflict--tp22161170p22161170.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org