ICEfaces
  1. ICEfaces
  2. ICE-7728

Avoid call to createResource during restoreState in BridgeSetup$NonTransientJavascriptResourceOutput

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: EE-3.0.0.BETA, 3.0.1
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 3 portal

      Description

      During the work done for http://jira.icefaces.org/browse/ICE-7684, we implemented a fix to solve a problem with the ace:dateExporter component when running on a portlet. The original problem in that case was related to the following section of code:

             public void restoreState(FacesContext context, Object state) {
                  //call method from super-class to restore the component attributes first
                  super.restoreState(context, state);
                  Map attributes = getAttributes();
                  String name = (String) attributes.get("name");
                  String library = (String) attributes.get("library");
                  String version = (String) attributes.get("version");

                  ResourceHandler resourceHandler = context.getApplication().getResourceHandler();
      --> Resource r = resourceHandler.createResource(name, fixResourceParameter(library));
                  String path = r.getRequestPath();
                  if (version == null) {
                      script = path;
                  } else {
                      if (path.contains("?")) {
                          script = path + "&v=" + version;
                      } else {
                          script = path + "?v=" + version;
                      }
                  }
              }

      There are 2 reasons for evaluating and potentially removing the createResource() call during restoreState().

      1) It exposes an issue in the PortletFaces Bridge where the request wrapper we set is replaced by the original raw request and the request parameter values are lost (see ICE-7684 for more details).

      2) It may be unnecessarily performance intensive.

        Issue Links

          Activity

          Hide
          Deryk Sinotte added a comment -

          Assigning to Mircea for a future release.

          Show
          Deryk Sinotte added a comment - Assigning to Mircea for a future release.
          Hide
          Mircea Toma added a comment -

          Modified NonTransientJavascriptResourceOutput code to save calculated script URL in the component's attribute map and then restore the URL from the map instead of recreating it.

          Show
          Mircea Toma added a comment - Modified NonTransientJavascriptResourceOutput code to save calculated script URL in the component's attribute map and then restore the URL from the map instead of recreating it.
          Hide
          Ken Fyten added a comment -

          Please add this to the 3.0.x-maintenance branch also for 3.0.1.

          Show
          Ken Fyten added a comment - Please add this to the 3.0.x-maintenance branch also for 3.0.1.
          Hide
          Mircea Toma added a comment -

          Applied patch to 3.0.x maintenance branch.

          Show
          Mircea Toma added a comment - Applied patch to 3.0.x maintenance branch.

            People

            • Assignee:
              Mircea Toma
              Reporter:
              Deryk Sinotte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: