java - Session logout/ timeout -


to make short, here scenario:

  • the browser button must functional (i'm using jsf 2.0, working)

  • after logout, if user clicks button, app must redirect him/her login page (not working, user able view protected pages, although expired. can´t include meta tags disable browser caching because button stops working)

  • if user invokes action, clicking button, on 1 of expired pages should redirect him/her login or error page (not working, app throws error , shows blank page. exceptionhandlerwrapper implementation detects exception , using navigationhandler change viewid , render response ("facesexception" mapping on faces-config points login.jsf), app not behaving expected)

can please me solve problem?

  • the browser button must functional (i'm using jsf 2.0, working)

  • after logout, if user clicks button, app must redirect him/her login page (not working, user able view protected pages, although expired. can´t include meta tags disable browser caching because button stops working)

two steps solve problem.

  1. disable browser cache setting response headers accordingly. can in filter mapped on facesservlet.

    httpservletresponse hsr = (httpservletresponse) response; hsr.setheader("cache-control", "no-cache, no-store, must-revalidate"); // http 1.1. hsr.setheader("pragma", "no-cache"); // http 1.0. hsr.setdateheader("expires", 0); // proxies. chain.dofilter(request, response); 
  2. do not use http post page-to-page navigation. use http page-to-page navigation. if need submit form, let submit self (i.e. let action method return null or void) , use h:messages or h:somecomponent rendered="#{success}" display results in same page conditionally.


  • if user invokes action, clicking button, on 1 of expired pages should redirect him/her login or error page (not working, app throws error , shows blank page. exceptionhandlerwrapper implementation detects exception , using navigationhandler change viewid , render response ("facesexception" mapping on faces-config points login.jsf), app not behaving expected)

an <error-page> on javax.faces.webapp.viewexpiredexception been enough. see this answer.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -