Forums Register Login

POST method

+Pie Number of slices to send: Send
Hi,
I have three web applications deployed on the same Tomcat named
WebappParent, WebappClild1, WebappChild2.

Here WebappParent will get the username & password validates that and based upon the previlege it will call a particular servlet in WebappChild1 (or) WebappChild2 using URLConnection and "POST" method

But here i want to know how to pass the request object which i had received from the browser to WebappParent and from there to either of the child application.

I tried this using "GET" method and passing parameters along with the URL and it worked perfectly.

Thanks in advance
+Pie Number of slices to send: Send
Thought this would not be a clean approach , but I do not see any other solution to this.

You can create a web application common repository and put that in shared/lib folder so that it can be shared across web application.
You can have the respository as singleton and should work like map interface(key:value).Now store the object in the respository in one application and send the key of that to the other application.
+Pie Number of slices to send: Send
thanks rahul for the reply, but is not there a way as simple as "GET" method.
+Pie Number of slices to send: Send
I do not think.
+Pie Number of slices to send: Send
The request, session, and context objects are bound to the webapplication in which they were created.
Why did you break your application in to multiple webapps if the different components need to interact with one another?
+Pie Number of slices to send: Send
Hi Ben Souther, What you asked is correct (i.e why you break webapplication??)
i know how to achive that with a single application but that's not my requirement.

What i think was if we have a way to request for a particular resource in a web application using URLConnection then there should be a way to pass request parameters & attributes too.
+Pie Number of slices to send: Send
POST isn't more complex. When you opened URL connection just obtain output stream and write parameter pairs '&' separated. You may need to URL encode them though. If you need to convert GET to POST you can just write query string directly.
+Pie Number of slices to send: Send
 

Originally posted by D Rog:
POST isn't more complex. When you opened URL connection just obtain output stream and write parameter pairs '&' separated. You may need to URL encode them though. If you need to convert GET to POST you can just write query string directly.



Raj Kumar is talking about passing object , rather the request object.
+Pie Number of slices to send: Send
I think i should be much specific,

From the browser to WebappParent i received two values username & password as a "POST" method which after validation i just need to pass over to either WebappChild1 (or) WebappChild2.

With Pass over means the WebappChild which receives the call for request should do the processing as if it had received that from a browser (i.e. it should use request.getParameter("username")) to get the values.
+Pie Number of slices to send: Send
While making the request to the second web application , append the parameters as key value pairs seperated by ampersand.At the other end you can well use request.getParameter("key") for getting back the values.

remember URL?key=value&key1=value1
+Pie Number of slices to send: Send
Yes Rahul that's what i'am doing now but what happens is some time it throws

exception caughtjava.io.IOException: Server returned HTTP response code: 505

even after using URLEncoder i'am facing this problem ...
+Pie Number of slices to send: Send
Thanks Rahul & others, i had fixed the problem the 505 error is because i had not encoded the URL once when i did that the problem is solved.

Thanks a lot for all you time...
Do not threaten THIS beaver! Not even with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 762 times.
Similar Threads
Send file to applet from PHP
refresh in post method
call a html/jsp page from an applet and pass parameters in post method
Error 405
Retrieving a drop-down list value.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 21:59:25.