×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

forward request to struts action on other server

forward request to struts action on other server

forward request to struts action on other server

(OP)
Hi all,

I have two servers, each running the sun appliction server (9.0). I've build a webapplication, and know I want to forward requests from the first to the second application server.

In my LoginAction on the first server I put this in the code:

return new ActionForward("http://" + server.getUrl() + ":8080/project/Login.do", false);

put that gives me the error:
java.lang.IllegalArgumentException: Path http://192.168.1.135:8080/project/Login.do does not start with a "/" character

I don't know what I do wrong, does anybody know a way to do this?

It need to be forwarded, so that the action on the other server can access the parameters in the form.

Thanks a lot!

Bram

RE: forward request to struts action on other server

Hi

Forwarding is passing forward the data to another class for further processing. You can not forward outside the server. You can only redirect.

CODE

return new ActionForward("http://" + server.getUrl() + ":8080/project/Login.do", true);
Note that you can not pass the ActionForm and other information that way.

Feherke.
http://rootshell.be/~feherke/

RE: forward request to struts action on other server

(OP)
and is there any other solution to pass the parameters?

RE: forward request to struts action on other server

Hi

Quote (Bram):

and is there any other solution to pass the parameters?
Just the methods provided by the HTTP protocol. So you can pass them as GET parameters or POST them.

Feherke.
http://rootshell.be/~feherke/

RE: forward request to struts action on other server

(OP)
Hi,

Thank you for your reply.
I was wondering if you could give me an example or something. Because I can't get it to work like I want. I can make a connection to the other server and post the parameters to it, that's not a problem, but struts needs a mapping return, what do I need to return for server one, so the browser shows the results of the action processed by server 2?

Thanks,
Bram

RE: forward request to struts action on other server

Hi

Quote (bramsomers):

what do I need to return for server one, so the browser shows the results of the action processed by server 2
As I understand it now, HttpClient would be helpful for you.

If not, please give us more details of what you want to do.

Feherke.
http://rootshell.be/~feherke/

RE: forward request to struts action on other server

(OP)
Hi,

I will explain my problem again, with a few more details.
I have the following code now:

CODE

ActionRedirect redirect = new ActionRedirect();
redirect.addParameter("title", newArticleActionForm.getTitle());
                redirect.addParameter("date", newArticleActionForm.getDate());
                redirect.addParameter("author", newArticleActionForm.getAuthor());
                redirect.addParameter("keywords", newArticleActionForm.getKeywords());
                redirect.addParameter("text", newArticleActionForm.getText());
                redirect.setPath("http://" + server.getUrl() + ":8080/ElectronicNewsPaper-war/NewArticle.do");
                redirect.setRedirect(true);
                //invalidate session on forwarding server
                session.invalidate();
                return redirect;
as you can see, the parameters are passed by GET, now I've searched for a solution like this for struts, but... I want the parameters be passed by POST...

Bram

RE: forward request to struts action on other server

Hi

Redirecting is only GET. Is just a new URL sent back to the browser, where it should step forward.

Feherke.
http://rootshell.be/~feherke/

RE: forward request to struts action on other server

(OP)
Hi,

Yeah, I know, but... I'm searching for a forward solution for struts...

Thanks,
Bram

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close