KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > httpclient > methods > UrlPutMethod


1 /*
2  * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/Attic/UrlPutMethod.java,v 1.13.2.1 2004/02/22 18:21:15 olegk Exp $
3  * $Revision: 1.13.2.1 $
4  * $Date: 2004/02/22 18:21:15 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2004 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  * This software consists of voluntary contributions made by many
24  * individuals on behalf of the Apache Software Foundation. For more
25  * information on the Apache Software Foundation, please see
26  * <http://www.apache.org/>.
27  *
28  * [Additional notices, if required by prior licensing conditions]
29  *
30  */

31
32 package org.apache.commons.httpclient.methods;
33
34 import org.apache.commons.httpclient.HttpUrlMethod;
35 import org.apache.commons.httpclient.util.URIUtil;
36
37 import java.net.MalformedURLException JavaDoc;
38
39 /**
40  * HttpUrlMethod version of PutMethod.
41  *
42  * @deprecated use PutMethod
43  *
44  * @author Marc A. Saegesser
45  * @author <a HREF="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
46  */

47 public class UrlPutMethod extends PutMethod implements HttpUrlMethod {
48     // ----------------------------------------------------- Instance Variables
49
/** The URL */
50     private String JavaDoc url;
51
52     /**
53      * No-arg constructor.
54      */

55     public UrlPutMethod() {
56         super();
57     }
58
59
60     /**
61      * Path-setting constructor.
62      * @param url the path of the request
63      * @throws MalformedURLException If the url isn't valid.
64      */

65     public UrlPutMethod(String JavaDoc url) throws MalformedURLException JavaDoc {
66         super(URIUtil.getPath(url));
67         setUrl(url);
68     }
69
70     /**
71      * Sets the URL. Calls the underlying HttpMethod.setPath()
72      * with the url's path. If the url contains a query string
73      * the underlying HttpMethod.setQueryString() is called.
74      *
75      * @param url - the URL for this request.
76      * @throws MalformedURLException If the url isn't valid.
77      */

78     public void setUrl(String JavaDoc url) throws MalformedURLException JavaDoc {
79         setPath(URIUtil.getPath(url));
80         this.url = url;
81         String JavaDoc query = URIUtil.getQuery(url);
82         if (query != null && query.length() > 0) {
83             super.setQueryString(query);
84         }
85     }
86
87     /**
88      * Returns this request's URL.
89      *
90      * @return the request's URL.
91      */

92     public String JavaDoc getUrl() {
93         return url;
94     }
95
96 }
97
Popular Tags