You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alfredo Manuel Osorio Martinez <al...@afirme.com> on 2011/03/17 19:48:36 UTC

Redirect and pass as a parameter the original url from an Interceptor

I am implementing a Login interceptor which needs to redirect to an
action to first authenticate the user. The problem is that I want to
send as a parameter to that action the original url, the one that the
user was trying to get before the redirect to the login page.

 

How can I achieve that?

 

Thanks in advance,

 

Alfredo Osorio


RE: Redirect and pass as a parameter the original url from an Interceptor

Posted by Alfredo Manuel Osorio Martinez <al...@afirme.com>.
Thanks all for your answers, I solved it by calling request.getRequestURL() and setting a request attribute with the original url. The redirect gets that attribute and includes it in the querystring. 

<global-results>
			<result name="registrarAgente" type="redirect">
				/agente/RegistrarAgenteAction_input.action?urlOriginal=${#request.urlOriginal}
			</result>
</global-results>

I will also check the Spring Security.

Alfredo Osorio

-----Mensaje original-----
De: Roger Varley [mailto:roger.varley@googlemail.com] 
Enviado el: Thursday, March 17, 2011 4:48 PM
Para: Struts Users Mailing List
Asunto: Re: Redirect and pass as a parameter the original url from an Interceptor

On Thu, 2011-03-17 at 12:48 -0600, Alfredo Manuel Osorio Martinez wrote:
> I am implementing a Login interceptor which needs to redirect to an
> action to first authenticate the user. The problem is that I want to
> send as a parameter to that action the original url, the one that the
> user was trying to get before the redirect to the login page.

This is not a direct answer to your question, but I would suggest that
rather than re-inventing the wheel, you take a look at integrating
Spring Security, what you're looking for is implemented "out of the box"
with a bit of configuration.

Regards



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


Re: Redirect and pass as a parameter the original url from an Interceptor

Posted by Roger Varley <ro...@googlemail.com>.
On Thu, 2011-03-17 at 12:48 -0600, Alfredo Manuel Osorio Martinez wrote:
> I am implementing a Login interceptor which needs to redirect to an
> action to first authenticate the user. The problem is that I want to
> send as a parameter to that action the original url, the one that the
> user was trying to get before the redirect to the login page.

This is not a direct answer to your question, but I would suggest that
rather than re-inventing the wheel, you take a look at integrating
Spring Security, what you're looking for is implemented "out of the box"
with a bit of configuration.

Regards



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


Re: Redirect and pass as a parameter the original url from an Interceptor

Posted by Muneer Malik <tu...@gmail.com>.
I guess not even pass as a query string,

he needs to pick up the URL from the request object:

request.getRequestURL()

Best,

On Thu, Mar 17, 2011 at 3:33 PM, Okan Özeren <ok...@gmail.com> wrote:

> Hi,
>
> I mean, you want to get a parameter as passed with original url by
> query string. Am I right? You sould use this implementation:
>
> // Get the action context from the invocation so we can access the
> // HttpServletRequest and HttpServletResponse objects.
> final ActionContext context = invocation.getInvocationContext();
> HttpServletRequest request = (HttpServletRequest)
> context.get(StrutsStatics.HTTP_REQUEST);
> String param = request.getParameter("param");
>
> Okan Özeren.
>
> On Thu, Mar 17, 2011 at 8:48 PM, Alfredo Manuel Osorio Martinez
> <al...@afirme.com> wrote:
> > I am implementing a Login interceptor which needs to redirect to an
> > action to first authenticate the user. The problem is that I want to
> > send as a parameter to that action the original url, the one that the
> > user was trying to get before the redirect to the login page.
> >
> >
> >
> > How can I achieve that?
> >
> >
> >
> > Thanks in advance,
> >
> >
> >
> > Alfredo Osorio
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Confidentiality Notice
-------------------------------


THIS INFORMATION IS INTENDED ONLY FOR THE USE OF THE ADDRESSEE AND MAY
CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM
DISCLOSURE UNDER APPLICABLE LAW.  IF YOU ARE NOT THE INTENDED RECIPIENT, OR
THE EMPLOYEE OR AGENT RESPONSIBLE FOR DELIVERING THIS MESSAGE TO THE
INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION,
DISTRIBUTION OR COPYING OF THE COMMUNICATION IS STRICTLY PROHIBITED.  IF YOU
HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE NOTIFY IMMEDIATELY AT
tutti786@gmail.com OR BY TELEPHONE AT 817-458-1764.


THANK YOU.

Re: Redirect and pass as a parameter the original url from an Interceptor

Posted by Okan Özeren <ok...@gmail.com>.
Hi,

I mean, you want to get a parameter as passed with original url by
query string. Am I right? You sould use this implementation:

// Get the action context from the invocation so we can access the
// HttpServletRequest and HttpServletResponse objects.
final ActionContext context = invocation.getInvocationContext();
HttpServletRequest request = (HttpServletRequest)
context.get(StrutsStatics.HTTP_REQUEST);
String param = request.getParameter("param");

Okan Özeren.

On Thu, Mar 17, 2011 at 8:48 PM, Alfredo Manuel Osorio Martinez
<al...@afirme.com> wrote:
> I am implementing a Login interceptor which needs to redirect to an
> action to first authenticate the user. The problem is that I want to
> send as a parameter to that action the original url, the one that the
> user was trying to get before the redirect to the login page.
>
>
>
> How can I achieve that?
>
>
>
> Thanks in advance,
>
>
>
> Alfredo Osorio
>
>

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


Re: Redirect and pass as a parameter the original url from an Interceptor

Posted by Muneer Malik <tu...@gmail.com>.
can you not pass params within your interceptor?

<interceptor-ref name="checkTabsStack">
 <param name="tabName">availability</param>
</interceptor-ref>


Best,


On Thu, Mar 17, 2011 at 1:48 PM, Alfredo Manuel Osorio Martinez <
alfredo.osorio@afirme.com> wrote:

> I am implementing a Login interceptor which needs to redirect to an
> action to first authenticate the user. The problem is that I want to
> send as a parameter to that action the original url, the one that the
> user was trying to get before the redirect to the login page.
>
>
>
> How can I achieve that?
>
>
>
> Thanks in advance,
>
>
>
> Alfredo Osorio
>
>


-- 
Confidentiality Notice
-------------------------------


THIS INFORMATION IS INTENDED ONLY FOR THE USE OF THE ADDRESSEE AND MAY
CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM
DISCLOSURE UNDER APPLICABLE LAW.  IF YOU ARE NOT THE INTENDED RECIPIENT, OR
THE EMPLOYEE OR AGENT RESPONSIBLE FOR DELIVERING THIS MESSAGE TO THE
INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION,
DISTRIBUTION OR COPYING OF THE COMMUNICATION IS STRICTLY PROHIBITED.  IF YOU
HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE NOTIFY IMMEDIATELY AT
tutti786@gmail.com OR BY TELEPHONE AT 817-458-1764.


THANK YOU.