You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Antonio Ortega <ao...@fihoca.com> on 2001/06/27 11:30:43 UTC

How to use RunData.setRedirectUri

    Hi! I'm working on a webapp under Turbine,
in a certain moment it interests me to redirect 
the page to another webapp INSIDE an action.
How can I do it? I tried to use setRedirectUri
method from RunData, but it seems to do nothing.

This is what I have:

http://localhost:8080/X/servlet/X/action/ChangeWebApp

In "ChangeWebApp" action :

        data.setRedirectURI(http://localhost:8080/Y/index.html);

but the code sended to the browser results:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>

What can I do? Waht I'm doing wrong?
Are there more alternatives to do the same from an action?

Thanks!
_________________
      Toni Ortega
aortega@fihoca.com
_________________

Re: How to use RunData.setRedirectUri

Posted by James Devenish <j-...@users.sourceforge.net>.
On Wed, Jun 27, 2001 at 11:30:43AM +0200, Antonio Ortega wrote:
> In "ChangeWebApp" action :
> 
>         data.setRedirectURI(http://localhost:8080/Y/index.html);

The JavaDoc for Turbine 2.1b4 says, of setRedirectURI:

"Sets the redirect uri. If this is set, also make sure to set the status
code to 302."

You need to call data.setStatusCode( 302 ) to set the correct HTTP
status code for web browsers to make use of the redirect information.


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


RE: How to use RunData.setRedirectUri

Posted by Keng Wong <ke...@verizon.net>.
Are there any differences between this and the doRedirect() method ?
I think the setScreenTemplate() may not be able to parse any context when
used in a screen. However, it will work when called from an action.
I had this problem when I was setting this up in the SecureScreen.java
example from the tdk install. I had to stuff some data into the context and
for this I build a Login.java screen that gets called when the Login.vm
template is retrieved. Using a doRedirect() works (context gets parsed) but
not a setScreenTemplate().
Can someone enlighten this ? Thanks a lot.

-keng wong

> -----Original Message-----
> From: Jason van Zyl [mailto:jvanzyl@apache.org]
> Sent: Wednesday, June 27, 2001 5:48 AM
> To: turbine-user@jakarta.apache.org
> Subject: Re: How to use RunData.setRedirectUri
>
>
> On 6/27/01 5:30 AM, "Antonio Ortega" <ao...@fihoca.com> wrote:
>
> >
> >   Hi! I'm working on a webapp under Turbine,
> > in a certain moment it interests me to redirect
> > the page to another webapp INSIDE an action.
> > How can I do it? I tried to use setRedirectUri
> > method from RunData, but it seems to do nothing.
> >
> > This is what I have:
> >
> > http://localhost:8080/X/servlet/X/action/ChangeWebApp
> >
> > In "ChangeWebApp" action :
> >
> >       data.setRedirectURI(http://localhost:8080/Y/index.html);
> >
> > but the code sended to the browser results:
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > <HTML><HEAD>
> > <META http-equiv=Content-Type content="text/html;
> > charset=windows-1252"></HEAD>
> > <BODY></BODY></HTML>
> >
> > What can I do? Waht I'm doing wrong?
> > Are there more alternatives to do the same from an action?
>
> From within an action if you want to change the screen that a user
> sees than use something like this:
>
>  RunData.setScreenTemplate("newTemplate.vm")


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


Re: How to use RunData.setRedirectUri

Posted by Jason van Zyl <jv...@apache.org>.
On 6/27/01 5:30 AM, "Antonio Ortega" <ao...@fihoca.com> wrote:

> 
>   Hi! I'm working on a webapp under Turbine,
> in a certain moment it interests me to redirect
> the page to another webapp INSIDE an action.
> How can I do it? I tried to use setRedirectUri
> method from RunData, but it seems to do nothing.
> 
> This is what I have:
> 
> http://localhost:8080/X/servlet/X/action/ChangeWebApp
> 
> In "ChangeWebApp" action :
> 
>       data.setRedirectURI(http://localhost:8080/Y/index.html);
> 
> but the code sended to the browser results:
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html;
> charset=windows-1252"></HEAD>
> <BODY></BODY></HTML>
> 
> What can I do? Waht I'm doing wrong?
> Are there more alternatives to do the same from an action?

>From within an action if you want to change the screen that a user
sees than use something like this:

 RunData.setScreenTemplate("newTemplate.vm")

> 
> Thanks!
> _________________
>     Toni Ortega
> aortega@fihoca.com
> _________________
> 

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



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