ICEfaces
  1. ICEfaces
  2. ICE-8506

CLONE -Session Expired responses received but not displayed.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Component/s: Bridge
    • Labels:
      None
    • Environment:
      ICEfaces 2 Auction AuctionMonitor MyFaces Mojarra
    • Assignee Priority:
      P1

      Description

      In testing the Auction example with MyFaces, I noticed that when the session expired, I was receiving the proper response from the push requests:

      <?xml version='1.0' encoding='UTF-8'?>
          <partial-response>
              <error>
                  <error-name>class org.icefaces.application.SessionExpiredException</error-name>
                  <error-message><![CDATA[Session has expired]]></error-message>
              </error>
          </partial-response>

      but it was not popping up a notification on the client nor was it shutting down push. Push would keep running and returning the SessionExpiredException over and over.

      I set some breakpoints at various points in the bridge.js code to see where it might be breaking down but it doesn't appear that the following function is being called at all:

              function filterICEfacesEvents(f) {...

      which suggests that the callback is not being called for some reason:

              jsf.ajax.addOnError(filterICEfacesEvents(submitErrorBroadcaster(networkErrorListeners, serverErrorListeners)));

        Issue Links

          Activity

          Hide
          Xabier Pastor added a comment -

          In 3.1.0 is re-produced the same issue.

          Show
          Xabier Pastor added a comment - In 3.1.0 is re-produced the same issue.
          Hide
          Ken Fyten added a comment -

          Xabier, can you describe exactly what you are seeing and how to reproduce the issue pls.

          Show
          Ken Fyten added a comment - Xabier, can you describe exactly what you are seeing and how to reproduce the issue pls.
          Hide
          Xabier Pastor added a comment -

          In the web.xml:

          <context-param>
          <param-name>org.icefaces.sessionExpiredRedirectURI</param-name>
          <param-value>seguridad.xhtml</param-value>
          </context-param>
          <context-param>
          <param-name>org.icefaces.connectionLostRedirectURI</param-name>
          <param-value>seguridad.xhtml</param-value>
          </context-param>

          <session-config>
          <session-timeout>90</session-timeout>
          </session-config>

          When i clic any link in the web application after the 90 minutes fixed for the session inactivity the browser does nothing.

          To solve this i have had to put this in the faces-config.xml to redirect the user to the login page after a session timeout:

          <lifecycle>
          <phase-listener>filters.SessionTimeoutFilter</phase-listener>
          </lifecycle>

          And this in the created class:

          import javax.faces.FacesException;
          import javax.faces.application.Application;
          import javax.faces.application.ViewHandler;
          import javax.faces.component.UIViewRoot;
          import javax.faces.context.ExternalContext;
          import javax.faces.context.FacesContext;
          import javax.faces.event.PhaseEvent;
          import javax.faces.event.PhaseId;
          import javax.faces.event.PhaseListener;
          import javax.servlet.http.HttpSession;

          @SuppressWarnings("serial")
          public class SessionTimeoutFilter implements PhaseListener {

          public void afterPhase(PhaseEvent event) {}

          public void beforePhase(PhaseEvent event) {
          FacesContext context = event.getFacesContext();
          ExternalContext ext = context.getExternalContext();
          HttpSession session = (HttpSession) ext.getSession(false);

          boolean newSession = (session == null) || (session.isNew());
          boolean postback = !ext.getRequestParameterMap().isEmpty();
          boolean timedout = postback && newSession;

          if (timedout) {
          Application app = context.getApplication();
          ViewHandler viewHandler = app.getViewHandler();
          UIViewRoot view = viewHandler.createView(context, "/seguridad.xhtml");
          context.setViewRoot(view);
          context.renderResponse();
          try

          { viewHandler.renderView(context, view); context.responseComplete(); }

          catch (Throwable t)

          { throw new FacesException("Se ha producido un error tras timeout de la session.", t); }

          }
          }

          public PhaseId getPhaseId()

          { return PhaseId.RESTORE_VIEW; }

          }

          Show
          Xabier Pastor added a comment - In the web.xml: <context-param> <param-name>org.icefaces.sessionExpiredRedirectURI</param-name> <param-value>seguridad.xhtml</param-value> </context-param> <context-param> <param-name>org.icefaces.connectionLostRedirectURI</param-name> <param-value>seguridad.xhtml</param-value> </context-param> <session-config> <session-timeout>90</session-timeout> </session-config> When i clic any link in the web application after the 90 minutes fixed for the session inactivity the browser does nothing. To solve this i have had to put this in the faces-config.xml to redirect the user to the login page after a session timeout: <lifecycle> <phase-listener>filters.SessionTimeoutFilter</phase-listener> </lifecycle> And this in the created class: import javax.faces.FacesException; import javax.faces.application.Application; import javax.faces.application.ViewHandler; import javax.faces.component.UIViewRoot; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; import javax.servlet.http.HttpSession; @SuppressWarnings("serial") public class SessionTimeoutFilter implements PhaseListener { public void afterPhase(PhaseEvent event) {} public void beforePhase(PhaseEvent event) { FacesContext context = event.getFacesContext(); ExternalContext ext = context.getExternalContext(); HttpSession session = (HttpSession) ext.getSession(false); boolean newSession = (session == null) || (session.isNew()); boolean postback = !ext.getRequestParameterMap().isEmpty(); boolean timedout = postback && newSession; if (timedout) { Application app = context.getApplication(); ViewHandler viewHandler = app.getViewHandler(); UIViewRoot view = viewHandler.createView(context, "/seguridad.xhtml"); context.setViewRoot(view); context.renderResponse(); try { viewHandler.renderView(context, view); context.responseComplete(); } catch (Throwable t) { throw new FacesException("Se ha producido un error tras timeout de la session.", t); } } } public PhaseId getPhaseId() { return PhaseId.RESTORE_VIEW; } }
          Hide
          Mircea Toma added a comment - - edited

          I tested 'auction' application with Myfaces with success. The "User session expired" popup showed correctly every time the session expired.
          Just commenting on the description of this issue, the filerICEfaceEvents function in the bridge does not exist anymore in the trunk (and since 3.1 release) because we refactored the implementation in that area. Also, the use of org.icefaces.sessionExpiredRedirectURI parameter is valid only when using icefaces-compat.jar library.

          Show
          Mircea Toma added a comment - - edited I tested 'auction' application with Myfaces with success. The "User session expired" popup showed correctly every time the session expired. Just commenting on the description of this issue, the filerICEfaceEvents function in the bridge does not exist anymore in the trunk (and since 3.1 release) because we refactored the implementation in that area. Also, the use of org.icefaces.sessionExpiredRedirectURI parameter is valid only when using icefaces-compat.jar library.

            People

            • Assignee:
              Mircea Toma
              Reporter:
              Xabier Pastor
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: