I replaced processForward by processForwardConfig but it doesn't work.
I don't know if the error is due to the configuration of the ForwardAction
or the processForwardConfig in the requestProcessor.
When I debug the application, the first time I call processForwardConfig
because path=/welcome and the second time path="\login" so I go to
the return true command line but is it the good return value ?
because after return true nothing happens.
index.jsp:
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<logic:redirect forward="welcome"/>
struts-config.xml:
<global-forwards>
<forward name="welcome" path="/welcome.do" />
<forward name="login" path="/login.do" />
</global-forwards>
<action-mappings>
<action path="/welcome"
type="org.apache.struts.actions.ForwardAction"
parameter="site.login.page"
scope="request"
validate="false"/>
<action path="/login"
name="LoginForm"
validate="true"
type="com.compagny.actions.LoginAction"
input="site.login.page"
scope="request">
<forward name="success" path="site.mainLayout" />
</action>
</action-mappings>
<controller processorClass="com.compagny.MyRequestProcessor"/>
MyRequestProcessor class:
protected boolean processPreprocess(HttpServletRequest request,
HttpServletResponse response)
{
// Get the session object
HttpSession session = request.getSession();
try{
// Test if the request is a login request
String path = processPath(request, response);
if ( !path.equals((String) "/login") )
{
// If not a login page, test if the user is authenticated on the
application server
User userInfo = (User)session.getAttribute(Constants.USER_KEY);
if ( userInfo == null ||
(userInfo != null && userInfo.getSessionId() == 0) )
{
processForwardConfig(request, response,
(ActionForward)appConfig.findForwardConfig("login"));
}
}
}
// if a servlet exception occurs
catch (ServletException ex)
{
}
//if an input/output error occurs
catch (IOException ex)
{
}
return true;
}
-----Original Message-----
From: Antoni Reus [mailto:[EMAIL PROTECTED]]
Sent: 14 October 2002 18:51
To: Struts Users Mailing List
Subject: Re: Tiles - Forward problem
Hi,
A Dilluns 14 Octubre 2002 16:44, Heligon Sandra va escriure:
> I only have to not cast the result of the findForwardConfig method ?
>
No, you have to change the call to processActionForward for
processForwardConfig. The TilesRequestProcessor overwrites
processForwardConfig to look for tiles definitions.
> Sandra
>
> -----Original Message-----
> From: Antoni Reus [mailto:[EMAIL PROTECTED]]
> Sent: 14 October 2002 16:39
> To: Struts Users Mailing List
> Subject: Re: Tiles - Forward problem
>
>
> Hi,
>
> A Dilluns 14 Octubre 2002 10:59, Heligon Sandra va escriure:
> > I have overridden the TilesREquestProcessor in order to test
> > if a user is authenticated for each request, but it doesn't work:
> >
> > protected boolean processPreprocess(HttpServletRequest request,
> > HttpServletResponse response)
> > {
> > // Get the session object
> > HttpSession session = request.getSession();
> >
> > try{
> >
> > // Test if the request is a login request
> > String path = processPath(request, response);
> > if ( !path.equals((String) "/login") )
> > {
> > // If not a login page, test if the user is authenticated on
> > the application server
> > User userInfo =
> > (User)session.getAttribute(Constants.USER_KEY);
> >
> > if ( userInfo == null ||
> > (userInfo != null && userInfo.getSessionId() == 0) )
> > {
>
> Change this:
> > processActionForward(request, response,
> >
> > (ActionForward)appConfig.findForwardConfig("login"));
>
> for this:
>
> processForwardConfig(request, response,
> appConfig.findForwardConfig("login"));
>
> > }
> > }
> > }
> > // if a servlet exception occurs
> > catch (ServletException ex)
> > {
> > }
> > //if an input/output error occurs
> > catch (IOException ex)
> > {
> > }
> > return true;
> > }
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>