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

That addFilter method is deprecated....

Use This method

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.


On 13 January 2015 at 20:33, paternesi andrea <andrea.paternesi@xxxxxxxxxx> wrote:

Il 12/01/2015 22:08, Michael Dykman ha scritto:
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));
...

Well this is not completely true (at least based on my experience).
What happens here is that each time i add a path the init() method of the filter is called again.
So if i add 10 paths the init() method is called 10 times. And I do not know if this is the intended behaviour,
since it does not happen when using the web.xml configuration where the filter is created and initialized only once even if i add 10 paths.
So now what i would like to understand is: did I create 10 filters (one for each path) or create only one filter inited ten times over each path
as intended?
The strange thing is that at runtime only one doFilter() is called but I am not sure about what is happening in memory.

Any hints?

Thanks.
Andrea.



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
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


Back to the top