T
tony vee
Hi
I think my understanding of the HttpURLConnection must be wrong, so could
someone please put me straight.
I have a url:
String address = http://localhost:8080/reminder/servlet/Welcome
Which I want to connect to using an HttpURLConnection object:
URL outDialler = new URL(address);
HttpURLConnection outDiallerConnection =
(HttpURLConnection)outDialler.openConnection();
outDiallerConnection.setRequestProperty("name", "tony");
outDiallerConnection.connect();
but when the Welcome servlet at the other end of this connection receives
it, the value of the "name" parameter is always null! It is not just that
the name parameter is null, no name parameter has been sent at all!
I have tried using addRequestProperty("name", "tony") instead, and setting
the requestMethod to GET/POST, but all have been to no avail.
When I add the name/value arguments to the URL, the servlet gets the value
from the "name" parameter fine:
http://localhost:8080/reminder/servlet/Welcome?name=tony
Could someone please explain how to use the API or the
setRequestProperty(String name, String value) to set the URL parameters
Thanks
Tony
Ht
I think my understanding of the HttpURLConnection must be wrong, so could
someone please put me straight.
I have a url:
String address = http://localhost:8080/reminder/servlet/Welcome
Which I want to connect to using an HttpURLConnection object:
URL outDialler = new URL(address);
HttpURLConnection outDiallerConnection =
(HttpURLConnection)outDialler.openConnection();
outDiallerConnection.setRequestProperty("name", "tony");
outDiallerConnection.connect();
but when the Welcome servlet at the other end of this connection receives
it, the value of the "name" parameter is always null! It is not just that
the name parameter is null, no name parameter has been sent at all!
I have tried using addRequestProperty("name", "tony") instead, and setting
the requestMethod to GET/POST, but all have been to no avail.
When I add the name/value arguments to the URL, the servlet gets the value
from the "name" parameter fine:
http://localhost:8080/reminder/servlet/Welcome?name=tony
Could someone please explain how to use the API or the
setRequestProperty(String name, String value) to set the URL parameters
Thanks
Tony
Ht