Skip to main content

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

There is nothing to prevent you from using

...
  contextHandler.addFilter(MyFilter.class, "a/*",
EnumSet.of(DispatcherType.REQUEST));

  contextHandler.addFilter(MyFilter.class, "b/*",
EnumSet.of(DispatcherType.REQUEST));
...


On Mon, Jan 12, 2015 at 10:31 AM, paternesi andrea <andrea.paternesi@xxxxxxxxxx> wrote:
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.



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



--
 - michael dykman
 - mdykman@xxxxxxxxx

 May the Source be with you.

Back to the top