Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3722

Cache for ResourceHandlerImpl.isResourceRequest seams not to work in 'none resource requests'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.11
    • 2.0.19, 2.1.13
    • None
    • None

    Description

      There is a cache for the calculated result whether the given request is a resource request.

      I think it is not working as expected in the moment.

      ResourceHandlerImpl:
      @Override
      public boolean isResourceRequest(FacesContext facesContext)
      {
      // Since this method could be called many times we save it
      //on request map so the first time is calculated it remains
      //alive until the end of the request
      Boolean value = (Boolean) facesContext.getAttributes().get(IS_RESOURCE_REQUEST);

      if (value != null && value)

      { //return the saved value return value; }

      else
      {
      String resourceBasePath = getResourceHandlerSupport()
      .calculateResourceBasePath(facesContext);

      if (resourceBasePath != null
      && resourceBasePath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER))

      { facesContext.getAttributes().put(IS_RESOURCE_REQUEST, Boolean.TRUE); return true; }

      else

      { facesContext.getAttributes().put(IS_RESOURCE_REQUEST, Boolean.FALSE); return false; }

      }
      }

      In case of IS_RESOURCE_REQUEST=false the value is recalculated for every method call again because of the 'if (value != null && value)'. I think it just should be 'if (value != null)', or?


      (
      @Override
      public boolean isResourceRequest(FacesContext facesContext)
      {
      // Since this method could be called many times we save it
      // on request map so the first time is calculated it remains
      // alive until the end of the request
      Boolean value = (Boolean) facesContext.getAttributes().get(IS_RESOURCE_REQUEST);

      if (value == null)

      { String resourceBasePath = getResourceHandlerSupport() .calculateResourceBasePath(facesContext); value = resourceBasePath != null && resourceBasePath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER); facesContext.getAttributes().put(IS_RESOURCE_REQUEST, value); }

      return value;
      }

      )

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            hoersch dennis hoersch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: