KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > webdav > lib > methods > CheckoutMethod


1 /*
2  * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/CheckoutMethod.java,v 1.4 2004/08/02 15:45:48 unico Exp $
3  * $Revision: 1.4 $
4  * $Date: 2004/08/02 15:45:48 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.webdav.lib.methods;
25
26 import java.io.IOException JavaDoc;
27 import java.io.InputStream JavaDoc;
28 import org.apache.commons.httpclient.HttpConnection;
29 import org.apache.commons.httpclient.HttpException;
30 import org.apache.commons.httpclient.HttpState;
31 import org.apache.webdav.lib.util.WebdavStatus;
32
33
34 /**
35  * The Checkout method can be applied to a checked-in version-controlled
36  * resource.
37  *
38  *
39  *
40  * <h3>Example Request</h3>
41  * <pre>
42  * Checkout /foo.html HTTP/1.1
43  * Host: www.server.org
44  * Content-Length: xx
45  * </pre>
46  *
47  * <h3>Example Response</h3>
48  * <pre>
49  * HTTP/1.1 200 OK
50  * </pre>
51  *
52  */

53 public class CheckoutMethod
54     extends XMLResponseMethodBase {
55
56
57     // -------------------------------------------------------------- Constants
58

59
60
61     // ----------------------------------------------------- Instance Variables
62

63
64
65     // ----------------------------------------------------------- Constructors
66

67
68     /**
69      * Method constructor.
70      */

71     public CheckoutMethod() {
72     }
73
74
75     /**
76      * Method constructor.
77      */

78     public CheckoutMethod(String JavaDoc path) {
79         super(path);
80     }
81
82     /**
83      * Parse response.
84      *
85      * @param input Input stream
86      */

87     public void parseResponse(InputStream JavaDoc input, HttpState state, HttpConnection conn)
88         throws IOException JavaDoc, HttpException {
89         try
90         {
91             if (getStatusLine().getStatusCode() == WebdavStatus.SC_CONFLICT ||
92                 getStatusLine().getStatusCode() == WebdavStatus.SC_FORBIDDEN ) {
93                 parseXMLResponse(input);
94             }
95         }
96         catch (IOException JavaDoc e) {
97                 // FIX ME: provide a way to deliver non xml data
98
}
99     }
100
101     public String JavaDoc getName() {
102         return "CHECKOUT";
103     }
104 }
105
Popular Tags