I am developing a Spring application that starts an embedded Jetty Server. It then \"deploys\" a Spring MVC web app to this Jetty server.
All is working well with multip
Okay, so what I missed is that I need to add Spring's DelegatingFilterProxy to Jetty's ServletContextHandler. The usual Spring way is to extend AbstractSecurityWebApplicationInitializer, which will add the Filter Proxy. This unfortunately also didn't work with Jetty.
One can add the Filter Proxy manually to Jetty, though, with a call explained in this comment:
import static org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME;
...
ServletContextHandler contextHandler = new ServletContextHandler();
...
contextHandler.addFilter(
new FilterHolder( new DelegatingFilterProxy( DEFAULT_FILTER_NAME ) ),
"/*",
EnumSet.allOf( DispatcherType.class ));
I also had to enable Session-Handling in Jetty, but this is explained very well here.