You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by al...@t-online.de on 2005/08/04 15:00:46 UTC

Logon redirect - Construct ActionForward on the fly ?

Hi all,

I have overridden the RequestsProcessor#processRoles() to check whether a
user has sufficient Role to access an Action(an therefore a page). If he/she
hasn't, it is easy. I dump the request URI to the session and redirect to a
global forward (logon). That's all not so difficult..as the logon is a
statically existing mapping..

The logon has a forward linking to the member's homepage and after the users
logged in successfully, that's where they get forwarded to..

I would like to forward them to the stored URI (from the session), if they
tried to access a specific location in the members area rather then logging
in proactively. Any hints where to look to get enlightened?

Rgds
Aleiprecht

PS: To all native English speakers . sorry . I'm German .all language
mistakes exclusively C by myself ;)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Logon redirect - Construct ActionForward on the fly ?

Posted by Gareth Evans <ga...@msoft.co.uk>.
In your login jsp

<logic:present name="mySavedUrl" scope="session">
	<html:hidden property="url" value="<%= session.getAttribute("mySavedUrl") %>" />
</logic:present>

In your login action...

String redirect = form.get("url");  // providing your using a dyna type action form
if ( redirect != null ) {
	return new RedirectingActionForward( redirect );
}
return mapping.findForward("success");


Something like that should work

aleiprecht@t-online.de wrote:

> Hi all,
> 
> I have overridden the RequestsProcessor#processRoles() to check whether a
> user has sufficient Role to access an Action(an therefore a page). If he/she
> hasn't, it is easy. I dump the request URI to the session and redirect to a
> global forward (logon). That's all not so difficult..as the logon is a
> statically existing mapping..
> 
> The logon has a forward linking to the member's homepage and after the users
> logged in successfully, that's where they get forwarded to..
> 
> I would like to forward them to the stored URI (from the session), if they
> tried to access a specific location in the members area rather then logging
> in proactively. Any hints where to look to get enlightened?
> 
> Rgds
> Aleiprecht
> 
> PS: To all native English speakers . sorry . I'm German .all language
> mistakes exclusively C by myself ;)
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

-- 
Gareth Evans

MSoft eSolutions Limited
Technology Centre
Inward Way
Rossmore Business Park
Ellesmere Port
Cheshire
CH65 3EN

-- 
Tel:    +44 (0)870 0100 704
Fax:    +44 (0)870 9010 705
E-Mail: gareth@msoft.co.uk
Web:    www.msoft.co.uk

----------------------------------------------
Terms:
Please note that any prices quoted within this e-mail are subject to VAT.
All program details and code described in this e-mail are subject to
copyright © of MSoft eSolutions Limited and remain the intellectual
property of MSoft eSolutions Limited.
Any proposal or pricing information contained within this e-mail are
subject to MSoft eSolutions' Terms and Conditions
----------------------------------------------
Disclaimer:
This message is intended only for use of the addressee. If this message
was sent to you in error, please notify the sender and delete this
message. MSoft eSolutions Limited cannot accept responsibility for viruses,
so please scan attachments. Views expressed in this message do not
necessarily reflect those of MSoft eSolutions Limited who will not
necessarily be bound by its contents.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Logon redirect - Construct ActionForward on the fly ?

Posted by al...@t-online.de.
Please disregard ...
The solution was right in front of my eyes ;)

At the end of the logon action

if (getSessionAttribute("AFTERLOGON_DEST") != null) {
	String tmpString = "" + getSessionAttribute ("AFTERLOGON_DEST");
      removeSessionAttribute("AFTERLOGON_DEST");
      return  (ActionForward) new RedirectingActionForward(tmpString); 
} else {
	return (mapping.findForward("logonsuccess"));
}

The calls

getSessionAttribute(String key)
removeSessionAttribute(String key)

are just shortened for readability sake

rgds
albi

-----Original Message-----
From: aleiprecht@t-online.de [mailto:aleiprecht@t-online.de] 
Sent: Thursday, August 04, 2005 3:01 PM
To: user@struts.apache.org
Subject: Logon redirect - Construct ActionForward on the fly ?

Hi all,

I have overridden the RequestsProcessor#processRoles() to check whether a
user has sufficient Role to access an Action(an therefore a page). If he/she
hasn't, it is easy. I dump the request URI to the session and redirect to a
global forward (logon). That's all not so difficult..as the logon is a
statically existing mapping..

The logon has a forward linking to the member's homepage and after the users
logged in successfully, that's where they get forwarded to..

I would like to forward them to the stored URI (from the session), if they
tried to access a specific location in the members area rather then logging
in proactively. Any hints where to look to get enlightened?

Rgds
Aleiprecht

PS: To all native English speakers . sorry . I'm German .all language
mistakes exclusively C by myself ;)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org