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

        Deryk Sinotte created issue -
        Deryk Sinotte made changes -
        Field Original Value New Value
        Assignee Deryk Sinotte [ deryk.sinotte ]
        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.
        Ken Fyten made changes -
        Salesforce Case []
        Assignee Priority P2
        Assignee Deryk Sinotte [ deryk.sinotte ] Adnan Durrani [ adnan.durrani ]
        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.
        Adnan Durrani made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Adnan Durrani made changes -
        Attachment editor-zip.jpg [ 13413 ]
        Adnan Durrani made changes -
        Assignee Adnan Durrani [ adnan.durrani ] Ken Fyten [ ken.fyten ]
        Ken Fyten made changes -
        Salesforce Case []
        Assignee Ken Fyten [ ken.fyten ] Mircea Toma [ mircea.toma ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #25284 Fri Aug 19 12:54:04 MDT 2011 mircea.toma ICE-7100 Register rich test resources with each session based ResourceRegistry. Mark sessions that have their resources registered to avoid re-registering them.
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/inputrichtext/InputRichTextSetup.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #25287 Fri Aug 19 13:35:58 MDT 2011 mircea.toma ICE-7100 Make setup fields non-static to avoid class loading issues in multi-application EAR packaged deployments.
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/inputrichtext/InputRichTextSetup.java
        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.
        Mircea Toma made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        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 "
        Brad Kroeger made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        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.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        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.
        Deryk Sinotte made changes -
        Salesforce Case []
        Assignee Mircea Toma [ mircea.toma ] Brad Kroeger [ brad.kroeger ]
        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.
        Arran Mccullough made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Brad Kroeger made changes -
        Assignee Brad Kroeger [ brad.kroeger ] Ken Fyten [ ken.fyten ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #25964 Wed Oct 19 09:50:18 MDT 2011 deryk.sinotte ICE-7100: remove extra slash in src URL that WebSphere appears not to like
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/inputrichtext/InputRichTextSetup.java
        Ken Fyten made changes -
        Salesforce Case []
        Assignee Ken Fyten [ ken.fyten ] Deryk Sinotte [ deryk.sinotte ]
        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"); } }
        Deryk Sinotte made changes -
        Salesforce Case []
        Fix Version/s EE-2.1.0 [ 10262 ]
        Fix Version/s 2.1 [ 10241 ]
        Assignee Priority P2 P1
        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
        Ken Fyten made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Fix Version/s 3.0 [ 10241 ]
        Fix Version/s EE-3.0.0.GA [ 10262 ]
        Assignee Priority P1
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 3.0.RC2 [ 10313 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: