PUBLIC - Liferay Portal Community Edition
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-9475

Move call "request.setCharacterEncoding(StringPool.UTF8);" to BasePortalFilter

    Details

    • Type: Feature Request Feature Request
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.1.2, 5.2.3, 6.0.1 RC
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Glassfish v2.1 related issue LEP-2926
    • Branch Version/s:
      5.2.x
    • Backported to Branch:
      Committed
    • Similar Issues:
      Show 3 results 

      Description

      Envirionment Glassfish.

      When creating custom filter to Liferay on ext envronment by extending BasePortalFilter. If this custom filter has been added as be executed on first on Liferay then it will cause character encoding problems on special characters if request.getParameter() has been called on filter. See also related issue LEP-2926, where solution is not complete on my point of view.

      On custom filter this can be fixed by putting following on filter.

      request.setCharacterEncoding(StringPool.UTF8);

      But this then cause VirtualHostFilter filter request.setCharacterEncoding(StringPool.UTF8) call to be complain.

      Which further ca be fixed on ext by fixing Virtual host filter.

      By changing

      request.setCharacterEncoding(StringPool.UTF8);

      to

      if (!StringPool.UTF8.equals(request.getCharacterEncoding()))

      { request.setCharacterEncoding(StringPool.UTF8); }

      SOLUTION:

      I would suggest that this request.setCharacterEncoding(StringPool.UTF8) would be moved on BasePortalFilter level so ext users would not have run on unnecessary problems while using it.

        Activity

        Hide
        Sampsa Sohlman added a comment -

        Actually the case I'm talking about the custom filter which had to first. As quickly reading newest code from trunk that filter still should be first on web.xml

        Anyway I still would fix AbsoluteRedirectsFilter

        request.setCharacterEncoding(StringPool.UTF8);

        to

        if (!StringPool.UTF8.equals(request.getCharacterEncoding()))

        { request.setCharacterEncoding(StringPool.UTF8); }

        but no change for BasePortalFilter as AbsoluteRedirectsFilter should be first.

        Show
        Sampsa Sohlman added a comment - Actually the case I'm talking about the custom filter which had to first. As quickly reading newest code from trunk that filter still should be first on web.xml Anyway I still would fix AbsoluteRedirectsFilter request.setCharacterEncoding(StringPool.UTF8); to if (!StringPool.UTF8.equals(request.getCharacterEncoding())) { request.setCharacterEncoding(StringPool.UTF8); } but no change for BasePortalFilter as AbsoluteRedirectsFilter should be first.
        Hide
        Vicki Tsang added a comment - - edited

        Hi Sampsa,

        Thank you for your contribution. Please could you verify that this issue still exists in our latest version and attach the solution as a patch as per guidelines found here. Please then click Contribute Solution and accept our Contributors Agreement. As you are the reporter of the issues, please then click Accept Solution. Once we receive the patch, our engineers can review it for submission in the next release.

        Thanks once again for your contribution.

        Best,

        Vicki Tsang

        Show
        Vicki Tsang added a comment - - edited Hi Sampsa, Thank you for your contribution. Please could you verify that this issue still exists in our latest version and attach the solution as a patch as per guidelines found here . Please then click Contribute Solution and accept our Contributors Agreement. As you are the reporter of the issues, please then click Accept Solution. Once we receive the patch, our engineers can review it for submission in the next release. Thanks once again for your contribution. Best, Vicki Tsang
        Hide
        Sampsa Sohlman added a comment -

        I can look the code again and made patch if necessary.

        Show
        Sampsa Sohlman added a comment - I can look the code again and made patch if necessary.
        Hide
        s t added a comment -

        Hi,
        I came across this problem just last week. request.getParameter("yeah") changes the parameter encoding. Living on Liferay 6.0 EE SP2.

        I don't like the suggested solution. It's a workaround but no clean fix. Rather should Liferay run necessary filters first, before allowing custom filters to jump in.

        Are there any news on this issue?
        Thanks.
        Stefan

        Show
        s t added a comment - Hi, I came across this problem just last week. request.getParameter("yeah") changes the parameter encoding. Living on Liferay 6.0 EE SP2. I don't like the suggested solution. It's a workaround but no clean fix. Rather should Liferay run necessary filters first, before allowing custom filters to jump in. Are there any news on this issue? Thanks. Stefan
        Hide
        Randy Zhu added a comment -

        In preparation for Ideation; we are merging New Feature and Improvement tickets into a singular ticket type called “Feature Request”. Additional information to follow soon.

        Show
        Randy Zhu added a comment - In preparation for Ideation; we are merging New Feature and Improvement tickets into a singular ticket type called “Feature Request”. Additional information to follow soon.

          People

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

            Dates

            • Created:
              Updated:
              Days since last comment:
              2 years, 11 weeks, 5 days ago

              Development

                Structure Helper Panel