Spring Boot: Dynamic ServletPath and ContextPath for Embedded Tomcat -


i'd modify embedded tomcat, can programmatically modify incoming request:

  • original input: http://localhost:8080/webapp/foo contextpath = , servletpath = /webapp/foo

  • modified: contextpath = /webapp , servletpath = /foo

i can't within spring itself, because session cookie path getting set tomcat.

and can't use static contextpath because multi tenancy app.


i tried use

tomcatembeddedservletcontainerfactory tomcat = ...; tomcat.addcontextvalves(new valvebase() {     public void invoke(request request, response response) throws ioexception, servletexception {         ...     } }); 

but wasn't able set servletpath there.


do have idea how achieve this?

it's hard tell you're trying achieve, have tried setting property in application.properties file: server.context-path=/webapp

this put whole application in /webapp context path


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -