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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






This mail was scanned by Interscan Virus Wall of Mailserver2 at SNR, TCS, Chennai

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to