Thanks for the help, Chris. I did note that some of the webapp web.xml files didn't include the async option. I've decided for now we'll use Tomcat's conf/web.xml to set this basic filter and let our webapps not have to think about it.

On 8/28/15 12:27 PM, Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

David,

On 8/28/15 2:47 PM, David Wall wrote:
I'm using Tomcat 8.0.23, but wondered if a filter defined in the
Tomcat conf/web.xml as well as defined in my app's WEB-INF/web.xml
file causes the filter to be loaded twice or whether duplicate
filters are ignored?

If duplicates are ignored, what makes it a "duplicate"?  Just the
name, the filter-name and url-pattern combo?  The filter-class?
I've never looked into this, but I would imagine that Tomcat does no
checking for duplicate filter definitions. Otherwise, the above
questions are raised :)

Is the filter-name field can sensitive?
Almost certainly.

Noted that Tomcat uses a lowercase 's' for it's filter name.

In Tomcat's conf/web.xml:

<filter> <filter-name>setCharacterEncodingFilter</filter-name>
<filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</
filter-class>
  <init-param> <param-name>encoding</param-name>
<param-value>UTF-8</param-value> </init-param>
<async-supported>true</async-supported> </filter>

<filter-mapping>
<filter-name>setCharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern> </filter-mapping>
Note that the above Filter is commented-out by default.

In my webapp's WEB-INF/web.xml:

<filter> <filter-name>SetCharacterEncodingFilter</filter-name>
<filter-class>
org.apache.catalina.filters.SetCharacterEncodingFilter
</filter-class> <async-supported>true</async-supported> <!-- Enable
if using Vaadin PUSH --> <init-param>
<param-name>encoding</param-name> <param-value>UTF-8</param-value>
</init-param> </filter>

<filter-mapping>
<filter-name>SetCharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern> </filter-mapping>

When using Atmosphere with Vaadin PUSH, I occasionally get an
exception that indicates an issue with async operations, and it
shows my filter twice in the stack trace:

*java.lang.IllegalStateException: A filter or servlet of the
current chain does not support asynchronous operations.** *
at
org.apache.catalina.connector.Request.startAsync(Request.java:1610)
Boy,
it would be nice if Tomcat told you which Filter of or Servlet of
the current change didn't support asynchronous operations. I don't
immediately see a good way of getting that information from the
Request object. :(

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJV4LYQAAoJEBzwKT+lPKRYjMoQAJuw/bu4Efmw/Mc0tm6hXaaU
fJBSSsfZJfPGzahCvMGRTciTEe/E7cjsSIHgkdZKy1UUYSx2mnLZNTkiMaQRu2Sg
XmmN6nzKC7dtNPrYGgkN+RqbUJXjpeO0vV6RLJHdzGcQ9vQ4409t733QQuFbuzeS
DfcCCnSiwK8i4APQyuQWpuT4Th/kyehZfp4mtlIQHN6BsmekRH6VUIHI9rRajPgF
zUtPEXnqdlXOD5B2dtRDePQNBVIO5s8Es+GzD68L2m/XseIt6WxbHUYe8lGcKp6g
7O7LBfe+VhgCaIsoC/aPJ9hyA75z1p/O1h8Rcb8ft4G8BYdvVYQl6Dc76XzYdVYy
RdSu5FaGBRsCAromAJ0/ThSa2oKPMcrINUkMDdoMGE12Rr5+d/QVO6jMlpq0MgqY
PkXox+eB7pzcFFUkU4wWDOe3xqVHgMWW4E3dop+tfCHti9HDhfcgUNP6ch7MAEIm
8+3iZ8DKeyqmvp1TQn9HQcM/I+or0qE3GvQsYZR00Z4C7Rp4/QdmMMhZwNoqgnHw
kCxrIgCA2KPeEBYVkTsx9LG0P8dzitDps3EFLTsETSygfd1JmrCPx+8PlrAgjkcM
7FnrJAHX1fZ28EoNMmdf8f0FJ3InmBB9APO3Kw+YbayJeZxuV4gg/dAPZT3PGI0p
RYZ2Ubhc8zpwgOTjEHMC
=DJRR
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to