Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-92412

WAB Extender does not support activating a servlet filter with a filter-mapping using a servlet-name

    Details

    • Type: Bug
    • Status: Verified
    • Resolution: Unresolved
    • Affects Version/s: 7.0.0 CE GA1, 7.0.1 CE GA2, 7.0.2 CE GA3, 7.0.3 CE GA4, 7.0.4 CE GA5, 7.0.5 CE GA6, 7.0.6 CE GA7, 7.1.0 CE GA1, 7.1.1 CE GA2, 7.1.2 CE GA3, 7.1.X, 7.2.0 Alpha 1, Master
    • Fix Version/s: None
    • Labels:
    • Story Points:
      0.25
    • Fix Priority:
      3

      Description

      Problem Background

      Section 25.8 of the Portlet 3.0 Specification titled "Servlet filters and Request Dispatching" states:

      The Java Servlet Specification allows servlet filters to be specified for servlets that are request dispatching include and forward targets. The portlet container must support this capability for PortletRequestDispatcher dispatching targets. The servlet filters for the servlets included via the PortletRequestDispatcher must be defined as described in the Java Servlet Specification.

      In order to fulfill this requirement, Liferay Portal supports activating a servlet filter with a filter-mapping using a <url-pattern>. For example:

      WEB-INF/web.xml
      	<servlet>
      		<servlet-name>TestServlet</servlet-name>
      		<servlet-class>com.liferay.test.TestServlet</servlet-class>
      		<load-on-startup>1</load-on-startup>
      	</servlet>
      	<servlet-mapping>
      		<servlet-name>TestServlet</servlet-name>
      		<url-pattern>/WEB-INF/servlet/view</url-pattern>
      	</servlet-mapping>
      	<filter>
      		<filter-name>testServletFilter</filter-name>
      		<filter-class>com.liferay.test.TestServletFilter</filter-class>
      	</filter>
      	<filter-mapping>
      		<filter-name>testServletFilter</filter-name>
      		<url-pattern>/WEB-INF/servlet/view</url-pattern>
      		<dispatcher>INCLUDE</dispatcher>
      	</filter-mapping>
      

      However, Liferay Portal does not support activating a servlet filter with a filter-mapping using a <servlet-name>. For example:

      WEB-INF/web.xml
      	<servlet>
      		<servlet-name>TestServlet</servlet-name>
      		<servlet-class>com.liferay.test.TestServlet</servlet-class>
      		<load-on-startup>1</load-on-startup>
      	</servlet>
      	<servlet-mapping>
      		<servlet-name>TestServlet</servlet-name>
      		<url-pattern>/WEB-INF/servlet/view</url-pattern>
      	</servlet-mapping>
      	<filter>
      		<filter-name>testServletFilter</filter-name>
      		<filter-class>com.liferay.test.TestServletFilter</filter-class>
      	</filter>
      	<filter-mapping>
      		<filter-name>testServletFilter</filter-name>
      		<servlet-name>TestServlet</servlet-name>
      		<dispatcher>INCLUDE</dispatcher>
      	</filter-mapping>
      

      Steps to Reproduce

      1. Download the attached WAR and copy it to $LIFERAY_HOME/deploy

      2. Add the "LPS-92412" portlet to a portal page

      Expected Results

      The portlet should display "Test PASSED – the servlet filter executed"

      Actual Results

      The portlet displays "Test FAILED – the servlet filter did not execute"

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Days since last comment:
                  37 weeks, 2 days ago

                  Packages

                  Version Package