You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Heligon Sandra <sa...@nextream.fr> on 2002/10/14 10:59:53 UTC
Tiles - Forward problem
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) )
{
processActionForward(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;
}
With the following login forward:
<forward name="login" path="/login.do" />
<action path="/login"
name="LoginForm"
validate="true"
type="com.Actions.LoginAction"
input="site.login.page"
scope="request">
<forward name="success" path="site.mainLayout" />
</action>
The following error is displayed:
java.lang.IllegalArgumentException: Path does not start with a "/"
character
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Tiles - Forward problem
Posted by Antoni Reus <an...@wanadoo.es>.
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>