I want to know if it is possible to send PUT, DELETE request (practically) through java.net.HttpURLConnection to HTTP-based URL. I have read so many articles describing that how to send GET, ... |
i am making http connection using
URL urlToConnect = new URL ("http://www.xyz.com");
HttpURLConnection connection = ( HttpURLConnection ) urlToConnect.openConnection();
I need to set the following property ,i am doing it like
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setRequestProperty("user-agent", USER_AGENT);
connection.setRequestProperty("Content-Type", ...
|
I would lake to generate POST request to a server which requires authentication. I tried to use the following method:
private synchronized String CreateNewProductPOST (String urlString, String encodedString, String title, String content, ...
|
How can I do several request in one HttpURLConnection with Java?
URL url = new URL("http://my.com");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
HttpURLConnection.setFollowRedirects( true );
connection.setDoOutput( true );
connection.setRequestMethod("GET");
PrintStream ps = ...
|
This subject is pretty often asked here and the Sun Oracle tutorial is too concise about the subject. So I thought, let's post a CW question and answer about ... |
I am trying to log into a reports system using java. So far, I have tried MANY different implementations that have used HttpURLConnection. The HTML I am trying to post to ... |
Hey guys,
I want to make some API calls to a server and Im using HttpURLConnection to do so. But the request are not successfull but return
<error>
<http_status>400 Bad Request</http_status>
...
|
|
Setting properties of a connection do not carry forward to redirected connections
HttpURLConnection mConnection = (HttpURLConnection) url.openConnection();
mConnection = addRequestProperty("User-Agent", "Mozilla");
InputStream stream = mConnection.getInputStream();
if there is a 302 code, mConnection is redirected, but ... |
I need to send a POST request to a URL and send some request parameters. I am using HttpURLConnectionAPI for this. But my problem is I do not get any request ... |
try {
//Create connection
...
|
I am trying to do a GET request with some parameters in Java using HttpURLConnection. Everytime I do this however, I get a 400: Bad Request each time.
What do I need ... |
I am trying to fetch an image from an IP camera using HTTP. The camera requires HTTP basic authentication, so I have to add the corresponding request header:
URL url = new ...
|
I'm trying to write a client side java application that will log onto a server. This server I have no control over and thus must interface with it how it wants, which is (as far as I can see) through cookies and redirection. I've tried using the HttpURLConnection class to connect to the server and capture the cookies it sends, but ... |
|
|
|
Actually i am sendin a http request via httpurlconnection class. many headers i will set along with it. What i required now is i want to see the request stream which was send thru the url connection. if i use browser i will catch the request by HTTP WATCH os IE Watch software. Like that i want to view the request ... |
Hi All, Thanks in advance for reading the post. I was trying to log in to a secured credit card site from a java application . the code which i used to connect to the site is given below.But I am not able to make the application working fine. -----------Code--------------------------------------------------- String urlString = "https://www99.www99.testCardLogin/action?request_type=LogLogonHandler&location=test+logon_1"; URL url = new URL(urlString); HttpURLConnection connection ... |
There is a good code sample given at http://code.google.com/appengine/docs/java/urlfetch/usingjavanet.html that gives an example of how to make a post request to post comments on a web page. The relevant code is given below- String message = URLEncoder.encode("my message", "UTF-8"); try { URL url = new URL("http://www.example.com/comment"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod("POST"); OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write("message=" + message); ... |
MishraC wrote: 1. I require to extract the binary data out of a http multipart request, 2. I have a server socket opened up, which can receive connections over tcp( and therefore http.) 3. I will require to read the stream, find out the "request boundary identifier", and then extract the different "request body parts". 4. From there i need to ... |
// Send data URL url = new URL("http://luna.a2wi.co.in:7501/failsafe/HttpLink?pcode=DEMO&acode=DEMO8&pin=atwd4&mnumber=919840770604&message=test&aid=7007"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoOutput(true); // Get the response BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = rd.readLine()) != null) { // Process line... System.out.println(line); } rd.close(); } catch (Exception e) { e.printStackTrace(); } } } When i tried this URL (Mentioned in the code) I'm getting the ... |
Hi, is it possible to send multiple post requests using a single Http connection. i am currently trying to simulate the preformance overhead because of creating HttpURLConnection to talk to my servlet. But, that made me wonder, if is there a way to send multiple post requests using a single HttpURLConnection. can anyone help me with this. thanks in advance |
I am writing a Java Http client application and need to submit HEAD requests. I am using the HttpUrlConnection class to generate the requests and process the responses. However, when I try to send a HEAD request, it sends a GET instead with the "method" request header set to "HEAD", which just isn't the same thing. Here is a snippet of ... |