ICEfaces
  1. ICEfaces
  2. ICE-7100

The ckeditor.js resource does not reload after cookies are cleared

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 3.0.RC2, 3.0
    • Labels:
      None
    • Environment:
      ICEfaces 2, Rich Text Editor

      Description

      The Component Showcase preloads the resources required for the Rich Input Text editor so that they are in the head before the component is dynamically added to the page.

      To recreate the problem:

      1) Load the component showcase main page. Check Firebug or the console for whatever browser you are using and ensure that the resource loaded. The resource link typically looks like this:

       http://localhost:8080/component-showcase/icefaces/resource/LTE5NDk5MzQyNTU=//ckeditor.js

      There is also related resource links that look like this:

      http://localhost:8080/component-showcase/icefaces/resource/LTE5NDk5MzQyNTU=/

      2) Clear cookies from your browser.

      3) Reload the page. The above resource links will result in a 404 Not found. The response content comes from the SessionBasedResourceDispatcher:

                  externalContext.responseSendError(404, "Could not find requested dynamic resource.");

      Because it's a Session based dispatcher, clearing the cookies also removes the session id. However, because the resources don't reload, the Rich Input Text no longer functions.

        Activity

        Hide
        Deryk Sinotte added a comment -

        My guess would be that the resource should be application scoped rather than session scoped since we always want this on to be there in this particular case.

        Show
        Deryk Sinotte added a comment - My guess would be that the resource should be application scoped rather than session scoped since we always want this on to be there in this particular case.
        Hide
        Ken Fyten added a comment -

        Ted says:

        If it really is just one file, it should be possible to serve it directly from the .jar as a standard JSF resource and not consider scope at all, and this can be served without considering scope whether the .js file needs to be referred to in the head or body of the document.


        Adnan, please review and implement the suggested change, if feasible.

        Show
        Ken Fyten added a comment - Ted says: If it really is just one file, it should be possible to serve it directly from the .jar as a standard JSF resource and not consider scope at all, and this can be served without considering scope whether the .js file needs to be referred to in the head or body of the document. Adnan, please review and implement the suggested change, if feasible.
        Hide
        Ted Goddard added a comment -

        Also, memory requirements will be reduced by not allocating the JavaScript as a session resource.

        Show
        Ted Goddard added a comment - Also, memory requirements will be reduced by not allocating the JavaScript as a session resource.
        Hide
        Mircea Toma added a comment -

        This issue is caused by the recent changes to the ResourceRegistry, the resources are now session scoped so they can be easily discarded when the session expires. The rich text resource registration still assumes that the resources are application scoped.

        The fix changed the resource registration by registering the same resource object for each session. After the registration each session is marked to avoid re-registering the resources during each JSF lifecycle.

        Show
        Mircea Toma added a comment - This issue is caused by the recent changes to the ResourceRegistry, the resources are now session scoped so they can be easily discarded when the session expires. The rich text resource registration still assumes that the resources are application scoped. The fix changed the resource registration by registering the same resource object for each session. After the registration each session is marked to avoid re-registering the resources during each JSF lifecycle.
        Hide
        Brad Kroeger added a comment -

        In the current client application I'm working on, I cleared the cache/cookies and was able to reproduce this issue. We have jars from August 25.

        In Firefox javascript console:

        "NetworkError: 404 Not Found - http://localhost:8080/1Line/icefaces/resource/LTE5NDk5MzQyNTU=//ckeditor.js"

        Show
        Brad Kroeger added a comment - In the current client application I'm working on, I cleared the cache/cookies and was able to reproduce this issue. We have jars from August 25. In Firefox javascript console: "NetworkError: 404 Not Found - http://localhost:8080/1Line/icefaces/resource/LTE5NDk5MzQyNTU=//ckeditor.js "
        Hide
        Mircea Toma added a comment -

        I could not reproduce the issue anymore. Waiting for the all the sessions to expire and then accessing the application with the browser with all its cookies cleared yielded successful results.

        Show
        Mircea Toma added a comment - I could not reproduce the issue anymore. Waiting for the all the sessions to expire and then accessing the application with the browser with all its cookies cleared yielded successful results.
        Hide
        Mircea Toma added a comment -

        Brad, have you rebuilt also icefaces-compat.jar before testing?

        Show
        Mircea Toma added a comment - Brad, have you rebuilt also icefaces-compat.jar before testing?
        Hide
        Deryk Sinotte added a comment -

        I just ran the original problem scenario using the latest head revision:

        URL: http://server.ice:8888/svn/ossrepo/icefaces2/trunk/icefaces
        Repository Root: http://server.ice:8888/svn/ossrepo
        Repository UUID: 8668f098-c06c-11db-ba21-f49e70c34f74
        Revision: 25404
        Node Kind: directory
        Schedule: normal
        Last Changed Author: mircea.toma
        Last Changed Rev: 25403
        Last Changed Date: 2011-09-05 09:06:11 -0700 (Mon, 05 Sep 2011)

        And the behaviour seems fine now. Need to Brad to confirm that it's fixed or provide specific way to reproduce.

        Show
        Deryk Sinotte added a comment - I just ran the original problem scenario using the latest head revision: URL: http://server.ice:8888/svn/ossrepo/icefaces2/trunk/icefaces Repository Root: http://server.ice:8888/svn/ossrepo Repository UUID: 8668f098-c06c-11db-ba21-f49e70c34f74 Revision: 25404 Node Kind: directory Schedule: normal Last Changed Author: mircea.toma Last Changed Rev: 25403 Last Changed Date: 2011-09-05 09:06:11 -0700 (Mon, 05 Sep 2011) And the behaviour seems fine now. Need to Brad to confirm that it's fixed or provide specific way to reproduce.
        Hide
        Brad Kroeger added a comment -

        Could not reproduce this issue in the poc from Grimlock head using JSF 2.1.3 jars.

        Show
        Brad Kroeger added a comment - Could not reproduce this issue in the poc from Grimlock head using JSF 2.1.3 jars.
        Hide
        Deryk Sinotte added a comment -

        We'll need to ensure that this works on WebSphere for the next EE release. Part of the testing for Component Showcase must include clearing cache/cookies and reloading.

        Some quick testing on Williams app (where the problem manifested) indicates that perhaps the extra slash in the resource URL is not handled in WebSphere. So rather than:

        http://172.31.50.58:9080/1Line/icefaces/resource/LTE5NDk5MzQyNTU=//ckeditor.js

        removing the extra slash in front of ckeditor.js works when typed in manually:

        http://172.31.50.58:9080/1Line/icefaces/resource/LTE5NDk5MzQyNTU=/ckeditor.js

        So in InputRichTextSetup:

        public void processEvent(SystemEvent event) throws AbortProcessingException {
        final FacesContext context = FacesContext.getCurrentInstance();
        if (EnvUtils.isICEfacesView(context)) {
        UIViewRoot root = context.getViewRoot();

        UIOutput inputTextJS = new UIOutputWriter() {
        public void encode(ResponseWriter writer, FacesContext context) throws IOException

        { String clientID = getClientId(context); writer.startElement("script", this); writer.writeAttribute("id", clientID + "JS", null); //Remove extra slash //writer.writeAttribute("src", getURI(context) + "/ckeditor.js", "src"); writer.writeAttribute("src", getURI(context) + "ckeditor.js", "src"); writer.endElement("script"); writer.startElement("script", this); writer.writeAttribute("id", clientID + "JSWrpr", null); writer.writeAttribute("src", getURI(context), null); writer.endElement("script"); }

        };
        inputTextJS.setTransient(true);
        inputTextJS.setId("inpRichTxt");

        root.addComponentResource(context, inputTextJS, "head");
        }
        }

        Show
        Deryk Sinotte added a comment - We'll need to ensure that this works on WebSphere for the next EE release. Part of the testing for Component Showcase must include clearing cache/cookies and reloading. Some quick testing on Williams app (where the problem manifested) indicates that perhaps the extra slash in the resource URL is not handled in WebSphere. So rather than: http://172.31.50.58:9080/1Line/icefaces/resource/LTE5NDk5MzQyNTU=//ckeditor.js removing the extra slash in front of ckeditor.js works when typed in manually: http://172.31.50.58:9080/1Line/icefaces/resource/LTE5NDk5MzQyNTU=/ckeditor.js So in InputRichTextSetup: public void processEvent(SystemEvent event) throws AbortProcessingException { final FacesContext context = FacesContext.getCurrentInstance(); if (EnvUtils.isICEfacesView(context)) { UIViewRoot root = context.getViewRoot(); UIOutput inputTextJS = new UIOutputWriter() { public void encode(ResponseWriter writer, FacesContext context) throws IOException { String clientID = getClientId(context); writer.startElement("script", this); writer.writeAttribute("id", clientID + "JS", null); //Remove extra slash //writer.writeAttribute("src", getURI(context) + "/ckeditor.js", "src"); writer.writeAttribute("src", getURI(context) + "ckeditor.js", "src"); writer.endElement("script"); writer.startElement("script", this); writer.writeAttribute("id", clientID + "JSWrpr", null); writer.writeAttribute("src", getURI(context), null); writer.endElement("script"); } }; inputTextJS.setTransient(true); inputTextJS.setId("inpRichTxt"); root.addComponentResource(context, inputTextJS, "head"); } }
        Hide
        Deryk Sinotte added a comment -

        I removed the extra slash as described above and tested it on Tomcat + Component Showcase with no ill effects. The change is now checked into the icefaces2/trunk

        Show
        Deryk Sinotte added a comment - I removed the extra slash as described above and tested it on Tomcat + Component Showcase with no ill effects. The change is now checked into the icefaces2/trunk

          People

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

            Dates

            • Created:
              Updated:
              Resolved: