Forums Register Login

Generate HTTP PUT request

+Pie Number of slices to send: Send
I want to generate HTTP PUT request programatically using java.
Can anybody help on this topic.
+Pie Number of slices to send: Send
Try Jakarta HttpClient. It's free.
+Pie Number of slices to send: Send
Welcome to JavaRanch.

Something like the following will do the trick:

+Pie Number of slices to send: Send
Yes, it depends how advanced your usage will be. Plain JDK Java will do for the simplest cases, but Jakarta HTTPClient will help a lot with more-difficult cases.
+Pie Number of slices to send: Send
let's slide this over to the Servlets forum, not sure that's the best place but it's better than here
+Pie Number of slices to send: Send
Hi friends,
let me make it more clear about HTTP PUT request.
It is used to create new resource on server.And same i want to do programatically.
Can anybody give me example for that?
+Pie Number of slices to send: Send
Can you be more specific what you're trying to do? Peter and myself mentioned two possibilities how to send a request from the client side; on the server side you can use a servlet's doPut method. If that doesn't help, tell us where you're stuck implementing this, and we'll try to get you going again.
+Pie Number of slices to send: Send
Not really a servlets question either (unless you need help with the doPut methdod). Moving to Sockets and Internet Protocols.
+Pie Number of slices to send: Send
Being more specific,
I want to create a resource on server by sending PUT request from the client (which is the basic usage PUT request ). I know very well that PUT request is handled on server side (servlet) using doPut() method. But i am not clear about following things:

1. How can i generate PUT request from client (say java program)?
2. Further, how and what to handle on servet's doPut() method so as to create
resource?
3. As known, PUT request is to create resource on server, do i have to provide
resource name(to be created) as parameter in the request and how?
+Pie Number of slices to send: Send
 

1. How can i generate PUT request from client (say java program)?


Paul and I mentioned two ways of doing this. What else are you looking for?

2. Further, how and what to handle on servet's doPut() method so as to create resource?

3. As known, PUT request is to create resource on server, do i have to provide resource name(to be created) as parameter in the request and how?


Conceptually, a PUT is somewhat similar to a POST, with the body of the request containing the resource. So you'd use the Request.getInputStream method to get at the data of the resource.

The name of the resource is the URI (or URL in this case), so no extra name is supplied. You should read section 9.6 of the HTTP specification (and the other sections it points to) for further details regarding the implementation.
pie. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 13068 times.
Similar Threads
Display All images from a folder on a html/jsp page
HTTP PUT File Uploads
Invoking HTTP Methods
How to retrieve generated HTML
Generate HTTP PUT request
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:54:40.