struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <dakota.j...@gmail.com>
Subject Re: howto redirect to login site after session expiration?
Date Mon, 23 May 2005 14:46:38 GMT
If you keep a user object in session, just check at the beginning of
the Action whether it is still with you.  If not, forward to a log on
page.  I assume that will work for you.  If you don't have a user
object in session, whether authorized or not, then you can put a
simple String iin session saying "live" to test the session.

On 5/23/05, Frank Ratzlow <ratzlow@adesso.de> wrote:
> Hallo folks,
> 
> I encountered a strange behaviour regarding the population mechanics of my
> forms.
> 
> Following situation: I have my app running, the browser stays open with a
> html form to be filled. The http-session expires and the user submits the
> form to the server. The result is a http 500 error resulting from a NPE
> caused while accessing the underlying struts form to populate.
> What makes me wonder is the fact that although the session expired the
> request is passed through the ActionServlet, a population of the
> ActionForm is attempted and of course not be completed since the session
> including it's objects are already removed.
> 
> I would like to see a redirect to an error site that I specify in the
> web.xml or struts-config.xml in that case. How do I ensure that
> unauthenticated users or users with an expired session are redirected to
> such a specified site?
> 
> TIA
> 
> Frank
> 
> JBoss 3.2.3
> Tomcat 4.1.29 (integrated)
> Struts 1.1
> JDK 1.4.2_06
> Windows XP
> 
> ===========Stacktrace Start=========================
> 11:16:00,140 ERROR [Engine] StandardWrapperValve[action]:
> Servlet.service() for servlet action threw exception
> javax.servlet.ServletException: BeanUtils.populate
>         at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
>         at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
>         at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
>         at
> com.hannoverre.mmf.presentation.general.MMFActionServlet.process(MMFActionServlet.java:126)
>         at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
>         at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
>         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
>         at java.lang.Thread.run(Thread.java:534)
> 11:16:00,140 ERROR [Engine] ----- Root Cause -----
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:493)
>         at
> org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:428)
>         at
> org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:770)
>         at
> org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
>         at
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
>         at
> org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
>         at
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
>         at
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
>         at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
>         at
> com.hannoverre.mmf.presentation.general.MMFActionServlet.process(MMFActionServlet.java:126)
>         at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>         at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
>         at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
>         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
>         at java.lang.Thread.run(Thread.java:534)
> Caused by: java.lang.NullPointerException
>         at
> com.hannoverre.mmf.presentation.general.contract.ContractContentBaseForm.getNotification(ContractContentBaseForm.java:2003)
>         ... 57 more
> 
> ===========Stacktrace End  =========================
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message