[jboss-jira] [JBoss JIRA] (WFLY-2162) <servlet-name> does not work in <filter-mapping>

Nick Howes (JIRA) jira-events at lists.jboss.org
Thu Sep 26 06:49:02 EDT 2013


     [ https://issues.jboss.org/browse/WFLY-2162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Howes updated WFLY-2162:
-----------------------------

    Description: 
I have a filter mapped in web.xml with a <filter-mapping> and a <servlet-mapping> element set to the value of a servlet, but the filter is never run. If I replace the <servlet-mapping> element with <url-pattern>/</url-pattern>, the filter runs, -but it also runs for all other servlets- (in our case using the / pattern to denote default servlet  it works okay but if a wildcard pattern were required then it wouldn't be equivalent).

The servlet and filter in question:

{code:xml}
<servlet>
  <servlet-name>spring</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>spring</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>


<filter>
  <filter-name>filters</filter-name>
  <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
  <filter-name>filters</filter-name>
  <servlet-name>spring</servlet-name>
  <!-- <url-pattern>/</url-pattern> -->
</filter-mapping>
{code}

  was:
I have a filter mapped in web.xml with a <filter-mapping> and a <servlet-mapping> element set to the value of a servlet, but the filter is never run. If I replace the <servlet-mapping> element with <url-pattern>/</url-pattern>, the filter runs, but it also runs for all other servlets.

The servlet and filter in question:

{code:xml}
<servlet>
  <servlet-name>spring</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>spring</servlet-name>
  <url-pattern>/</url-pattern>
</servlet-mapping>


<filter>
  <filter-name>filters</filter-name>
  <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
  <filter-name>filters</filter-name>
  <servlet-name>spring</servlet-name>
  <!-- <url-pattern>/</url-pattern> -->
</filter-mapping>
{code}


    
> <servlet-name> does not work in <filter-mapping>
> ------------------------------------------------
>
>                 Key: WFLY-2162
>                 URL: https://issues.jboss.org/browse/WFLY-2162
>             Project: WildFly
>          Issue Type: Bug
>          Components: Web (Undertow)
>    Affects Versions: 8.0.0.Alpha4
>            Reporter: Nick Howes
>            Assignee: Stuart Douglas
>
> I have a filter mapped in web.xml with a <filter-mapping> and a <servlet-mapping> element set to the value of a servlet, but the filter is never run. If I replace the <servlet-mapping> element with <url-pattern>/</url-pattern>, the filter runs, -but it also runs for all other servlets- (in our case using the / pattern to denote default servlet  it works okay but if a wildcard pattern were required then it wouldn't be equivalent).
> The servlet and filter in question:
> {code:xml}
> <servlet>
>   <servlet-name>spring</servlet-name>
>   <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
>   <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
>   <servlet-name>spring</servlet-name>
>   <url-pattern>/</url-pattern>
> </servlet-mapping>
> <filter>
>   <filter-name>filters</filter-name>
>   <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
> </filter>
> <filter-mapping>
>   <filter-name>filters</filter-name>
>   <servlet-name>spring</servlet-name>
>   <!-- <url-pattern>/</url-pattern> -->
> </filter-mapping>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list