Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action forward to different box

 
Ed Thompson
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this question has been asked in similar formats elsewhere, but please be patient.

I have an action under SDtruts 1.1 at www.mydomain.com/appname/WSOD.do. The action mapping for this route url is:

<action path="/WSOD" forward="/1wsdweb/validate.aspx"></action>

1wsdweb is a different web app on a different box in the same domain. The above mapping does not work. Any guidance?

I want to forward, not redirect, as I want the cookies in the session to be included in the forward.

I keep going around in circles...
[ August 03, 2007: Message edited by: Ed Thompson ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ed Thompson:
I want to forward, not redirect, as I want the cookies in the session to be included in the forward.

Sorry, Ed, what you're trying to do is simply not possible. You can redirect to another web application, but you cannot forward to it, even if it's on the same server. This is just one of the rules of Java EE Web Applications. If you want a Struts forward to redirect, that's pretty easy to set up. Here's an example:

I'm not sure what you're saying, though, about the cooikes. Cookies reside on the browser, not the server, and as long as the new server is in the same domain as the old server, the cookies will get picked up. However, there's no way the second application can share the same HTTPSession object as the first. If you have data you want to pass to the second application, I'd suggest passing it in query string parameters (e.g. ?parm1=foo&parm2=bar etc.).
[ August 03, 2007: Message edited by: Merrill Higginson ]
 
Ed Thompson
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merrill.

Forget what I said about cookies, your right. I've just been spinning here trying to get this to work.

Correct me if I am wrong, but if I go with a redirect, the request makes another trip back to the browser before moving on? That is the trip I am trying to avoid.

Also, can I specify the redirect in the <action> tag? I don't want (need) to go to an Action class first for this one.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ed Thompson:
Correct me if I am wrong, but if I go with a redirect, the request makes another trip back to the browser before moving on? That is the trip I am trying to avoid.

You're right about the fact that a redirect makes another trip back to the browser. The only way to avoid the extra round trip to the browser is to call the URL directly from the action attribute of a <form> tag or link directly to it in a hyperlink <a> stanza.
Originally posted by Ed Thompson:

Also, can I specify the redirect in the <action> tag? I don't want (need) to go to an Action class first for this one.

No, there's no way to put the redirect in an action tag. If you want to use it in a form, don't use an <html:form> tag, but a regular <form> tag with the URL you want specifried as the action attribute.
[ August 03, 2007: Message edited by: Merrill Higginson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic