myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Schwartz (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (TRINIDAD-2359) ClearRequestExternalContext wrapper applied unnecessarily
Date Mon, 04 Feb 2013 21:12:12 GMT

    [ https://issues.apache.org/jira/browse/TRINIDAD-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13570626#comment-13570626
] 

Andy Schwartz commented on TRINIDAD-2359:
-----------------------------------------

More details on #2 above...

GlobalConfiguratorImpl._isSetRequestBugPresent() performs the following test:


          // Call getInitParameterMap() up front
          ec.getInitParameterMap();

          ec.setRequest(new TestRequest(orig));

          _sHasSetRequestBug = !TestRequest.isTestParamPresent(ec);

Where TestRequest looks like this:

  static private class TestRequest
    extends ServletRequestWrapper
  {
    public TestRequest(ServletRequest request)
    {
      super(request);
    }

    @Override
    public String getParameter(String string)
    {
      if (_TEST_PARAM.equals(string))
      {
        return "passed";
      }

      return super.getParameter(string);
    }

    static public final boolean isTestParamPresent(ExternalContext ec)
    {
      return RequestStateMap.getInstance(ec).get(_TEST_PARAM) != null;
    }

    static private String _TEST_PARAM = TestRequest.class.getName() + ".TEST_PARAM";
  }

TestRequest.isTestParamPresent() is checking for the presence of this _TEST_PARAM in the RequestStateMap.
 However, the _TEST_PARAM lives in the ServletRequest's "parameter" map.  As far as I can
tell, these are different things - ie. the RequestStateMap does not actually delegate through
to the ServletRequest's parameter map.  Thus isTestParamPresent() will always return false,
even when the _TEST_PARAM is accessible via the request parameter map. 


                
> ClearRequestExternalContext wrapper applied unnecessarily
> ---------------------------------------------------------
>
>                 Key: TRINIDAD-2359
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2359
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 2.0.1-core
>            Reporter: Andy Schwartz
>            Assignee: Andy Schwartz
>            Priority: Minor
>
> GlobalConfiguratorImpl wraps the ExternalContext with a ClearRequestExternalContext if
it detects that Mojarra issue 493 (fixed back in Mojarra 1.2.04) is present.
> The Mojarra issue is described here:
> http://java.net/jira/browse/JAVASERVERFACES-493 setRequest does not reset request maps
> Two problems with this:
> 1.  This issue was fixed in 2007, so it is unclear whether we should ever bother applying
this workaround.
> 2.  The code which detects the presence of this Mojarra issue is buggy.
> As a result of #2, GlobalConfiguratorImpl always adds a ClearRequestExternalContext wrapper,
regardless of whether the old Mojarra issue is present or not.

--
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

Mime
View raw message