tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Casper Wandahl Schmidt <kalle.pri...@gmail.com>
Subject Re: Pass an object from one Webapp to another on two differents servers
Date Thu, 30 Aug 2012 10:15:49 GMT
Hi Léa

Please see comments inline

Med venlig hilsen/Kind regards
Casper W. Schmidt

Den 30-08-2012 11:16, Léa Massiot skrev:
> Hello Casper,
>
> Thank you for your answer. What you are explaining totally makes sense.
>
> The "doPost()" method of "SERVLET_2" ("WEBAPP_2") ends up with a
> "sendRedirect()" method call
> which redirects to "j1.jsp", a JSP in the first webapp ("WEBAPP_1").
>
> Let's forget about sessions and passing whole objects from one webapp to
> another.
>
> What I rather need is pass at least one parameter from the servlet
> "SERVLET_2" to the JSP "j1.jsp".
> I could pass these parameters using the "GET" method, for example here with
> the parameter "result":
note: The list (Or my mail client?) has stripped the "graphic" but I 
checked it in the nabble thread version (for anyone interested go check 
it there too)...
If you want to display something user specific / session specific you 
need something else but result=ok, perhaps id=SOME-ID, where SOME-ID is 
some id on server2, then Server1/JSP1 can contact Server2 giving this id 
as a parameter, so that Server2 can give the correct result (ie. ok). If 
you simply want ok/fail in JSP1 then it should be okay to simply do what 
you do (as long as Server2 and JSP1 agrees on the possible results), 
just be aware that a user can fake that URL - simply put 
http://<IP_1>/<WEBAPP_1 name>/j1.jsp?result=ok in your browser and 
j1.jsp will handle the request the same way as redirects from Server2 
(so don't use Servlet_2 for anything "confidential" ie. login-checking). 
If you want to be able to do it securely (ie. for login-checking) you 
need the extra step I mentioned in my first post (Server1 contacts 
Server2 by itself to get the result of what happened over there simply 
giving some unique id that Server2 supplied in the redirect URL to the 
client).
>
> And retrieve this parameter in "j1.jsp" like this:
note: same as above...
>
> But I wish I could pass that parameter using the "POST" method...
> but as far as I've read, it looks like it's not possible...
No it is not possible, what you do is simply sending an URL to the 
client, asking it to make a request to that URL next/instead so POST is 
not an option here (admitted, my http 1.1 spec knowledge is rusty and 
flawed, but I'm quite sure on this).
>
> Best regards.
>
>
>
> --
> View this message in context: http://tomcat.10.n6.nabble.com/Pass-an-object-from-one-Webapp-to-another-on-two-differents-servers-tp4985870p4986038.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message