ICEfaces
  1. ICEfaces
  2. ICE-5271

Need to deal with expired sessions in a user friendly way

    Details

      Description

      Currently, when a session expires, there is no user-friendly mechanism to deal with it. For example, with push, you will typically get some sort of stack trace on the server-side and a noop on the client:

      Jan 14, 2010 1:42:24 PM org.icefaces.push.BridgeSetup createView
      WARNING: Unable to set up WindowScope
      java.lang.RuntimeException: Unknown window scope ID: 1263503554941
      at org.icefaces.application.WindowScopeManager.determineWindowID(WindowScopeManager.java:65)
      at org.icefaces.push.BridgeSetup.createView(BridgeSetup.java:38)
      at com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:101)
      at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:200)
      at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
      at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:131)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:430)
      at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
      at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:288)
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
      at java.lang.Thread.run(Thread.java:637)
      javax.faces.application.ViewExpiredException: viewId:/auction.jsf - View /auction.jsf could not be restored.
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:212)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
      at java.lang.Thread.run(Thread.java:637)

        Activity

        Deryk Sinotte created issue -
        Deryk Sinotte made changes -
        Field Original Value New Value
        Salesforce Case []
        Fix Version/s 2.0-Beta [ 10032 ]
        Assignee Priority P2
        Assignee Mircea Toma [ mircea.toma ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #20643 Tue Feb 16 11:19:17 MST 2010 mircea.toma ICE-5271 Detect requests that to expired sessions. Respond with standard JSF2 error code. Introduce default indicators for session expiry and server errors.
        Files Changed
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/javascript/application.js
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/push/servlet/SessionExpiredException.java
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/build.javascript.xml
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/push/BridgeSetup.java
        Commit graph ADD /icefaces/scratchpads/glimmer/core/src/main/javascript/status.js
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/push/servlet/ICEfacesResourceHandler.java
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/event/DetectNavigationPhaseListener.java
        Hide
        Mircea Toma added a comment - - edited

        Detect requests that to expired sessions. Respond with AJAX, JSF2 standard, error message. Introduce default indicators for session expiry and server errors.

        Show
        Mircea Toma added a comment - - edited Detect requests that to expired sessions. Respond with AJAX, JSF2 standard, error message. Introduce default indicators for session expiry and server errors.
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Mircea Toma added a comment -

        The detection of requests belonging to a expired session is done in ICEfacesResourceHandler before JSF lifecycle is executed. Throwing SessionExpiredException right away will send a 500 response with a HTML page containing the stack trace. To simplify error rendering on the client it is preferable to make JSF send a standardized AJAX error message back to the client instead. To achieve this the request belonging to an expired session is marked by saving an attribute in the associated map, if the marker is present when BridgeSetup.createView is invoked (during the JSF lifecycle) SessionExpiredException is thrown. The exception is then captured by JSF and eventually an AJAX error response is sent back to the client, response that contains the exception class and its message.

        Show
        Mircea Toma added a comment - The detection of requests belonging to a expired session is done in ICEfacesResourceHandler before JSF lifecycle is executed. Throwing SessionExpiredException right away will send a 500 response with a HTML page containing the stack trace. To simplify error rendering on the client it is preferable to make JSF send a standardized AJAX error message back to the client instead. To achieve this the request belonging to an expired session is marked by saving an attribute in the associated map, if the marker is present when BridgeSetup.createView is invoked (during the JSF lifecycle) SessionExpiredException is thrown. The exception is then captured by JSF and eventually an AJAX error response is sent back to the client, response that contains the exception class and its message.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #20686 Wed Feb 17 17:27:43 MST 2010 mircea.toma ICE-5271 Throw SessionExpiredException only for postback requests.
        Files Changed
        Commit graph MODIFY /icefaces/scratchpads/glimmer/core/src/main/java/org/icefaces/push/servlet/ICEfacesResourceHandler.java
        Ken Fyten made changes -
        Fix Version/s 2.0.0 [ 10230 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Priority P2

          People

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

            Dates

            • Created:
              Updated:
              Resolved: