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

        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.
        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.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: