secondbreakfast
secondbreakfast

Reputation: 4374

Use LegacyCookieProcessor without Spring Boot or context.xml on the server

I recently upgraded a project to Java 8, targeting Tomcat 9. It relies heavily on cookies that use commas and possibly spaces in the value so I need to use LegacyCookieProcessor because the cookies aren't RFC 6265 compliant. The only two ways I can find on how to do this require Spring Boot or editing context.xml in Tomcat. This project isn't using Spring Boot so the first one isn't an option, and I'd really rather not break portability by requiring context.xml to be changed wherever it is deployed.

Is it possible to configure this in Java config or web.xml (or any other way)?

Upvotes: 2

Views: 2530

Answers (1)

zapl
zapl

Reputation: 63955

Tomcat supports per application config in /META-INF/context.xml bundled in the application package just like the web.xml file.

That file supports the cookie processor config

<CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor" />

Upvotes: 2

Related Questions