Question

Normally I would have added org.springframework.web.filter.DelegatingFilterProxy with a snippet like this to web.xml:

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>
        org.springframework.web.filter.DelegatingFilterProxy
    </filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping> 

But with Servlet 3.0 Container and Jetty, I've removed web.xml. I'm trying to add DelegatingFilterProxy to Jetty's launch with:

context.addFilter(DelegatingFilterProxy.class, "/*", EnumSet.allOf(DispatcherType.class));

but I get error:

No bean named 'org.springframework.web.filter.DelegatingFilterProxy-100555887' is defined

How am I supposed to create and add this filter?

Was it helpful?

Solution

context.addFilter(new FilterHolder(new DelegatingFilterProxy("springSecurityFilterChain")), "/*", EnumSet.allOf(DispatcherType.class));

seems to be the correct syntax.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top