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)

             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 message and any attachment(s) is intended only for the use of the addressee(s) 
and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the 
intended addressee(s), you are hereby notified that any use, distribution, disclosure 
or copying of this communication is strictly prohibited. If you have received this 
communication in error, please erase all copies of the message and its attachment(s) 
and notify the sender or Kanbay postmaster immediately.

Any views expressed in this message are those of the individual sender and not of 
Kanbay.

Although we have taken steps to ensure that this e-mail and any attachment(s) are free 
from any virus, we advise that in keeping with good computing practice the recipient 
should ensure they are actually virus free.


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

Reply via email to