Il 13/01/2015 08:56, "" ha scritto:

        That addFilter method is deprecated....
        
        
        Use This method 
<http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/servlet/ServletHandler.html#addFilterWithMapping%28org.eclipse.jetty.servlet.FilterHolder,%20java.lang.String,%20java.util.EnumSet%29>
 
        
        
        Create a single FilterHolder for your filter and pass that same 
instance of the FilterHolder in two separate called to the above method...   In 
this way you will only have once instance of the filter but with two mappings.
        
        


Yes sure I already switched to that method to be sure i could control the 
filter instance.

-------------------------------------------------------------------------------------
FilterHolder filter= new FilterHolder(new MyFilter());
                
contextHandler.addFilter(filter, "/x/*", EnumSet.of(DispatcherType.REQUEST));
contextHandler.addFilter(filter, "/y/*", EnumSet.of(DispatcherType.REQUEST));
contextHandler.addFilter(filter, "/z/*", EnumSet.of(DispatcherType.REQUEST));
-------------------------------------------------------------------------------------

I created a single instance of the FilterHolder and passed it to the single 
addFilter call.
What I get is that the init() method on MyFilter is still called N times. Once 
for each path. 
Can this be a bug? Is this the intended behaviour?

Thanks.
Andrea.

PS: the other method does not seem to be deprecated. At least in my jetty 
(version 9.2.6.v20141205)
      pheraps the documentation should updated.





_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to