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

Calling containsHeader on a CacheResponse object returns incorrect result

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s: 5.2.3
    • Fix Version/s: 5.1.2, 5.2.3
    • Component/s: WCM
    • Labels:
      None
    • Environment:
      Any
    • Branch Version/s:
      5.2.x, 5.1.x

      Description

      The containsHeader calls in the following method always fail:

      com.liferay.portlet.PortletResponseImpl.transferHeaders(HttpServletResponse)

      Because we do not implement/override containsHeader method in com.liferay.util.servlet.filters.CacheResponse.

      Issue:

      response.setHeader("headerName", "headerValue");

      // This sets the "headerName" header in com.liferay.util.servlet.filters.CacheResponse classe's _headers object

      response.containsHeader("headerName");

      // This checks whether "headerName" header exists in the org.apache.coyote.Response classes's _headers object

      Solution:

      Override the containsHeader method in com.liferay.util.servlet.filters.CacheResponse:

      public boolean containsHeader(String name) {

      boolean hasHeader = false;

      if (getHeader(name) != null) {
      hasHeader = true;
      }

      return hasHeader;
      }

        Attachments

          Activity

            People

            • Assignee:
              bijan.vakili Bijan Vakili (Inactive)
              Reporter:
              bijan.vakili Bijan Vakili (Inactive)
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                9 years, 12 weeks ago

                Packages

                Version Package
                5.1.2
                5.2.3