Seems like a stupid question to which the answer would be “Don’t use encodeURL()!” but I’m working with a codebase that uses netui anchor tags in the JSPs and I need to disable the writing of JSESSIONID into the URLs as it is a security risk.
In WebLogic, you can configure this by configuring url-rewriting-enabled in weblogic.xml (I know because I wrote that feature in the WebLogic server!). However, I can’t find an equivalent config option for Tomcat.
No setting comes to mind. But this is fairly easy to do by creating a first-entry
Filterlistening on theurl-patternof interest (maybe/*?) and replaces theServletResponseby aHttpServletResponseWrapperimplementation where theencodeURL()returns the very same argument unmodified back.Kickoff example: