01: package com.meterware.httpunit;
02:
03: /********************************************************************************************************************
04: * Copyright (c) 2001, Russell Gold
05: *
06: * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
07: * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
08: * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
09: * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10: *
11: * The above copyright notice and this permission notice shall be included in all copies or substantial portions
12: * of the Software.
13: *
14: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
15: * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
17: * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18: * DEALINGS IN THE SOFTWARE.
19: *
20: *******************************************************************************************************************/
21:
22: import java.io.InputStream;
23:
24: /**
25: * A web request using the PUT protocol.
26: *
27: * The objectives of this class are to suport an HTTP PUT petition
28: * so we can test this HTTP requests.
29: *
30: * <B>Documentation</B> See the HTTP 1.1 [<a href="http://www.w3.org/Protocols/HTTP/">spec</a>]
31: *
32: * @author Tom Watkins
33: * @author Deepa Dihr
34: * @author Marcos Tarruella
35: * @author Russell Gold
36: *
37: **/
38: public class PutMethodWebRequest extends MessageBodyWebRequest {
39:
40: /**
41: * Constructs a web request using a specific absolute url string and input stream.
42: * @param urlString the URL to which the request should be issued
43: * @param source an input stream which will provide the body of this request
44: * @param contentType the MIME content type of the body, including any character set
45: **/
46: public PutMethodWebRequest(String url, InputStream source,
47: String contentType) {
48: super (url);
49: _body = new InputStreamMessageBody(this , source, contentType);
50: }
51:
52: /**
53: * Returns 'PUT' to indicate the method.
54: **/
55: public String getMethod() {
56: return "PUT";
57: }
58:
59: /**
60: * Returns a message body based on the input stream.
61: **/
62: protected MessageBody getMessageBody() {
63: return _body;
64: }
65:
66: private MessageBody _body;
67: }
|