KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/methods/MkWorkspaceMethod.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 MkWorkspace method is used to create a new workspace. New workspaces
36  * can only be created in the workspace collection of the server. A workspace
37  * can contain version controled resources and any other. Each resource
38  * must identify its workspace.
39  *
40  * It is not allowed to create a new workspace inside an exiting workspace.
41  *
42  *
43  * <h3>Example Request</h3>
44  * <pre>
45  * MKWORKSPACE /ws/myWs/ HTTP/1.1
46  * Host: www.server.org
47  * </pre>
48  *
49  * <h3>Example Response</h3>
50  * <pre>
51  * HTTP/1.1 201 Created
52  * </pre>
53  *
54  */

55 public class MkWorkspaceMethod
56     extends XMLResponseMethodBase {
57
58
59     // ----------------------------------------------------------- Constructors
60

61
62     /**
63      * Method constructor.
64      */

65     public MkWorkspaceMethod() {
66     }
67
68
69     /**
70      * Method constructor.
71      */

72     public MkWorkspaceMethod(String JavaDoc path) {
73         super(path);
74     }
75
76
77     // --------------------------------------------------- WebdavMethod Methods
78

79
80     public String JavaDoc getName() {
81         return "MKWORKSPACE";
82     }
83     /**
84      * Parse response.
85      *
86      * @param input Input stream
87      */

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