This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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.
Bert Bates
author
Sheriff
Joined: Oct 14, 2002
Posts: 8712
posted
0
let's slide this over to the Servlets forum, not sure that's the best place but it's better than here
Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
Arpit Purohit
Greenhorn
Joined: Jan 09, 2007
Posts: 21
posted
0
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?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35250
7
posted
0
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.
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?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35250
7
posted
0
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.