RE: Probelm with global-exceptions routing.
Afaik, the global-exceptions only traps exceptions thrown up from your actions (not from the RP or the JSPs) (I could be wrong about this though!) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 5 September 2003 16:50 To: [EMAIL PROTECTED] Subject: Probelm with global-exceptions routing. I have written my own RequestProcessor class (MyRequestProcessor.java) by extending the STRUTS provided RequesrProcessor class. I have overridden the processPreprocess() method as below. Also I have defined the java.lang.NullPointerException in the global-exceptions of struts-config.xml as shown below. But still I am getting java.lang.NullPointerException instead of being routed to the index.jsp. Is there anything that I am missing. Any clues please. public boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) { try { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION TRY ] - ); NullPointerException n = new NullPointerException(); throw n; } catch(Error e) { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION CATCH ] - ); } } Made the below entries in struts-config.xml global-exceptions exception key=message.example.simple path=/index.jsp type =java.lang.NullPointerException/ /global-exceptions controller processorClass=examples.MyRequestProcessor/ The stack trace that I am getting on the screen: java.lang.NullPointerException at examples.MyRequestProcessor.processPreprocess(MyRequestProcessor.java:36) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:237) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:506) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190 Regards Sreekant G - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Probelm with global-exceptions routing.
Basically what I wanted to do in the processPreprocess() method of MyRequestProcessor class was Check if there were any User related credentials in the session, if yes let the process continute. If not then throw the Logon page. Is there any otherway I can achieve this so that the application developer doesn't have to take care of this in each and every Action class that he/she writes. Regards Sreekant G @ 98404-65630 Andrew Hill [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] idnode.com cc: Subject: RE: Probelm with global-exceptions routing. 09/05/2003 02:27 PM Please respond to Struts Users Mailing List Afaik, the global-exceptions only traps exceptions thrown up from your actions (not from the RP or the JSPs) (I could be wrong about this though!) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 5 September 2003 16:50 To: [EMAIL PROTECTED] Subject: Probelm with global-exceptions routing. I have written my own RequestProcessor class (MyRequestProcessor.java) by extending the STRUTS provided RequesrProcessor class. I have overridden the processPreprocess() method as below. Also I have defined the java.lang.NullPointerException in the global-exceptions of struts-config.xml as shown below. But still I am getting java.lang.NullPointerException instead of being routed to the index.jsp. Is there anything that I am missing. Any clues please. public boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) { try { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION TRY ] - ); NullPointerException n = new NullPointerException(); throw n; } catch(Error e) { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION CATCH ] - ); } } Made the below entries in struts-config.xml global-exceptions exception key=message.example.simple path=/index.jsp type =java.lang.NullPointerException/ /global-exceptions controller processorClass=examples.MyRequestProcessor/ The stack trace that I am getting on the screen: java.lang.NullPointerException at examples.MyRequestProcessor.processPreprocess(MyRequestProcessor.java:36) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:237) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:506) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190 Regards Sreekant G
RE: Probelm with global-exceptions routing.
not sure if struts handles exceptions thrown from RequestProcessor. |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED] |Sent: Friday, September 05, 2003 2:20 PM |To: [EMAIL PROTECTED] |Subject: Probelm with global-exceptions routing. | | |I have written my own RequestProcessor class (MyRequestProcessor.java) by |extending the STRUTS provided RequesrProcessor class. I have overridden the |processPreprocess() method as below. Also I have defined the |java.lang.NullPointerException in the global-exceptions of |struts-config.xml as shown below. But still I am getting |java.lang.NullPointerException instead of being routed to the index.jsp. Is |there anything that I am missing. Any clues please. | |public boolean processPreprocess(HttpServletRequest request, |HttpServletResponse response) |{ | try | { |System.out.println( --- [MY REQUEST PROCESSOR |CLASS EXCEPTION TRY ] - ); |NullPointerException n = new NullPointerException(); |throw n; | } | catch(Error e) | { |System.out.println( --- [MY REQUEST PROCESSOR |CLASS EXCEPTION CATCH ] - ); | } |} | | |Made the below entries in struts-config.xml | |global-exceptions |exception key=message.example.simple path=/index.jsp type |=java.lang.NullPointerException/ |/global-exceptions | |controller processorClass=examples.MyRequestProcessor/ | | | |The stack trace that I am getting on the screen: |java.lang.NullPointerException | at |examples.MyRequestProcessor.processPreprocess(MyRequestProcessor.java:36) | at |org.apache.struts.action.RequestProcessor.process(RequestProcessor. |java:237) | | at |org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480) | at |org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:506) | at |javax.servlet.http.HttpServlet.service(HttpServlet.java:740) | at |javax.servlet.http.HttpServlet.service(HttpServlet.java:853) | at |org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ap |plicationFilterChain.java:247) | | at |org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicatio |nFilterChain.java:193) | | at |org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrappe |rValve.java:243) | | at |org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeli |ne.java:566) | | at |org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) | at |org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) | at |org.apache.catalina.core.StandardContextValve.invoke(StandardContex |tValve.java:190 | |Regards |Sreekant G | | | - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Probelm with global-exceptions routing.
U can add a Servlet in your web.xml which will check for User credential Regards Rohit -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 3:17 PM To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: RE: Probelm with global-exceptions routing. Basically what I wanted to do in the processPreprocess() method of MyRequestProcessor class was Check if there were any User related credentials in the session, if yes let the process continute. If not then throw the Logon page. Is there any otherway I can achieve this so that the application developer doesn't have to take care of this in each and every Action class that he/she writes. Regards Sreekant G @ 98404-65630 Andrew Hill [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] idnode.com cc: Subject: RE: Probelm with global-exceptions routing. 09/05/2003 02:27 PM Please respond to Struts Users Mailing List Afaik, the global-exceptions only traps exceptions thrown up from your actions (not from the RP or the JSPs) (I could be wrong about this though!) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 5 September 2003 16:50 To: [EMAIL PROTECTED] Subject: Probelm with global-exceptions routing. I have written my own RequestProcessor class (MyRequestProcessor.java) by extending the STRUTS provided RequesrProcessor class. I have overridden the processPreprocess() method as below. Also I have defined the java.lang.NullPointerException in the global-exceptions of struts-config.xml as shown below. But still I am getting java.lang.NullPointerException instead of being routed to the index.jsp. Is there anything that I am missing. Any clues please. public boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) { try { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION TRY ] - ); NullPointerException n = new NullPointerException(); throw n; } catch(Error e) { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION CATCH ] - ); } } Made the below entries in struts-config.xml global-exceptions exception key=message.example.simple path=/index.jsp type =java.lang.NullPointerException/ /global-exceptions controller processorClass=examples.MyRequestProcessor/ The stack trace that I am getting on the screen: java.lang.NullPointerException at examples.MyRequestProcessor.processPreprocess(MyRequestProcessor.java:36) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:237) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:506) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66
RE: Probelm with global-exceptions routing.
Look into using a Filter for this. robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 5:47 AM To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: RE: Probelm with global-exceptions routing. Basically what I wanted to do in the processPreprocess() method of MyRequestProcessor class was Check if there were any User related credentials in the session, if yes let the process continute. If not then throw the Logon page. Is there any otherway I can achieve this so that the application developer doesn't have to take care of this in each and every Action class that he/she writes. Regards Sreekant G @ 98404-65630 Andrew Hill [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] idnode.com cc: Subject: RE: Probelm with global-exceptions routing. 09/05/2003 02:27 PM Please respond to Struts Users Mailing List Afaik, the global-exceptions only traps exceptions thrown up from your actions (not from the RP or the JSPs) (I could be wrong about this though!) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 5 September 2003 16:50 To: [EMAIL PROTECTED] Subject: Probelm with global-exceptions routing. I have written my own RequestProcessor class (MyRequestProcessor.java) by extending the STRUTS provided RequesrProcessor class. I have overridden the processPreprocess() method as below. Also I have defined the java.lang.NullPointerException in the global-exceptions of struts-config.xml as shown below. But still I am getting java.lang.NullPointerException instead of being routed to the index.jsp. Is there anything that I am missing. Any clues please. public boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) { try { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION TRY ] - ); NullPointerException n = new NullPointerException(); throw n; } catch(Error e) { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION CATCH ] - ); } } Made the below entries in struts-config.xml global-exceptions exception key=message.example.simple path=/index.jsp type =java.lang.NullPointerException/ /global-exceptions controller processorClass=examples.MyRequestProcessor/ The stack trace that I am getting on the screen: java.lang.NullPointerException at examples.MyRequestProcessor.processPreprocess(MyRequestProcessor.java:36) at org.apache.struts.action.RequestProcessor.process(RequestProcessor .java:237) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:506) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapp erValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipel ine.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardConte xtValve.ja va:190 Regards Sreekant G - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Probelm with global-exceptions routing.
Dear Sreekant, When I programmed my RequestProcessor a about 2 weeks ago, I found processRoles() throws exceptions which are absolutely not catchable by any Exceptions listings in struts-config.xml. So, I wrote better Java code to catch things like null pointers. Or (pardon the thick sarcasm), you could try/catch it yourself in your method. The reference to my filter is: http://www.mail-archive.com/[EMAIL PROTECTED]/msg78455.html I did one typo, in step #3 i wrote 'scope=' when it should be 'roles=.'. I've never had one login-related exception (null pointer or otherwise) since the day I wrote the above RequestProcessor class, which I have in place and test under every day. The hard part for me was figuring out how to redirect to the page of my choice, which you'll find in my example code. Regards, David -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, September 05, 2003 5:47 AM To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: RE: Probelm with global-exceptions routing. Basically what I wanted to do in the processPreprocess() method of MyRequestProcessor class was Check if there were any User related credentials in the session, if yes let the process continute. If not then throw the Logon page. Is there any otherway I can achieve this so that the application developer doesn't have to take care of this in each and every Action class that he/she writes. Regards Sreekant G @ 98404-65630 Andrew Hill [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] idnode.com cc: Subject: RE: Probelm with global-exceptions routing. 09/05/2003 02:27 PM Please respond to Struts Users Mailing List Afaik, the global-exceptions only traps exceptions thrown up from your actions (not from the RP or the JSPs) (I could be wrong about this though!) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 5 September 2003 16:50 To: [EMAIL PROTECTED] Subject: Probelm with global-exceptions routing. I have written my own RequestProcessor class (MyRequestProcessor.java) by extending the STRUTS provided RequesrProcessor class. I have overridden the processPreprocess() method as below. Also I have defined the java.lang.NullPointerException in the global-exceptions of struts-config.xml as shown below. But still I am getting java.lang.NullPointerException instead of being routed to the index.jsp. Is there anything that I am missing. Any clues please. public boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) { try { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION TRY ] - ); NullPointerException n = new NullPointerException(); throw n; } catch(Error e) { System.out.println( --- [MY REQUEST PROCESSOR CLASS EXCEPTION CATCH ] - ); } } Made the below entries in struts-config.xml global-exceptions exception key=message.example.simple path=/index.jsp type =java.lang.NullPointerException/ /global-exceptions controller processorClass=examples.MyRequestProcessor/ The stack trace that I am getting on the screen: java.lang.NullPointerException at examples.MyRequestProcessor.processPreprocess(MyRequestProcessor.java:36) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:237) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:506) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190 Regards Sreekant G - To unsubscribe, e-mail