Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing parameters to url using java.net package

 
kranthi chamarthi
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have two applications deployed on my server and i need to invoke a register.do class in one application from another application and need to send parameters like username,password,fullname,email,locale,country using post method. I know that using the URL class i can open the connection and open the required url....but how can i pass the parameters to it using post method??? Please advice me.
Thanks
Kranthi
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out example e135 at http://www.exampledepot.com/egs/java.net/pkg.html It shows how to use POST programmatically in Java code, including how to send parameters.
 
kranthi chamarthi
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that link . But still my code is nto working. Following is my code.

I have kept a print statement in multiply_method() of the action class to which arithmeticAction.do points and it is not getting printed.
 
kranthi chamarthi
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I included the code for obtaining the input stream and reading the data from the url and then the program started working. Why is this???Following is the code

This code is working only if the code that is italicized is present.

[ November 10, 2008: Message edited by: kranthi kumar.chamarthi ]
[ November 10, 2008: Message edited by: kranthi kumar.chamarthi ]
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTTP protocol has two parts: a request and a response. If you don't try to read the response, the server may think you've dropped the connection and stop processing the request.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic