You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Br...@WellsFargo.COM on 2002/11/13 23:23:56 UTC

Dynamic redirect to external URL

Is there a way to create a dynamic redirect to an external URL.

Something like the way I expected this to work:

public class MyAction extends Action {
  ...

     ActionForward fwd = new ActionForward("http://www.yahoo.com", true);
     fwd.setContextRelative(false);
     return fwd;
	
  ...
}


The code in struts RequestProcessor ends up doing this:

        String uri = RequestUtils.forwardURL(request, forward);
        if (forward.getRedirect()) {
            response.sendRedirect
                (response.encodeRedirectURL(request.getContextPath() +
uri));
        } else {
            doForward(uri, request, response);
        }


So context relative does not seem to be checked, and the url ends up being

http://myserver:myport/myapp/http://www.yahoo.com

Is there a standard way to do this?

Or should I just call something like response.setRedirect().

Brendan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>