Can someone tell me, what DispatcherType is doing?
Seems to be an important configuration.
Class usage didn't helped me as well by pointing to things such as ServletContextHandler#addFilter, which is "documented" with the wise words: convenience method to add a filter
.
In general, any chance to "understand" the undocumented Jetty API without code-example-search-fun or try-and-fail-and-wonder?
This is also a setting in web.xml; and probably has been in existence for quite some time.
http://download.oracle.com/docs/cd/B32110_01/web.1013/b28959/filters.htm#BCFIEDGB
This section provides a few sample configurations to have a filter act on forward or include targets. We start with the filter declaration, followed by alternative filter mapping configurations:
<filter>
<filter-name>myfilter</filter-name>
<filter-class>mypackage.MyFilter</filter-class>
</filter>
To execute MyFilter to filter an include target named includedservlet:
<filter-mapping>
<filter-name>myfilter</filter-name>
<servlet-name>includedservlet</servlet-name>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
Note that the include() call can come from any servlet (or other resource) in the application. Also note that MyFilter would not execute for a direct request of includedservlet, unless you have another element with the value REQUEST.
To execute MyFilter to filter any servlet directly requested through a URL pattern "/mypath/", or to execute it to filter any forward target that is invoked through a URL pattern starting with "/mypath/":
<filter-mapping>
<filter-name>myfilter</filter-name>
<url-pattern>/mypath/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
~~~~~~~~~~~~~~~~~~~~~~
Also, the default is Request; read appliesTo(...) method on following page:
http://grepcode.com/file/repo1.maven.org/maven2/org.eclipse.jetty/jetty-servlet/8.0.0.M0/org/eclipse/jetty/servlet/FilterMapping.java#FilterMapping.0_dispatches
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With