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
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
Forwarding is passing forward the data to another class for further processing. You can not forward outside the server. You can only redirect.
CODE
Feherke.
http://rootshell.be/~feherke/
RE: forward request to struts action on other server
RE: forward request to struts action on other server
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
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
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
I will explain my problem again, with a few more details.
I have the following code now:
CODE
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;
Bram
RE: forward request to struts action on other server
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
Yeah, I know, but... I'm searching for a forward solution for struts...
Thanks,
Bram