Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Embedded jetty filter mapping on multiple path

Good evening,

I am new in this mailing list.
I am writing because i cannot find any documentation in how to use Jetty 
Embedded Filters.
First of all i am aware that you can add filters to the 
ServletContextHandler this way:

  ServletContextHandler contextHandler = new 
ServletContextHandler(ServletContextHandler.SESSIONS);
  contextHandler.addFilter(MyFilter.class, "/*", 
EnumSet.of(DispatcherType.REQUEST));

this is good and it works without problems.
But now I need to add multiple paths on the same filter and I was't able 
to accomplish it.
In web.xml since version 2.5 of servlet specs there is a syntax that 
help us:

<filter-mapping>
         <filter-name>MyFilter</filter-name>
         <url-pattern>/x/*</url-pattern>
         <url-pattern>/y/*</url-pattern>
</filter-mapping>

In jetty embedded I could not find a way to add both paths "/x/*" and 
"/y/*" to MyFilter.
Is there a way to do so?

Thank you in advance for any halp you can provide.

Regards.
Andrea.





Back to the top