Oh.   So you will need to use  setFilters   and   setFilterMappings.

In that way you are modelling in code what you do in the web.xml.


On 13 January 2015 at 21:18, paternesi andrea <[email protected]>
wrote:

>
> 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.
>
>
>
> Il presente messaggio di posta elettronica, inclusi eventuali documenti
> allegati, potrebbe avere carattere riservato ed essere tutelato dal segreto
> professionale ed è ad esclusivo utilizzo del destinatario indicato in
> indirizzo. Qualora non foste il destinatario del presente messaggio Vi
> preghiamo di volerci avvertire immediatamente tramite posta elettronica o
> telefonicamente e di cancellare il presente messaggio e ogni documento ad
> esso allegato dal Vostro sistema. Ne è vietata la duplicazione o l’utilizzo
> per qualsiasi fine, così come la relativa divulgazione, distribuzione o
> inoltro a terzi senza l’espressa autorizzazione del mittente, il quale, in
> ragione del mezzo di trasmissione utilizzato, non assume alcuna
> responsabilità in merito alla segretezza e riservatezza delle informazioni
> contenute.
>
> This e-mail and any file transmitted with may contain material that is
> confidential, privileged and/or attorney work product for the sole use of
> the intended recipient. If you are not intended recipient of this e-mail,
> please do not read this e-mail and notify us immediately by reply e-mail or
> by telephone and then delete this message and any file attached from your
> system. You should not copy or use it for any purpose, disclose the
> contents of the same to any other person or forward it without express
> permission. Considering the means of the transmission, we do not undertake
> any liability with respect to the secrecy and confidentiality of the
> information contained in this e-mail and in its attachments.
>
> _______________________________________________
> 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
>
_______________________________________________
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