//ActionMapping#findForward code
public ActionForward findForward(String forwardName) {
        ForwardConfig config = findForwardConfig(forwardName);

        if (config == null) {
            config = getModuleConfig().findForwardConfig(forwardName);
        }

        if (config == null) {
            if (log.isWarnEnabled()) {
                log.warn("Unable to find '" + forwardName + "' forward.");
            }
        }

        return ((ActionForward) config);
    }

//findForwardConfig defined in ActionConfig.java
public ForwardConfig findForwardConfig(String name) {
        return ((ForwardConfig) forwards.get(name));
    }

//where forwards is a HashMap defined in ActionConfig
/**
     * <p> The set of local forward configurations for this action, if any,
     * keyed by the <code>name</code> property. </p>
     */
    protected HashMap forwards = new HashMap();
//no stripping of localhost or sending back HTTP status code 302

/* alternative 2 */
//getModuleConfig() from ActionConfig
public ModuleConfig getModuleConfig() {
        return (this.moduleConfig);
    }

//which is referenced by impl class ActionConfig and routed to 
findForwardConfig implementor
    public ForwardConfig findForwardConfig(String name) {
        return ((ForwardConfig) forwards.get(name));
    }

//pulls the forwards entry keyed by name directly from HashMap defined here
protected HashMap forwards = new HashMap();

so the solution from your end is to supply a rel= parameter when you make the 
call

in Javascript:
window.location = http://localhost:8080 + response.data;
in java:
org.apache.struts.action.ActionForward validActionForward;
try {
 validActionForward = mapping.findForward("success");
}
catch(Exception e)
{
 boolean redirect=true; //if you have no session data
//boolean redirec=false; //if you have session data you want to preserve
 validActionForward= new 
org.apache.struts.action.ActionForward("http://localhost:8080/path/to/something.do";,
 boolean redirect);
}
return validActionForward;
my question to Tomcat expert is I need to replace an incorrect version jar 
which now exists in Tomcat-7.0.40 bootclasspath
How do i do that

?
Martin 
______________________________________________ 
                                                                                
                   


> Date: Fri, 26 Jun 2015 17:45:20 -0400
> From: ch...@christopherschultz.net
> To: user@struts.apache.org
> Subject: [s1] ActionForward redirect to localhost loses the hostname
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> All,
> 
> I'm running Struts 1.3.8 (yeah, I know), and I'm having an odd
> experience with certain actions.
> 
> I'll do something simple like:
> 
>   return mapping.findForward("success");
> 
> ... where the "success" forward is defined like this:
> 
>     <forward name="success"
>              path="/path/to/something.do"
>          redirect="true" />
> 
> This has been working fine ... basically forever. For some reason
> lately, when working on my own dev environment (localhost), I'll get a
> response from the server like this:
> 
> 302 Found
> ...
> Location: http://webapp/path/to/something.do
> 
> i.e. completely losing the "localhost" that used to be in there.
> 
> This does not happen on all pages. I can't seem to isolate anything
> that might be different about this redirect than any others.
> 
> Any clues as to what might be happening?
> 
> Thanks,
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> 
> iQIcBAEBCAAGBQJVjcfwAAoJEBzwKT+lPKRYaa0P/RUgp98IYrNGxKdyCO84buUT
> xAhY4XouuD8qpTxwWtw/nGxhNQB2dNFThYvveTlyGITyFbV0aDBjhoc4lOqdRi4S
> snZkAUbvcfwzexSKnW6U+dX1UIiSiM3s9W4ZByfYoPJyWDmN73/Lg4yXGu3lfmmc
> 3nkxJWEKGzmC1OTnfDbtrQGem8nITwa/Nrobbp8J1+0Nz1KgyQi1I7jM+/oi4fcq
> ISHX+8+P+GKZ8O0yVutnZ/+CJ6oisuaQdB1b9gOr1IVZt7zu059KyidMQQL1OVvi
> 67aHAuqJ+NyOSk3BzX8FZtxIX5EeDb8ULRT9pxMjRMad5JRdzcu/PN0oOichCSv5
> Nd3uHxwHdAadOLi/abq2YKWEPSQkWGBOmdNvqSqHJJK35PPRVCG7tLHqG+r9edHo
> dzTihYZAyT6Lisu03z6RSVyavlxwa5wVb4lbypROewX0TRcEaDc1jOgytRROf2WA
> pLzEz3CdytZU8S0Ra7QDrxOqREqt21OvKWssTsbRq0EAq9uf986MfXIgt0m+JT3o
> iSKisRj+bs4CNtI68ZKoCpLs7PmcPP/plWrEGCHVXnYzlIAiILDDYmy4W/M+SpS5
> NaZ0MGOfMmKiVVSAWXGbUl4VuqgwWmGoWGR+2oyYtcfbFsSHUL9uw5nEXyWQDxVy
> cDOWiZOhDODH7d01ybq5
> =OpHv
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
                                          

Reply via email to