You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by JOSE L MARTINEZ-AVIAL <jl...@gmail.com> on 2011/08/26 22:57:45 UTC

Struts2 dispatch request to another application

Hello all,
  I'm using Struts 2.1.8.1. I have a requirement to embed some pages from
another server on my own app, so the users will access to them through my
application, without accessing directly the other server. My idea is to have
a package definition for that, so any access to that package would be
redirected to the internal server.

    <package name="eco-marketing" namespace="/marketing"
extends="eco-default">
        <action name="*">
            <result name="success" type="dispatcher">
                  <param name="location">http://myotherserver:8080/test/{1}
</param>
            </result>
        </action>
    </package>

But it does not work, I got a Error 404--Not Found, so I suppouse is not as
easy as it sounds. Any ideas on how to do this?

TIA

Re: Struts2 dispatch request to another application

Posted by Chris Pratt <th...@gmail.com>.
You'll probably have to write an action that retrieves the content and makes
it available to a Stream Result (
http://struts.apache.org/2.0.14/docs/stream-result.html).
  (*Chris*)

On Fri, Aug 26, 2011 at 1:57 PM, JOSE L MARTINEZ-AVIAL <jl...@gmail.com>wrote:

> Hello all,
>  I'm using Struts 2.1.8.1. I have a requirement to embed some pages from
> another server on my own app, so the users will access to them through my
> application, without accessing directly the other server. My idea is to
> have
> a package definition for that, so any access to that package would be
> redirected to the internal server.
>
>    <package name="eco-marketing" namespace="/marketing"
> extends="eco-default">
>        <action name="*">
>            <result name="success" type="dispatcher">
>                  <param name="location">http://myotherserver:8080/test/{1}
> </param>
>            </result>
>        </action>
>    </package>
>
> But it does not work, I got a Error 404--Not Found, so I suppouse is not as
> easy as it sounds. Any ideas on how to do this?
>
> TIA
>

Re: Struts2 dispatch request to another application

Posted by Maurizio Cucchiara <mc...@apache.org>.
You could try to change from dispatcher to redirect type, I'm not sure
it will work. Also, I'm not sure how it fits with your requirements
(the address will be visible in the address bar).
Maurizio Cucchiara



On 26 August 2011 22:57, JOSE L MARTINEZ-AVIAL <jl...@gmail.com> wrote:
> dispatcher

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