ICEfaces
  1. ICEfaces
  2. ICE-10984

Receiving a 404 Not Found when the first request is a .icepush request

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-4.0.0.GA, 4.1.1
    • Fix Version/s: EE-4.1.0.GA, 4.2.BETA, 4.2
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces, ICEpush

      Description

      If the first request received by the server-side is a .icepush request, the server returns with a 404 Not Found.

        Activity

        Hide
        Jack Van Ooststroom added a comment -

        Sending core/src/main/java/org/icefaces/impl/push/servlet/ICEpushResourceHandler.java
        Transmitting file data .
        Committed revision 48512.

        Show
        Jack Van Ooststroom added a comment - Sending core/src/main/java/org/icefaces/impl/push/servlet/ICEpushResourceHandler.java Transmitting file data . Committed revision 48512.
        Hide
        Jack Van Ooststroom added a comment -

        First of all the .icepush requests when using ICEfaces are ending in .icepush.xml.jsf and will result in getting the FacesServlet to get initiated. When this occurs, the ICEpushResourceHandler gets asked if this request is to be considered a "resource request", which gets confirmed. Finally, the ICEpushResourceHandler gets asked to handle the "resource request" as it confirmed it to be a "resource request". However, the ICEpushResourceHandler has not set-up the MainServlet just yet and as a result will let the wrapped ResourceHandler handle the "resource request" causing it to return the 404 Not Found.

        The ICEpushResourceHandler is registered as a PhaseListener interested in the PhaseId.RESTORE_VIEW. When this occurs within the JSF lifecycle upon getting its beforePhase(PhaseEvent) method invoked, the MainServlet is instantiated. If the first request received is a .icepush request this will not happen and as a result will return the 404 Not Found.

        A new getMainServlet() method has been introduced in the ICEpushResourceHandlerImpl class functioning as a sort of getInstance() method. This piece of code is guarded by a lock to ensure the MainServlet only gets initiated once. This method is now used throughout the various methods within the ICEpushResourceHandlerImpl, including the beforePhase(PhaseEvent) method, to ensure the MainServlet gets initiated even before or without invoking the beforePhase(PhaseEvent) method.

        I successfully tested this in a number of scenarios using the Emporium sample:

        1. Open the Emporium sample.
        2. Open the Emporium sample; initiate a separate create-pushid.icepush request.
        3. Initiate a separate create-pushid.icepush request.
        4. Initiate a separate create-pushid.icepush request; open the Emporium sample.

        Marking this one as FIXED.

        Show
        Jack Van Ooststroom added a comment - First of all the .icepush requests when using ICEfaces are ending in .icepush.xml.jsf and will result in getting the FacesServlet to get initiated. When this occurs, the ICEpushResourceHandler gets asked if this request is to be considered a "resource request", which gets confirmed. Finally, the ICEpushResourceHandler gets asked to handle the "resource request" as it confirmed it to be a "resource request". However, the ICEpushResourceHandler has not set-up the MainServlet just yet and as a result will let the wrapped ResourceHandler handle the "resource request" causing it to return the 404 Not Found. The ICEpushResourceHandler is registered as a PhaseListener interested in the PhaseId.RESTORE_VIEW . When this occurs within the JSF lifecycle upon getting its beforePhase(PhaseEvent) method invoked, the MainServlet is instantiated. If the first request received is a .icepush request this will not happen and as a result will return the 404 Not Found. A new getMainServlet() method has been introduced in the ICEpushResourceHandlerImpl class functioning as a sort of getInstance() method. This piece of code is guarded by a lock to ensure the MainServlet only gets initiated once. This method is now used throughout the various methods within the ICEpushResourceHandlerImpl , including the beforePhase(PhaseEvent) method, to ensure the MainServlet gets initiated even before or without invoking the beforePhase(PhaseEvent) method. I successfully tested this in a number of scenarios using the Emporium sample: Open the Emporium sample. Open the Emporium sample; initiate a separate create-pushid.icepush request. Initiate a separate create-pushid.icepush request. Initiate a separate create-pushid.icepush request; open the Emporium sample. Marking this one as FIXED.

          People

          • Assignee:
            Jack Van Ooststroom
            Reporter:
            Jack Van Ooststroom
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: