The method processActionPerform indeed seems to solve my problem. 
I had read in the book of Chuck which one could overload processPreprocess
to make of the authentification. That's why I used the processPreprocess
method.
Are there limits or disavanatges to use processActionPerfomr rather than
processPreprocess? 

-----Original Message-----
From: Larry Zappeterrini [mailto:[EMAIL PROTECTED]]
Sent: 06 February 2003 21:10
To: 'Struts Users Mailing List'
Subject: RE: RequestProcessor with test conditions


I did a similar thing for a project that I am working on. Instead of 
overriding processPreprocess, I overrode processActionPerform. This 
method actually processes the Action and has access to the ActionMapping 
that is being invoked. You can basically do many of the things that you 
could do within your Action in this method. You can perform any special 
processing in the overridden method, and utilize super.processActionPerform 
to operate as usual. So in the overridden method, we check to see if 
the resource that the user is requesting requires authentiaction. If it 
does not, super.processActionPerform is returned. Otherwise, check to 
see if the user is logged in. If they are, return super.processActionPerform

otherwise forward them to the authentication form.

Larry

-----Original Message-----
From: Heligon Sandra [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 11:21 AM
To: '[EMAIL PROTECTED]'
Subject: RequestProcessor with test conditions
Importance: High



        I have defined a subClass of TilesRequestProcessor in order to  
        test before each request if the user is authenticated.

        Here is my code

        public boolean processPreprocess(HttpServletRequest request,
HttpServletResponse response) 
         {
            // Get the session object
            HttpSession session = request.getSession();

            // Test if the request is a login request
            String path = processPath(request, response);

            if ( !path.equals((String) "/login") )
            {
                        User user =
(User)session.getAttribute(Constants.s_USER_KEY);

                if ( user != null )
                {
                // the user is not authenticated
                processForwardConfig(request, response,
moduleConfig.findForwardConfig("login"));
                    return false;
                }
                return true;
            }
        }

        When the user is not authenticated i would like to display error on
the current page and not systematically 
        forward it to the login page, how is it possible ?

        I can not use _mapping.getInput() function and ActionErrors object
like in the Action class.

        What can I do ?

        Thanks
        Sandra
        

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


*************************************************************************** 
This electronic mail transmission contains confidential and/or privileged 
information intended only for the person(s) named.  Any use, distribution, 
copying or disclosure by another person is strictly prohibited. 
*************************************************************************** 



---------------------------------------------------------------------
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]

Reply via email to