Sorry but I don't have any experience with mod_jk2.  Accd to the code,
the redirect will prepend the redirect url if the path starts with "/":

>From RequestProcessor.processForwardConfig():
        String forwardPath = forward.getPath();
        String uri = null;
        
        // paths not starting with / should be passed through without
any processing
        // (ie. they're absolute)
        if (forwardPath.startsWith("/")) {
            uri = RequestUtils.forwardURL(request, forward);    // get
module relative uri
        } else {
            uri = forwardPath;
        }
        
        if (forward.getRedirect()) {
            // only prepend context path for relative uri
            if (uri.startsWith("/")) {
                uri = request.getContextPath() + uri;
            }
            response.sendRedirect(response.encodeRedirectURL(uri));
            
        } else {
            doForward(uri, request, response);
        }

Maybe someone else can answer why it behaves that way for you.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 22, 2003 3:29 PM
To: [EMAIL PROTECTED]
Subject: RE: accessing static html from struts-config.xml


Ya i tried the same thing but see i have mod_jk2 as connector and my
webapp context is actually "usabo" but i am calling it as /japps/usabo
thro the connector, and when i attempt to access this forward, it give
the following error

japps/usabo/http:/www.mysite.com not found. No matter the forward
appends the context to this path.I had to add the contexts and their
paths in server.xml for the connector to work. Is that affecting it?

> or use
> <forward name="home" path="http://www.mysite.com"; redirect="true"/> 
> which would do the same thing.
>
>
> -----Original Message-----
> From: Turansky, Mark [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 22, 2003 1:46 PM
> To: Struts Users Mailing List
> Subject: RE: accessing static html from struts-config.xml
>
>
> I just tried (and failed) using a fully qualified URL as the 
> ActionForward.  The exception told me that my path did not start with 
> a /
>
> So.... here is an action that will use a redirect instead of an 
> ActionForward.  This works:
>
>
> /**
>  * a simple action to invalidate a session and return
>  * the user to the home page
>  */
> public class LogoffAction extends Action {
>
>     public ActionForward execute(ActionMapping mapping,
>                                  ActionForm form,
>                                  HttpServletRequest request,
>                                  HttpServletResponse response){
>
>               request.getSession().invalidate();
>             ActionForward foward = mapping.findForward("home");
>             String path = forward.getPath();
>             response.sendRedirect(path);
>             return null;
>     }
> }
>
>
>
> the corresponding struts-config entry....
>
> <global-forwards>
>       <forward name="home" path="http://www.mysite.com"; /> 
> </global-forwards>
>
>
> NOTE!!!!!
>
> when you retrieve this ActionForward through the ActionMapping object,

> it will FAIL if you try to return it from the execute() method.  It 
> fails because a fully qualified URL won't work in the ActionForward.
>
> You can use the Forward "home" to store the fully-qualified URL (and 
> retrieve it via forward.getPath()) or you can put that in some other 
> property section or config file.  Either way, you can use
> response.sendRedirect(str) to send the user to any website you wish, 
> including your own home page.
>
> I hope this helps.
>
> mark
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 22, 2003 2:28 PM
> To: [EMAIL PROTECTED]
> Subject: RE: accessing static html from struts-config.xml
>
>
> No the reference to the path in the <forward> section does not work. I

> am not sure how to use the response.redirect method. Do we put this 
> method in the execute method of the LogoffAction? or do we make a new 
> method called public void redirect(HttpServletRequest....){ 
> response.redirect("http://localhost/xyz.html";);
> }
>
>
>> I believe that you are not forced to use a relative URL.  You can put

>> "http://www.mysite.com/index.html"; as the Forward path and it should 
>> work just fine.
>>
>> If, for whatever reason, the Forward to an absolute URL does not 
>> work,
>
>> you can always use
>>
>> response.redirect(actionForward.getPath())
>>
>> in your Action while returning a null ActionForward
>>
>>
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, October 22, 2003 12:58 PM
>> To: [EMAIL PROTECTED]
>> Subject: accessing static html from struts-config.xml
>>
>>
>> Hi All
>> I am trying to do a logoff action.When the user logsoff he should be 
>> taken to the main website which is under 
>> /var/www/html/blah/index.shtml which is completely out of the tomcat 
>> and this is where i have stored the static content of the website. I 
>> do not understand how to write this forward in my struts-config.xml 
>> <forward name="xyzhome" path="../blah.shtml" /> does not do anything 
>> or can i specify a URI to access the resource.
>>
>> Thanx
>> --Mohan
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED] 
>> For
>
>> additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED] 
>> For
>
>> additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: [EMAIL PROTECTED] For

> additional commands, e-mail: [EMAIL PROTECTED]
>
>
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: [EMAIL PROTECTED] For

> additional commands, e-mail: [EMAIL PROTECTED]
>
>
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: [EMAIL PROTECTED] For

> additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to