1 /*
2 * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/Attic/UrlDeleteMethod.java,v 1.12.2.1 2004/02/22 18:21:15 olegk Exp $
3 * $Revision: 1.12.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;
38
39 /***
40 * HttpUrlMethod version of DeleteMethod.
41 *
42 * @deprecated use DeleteMethod
43 *
44 * @author Marc A. Saegesser
45 * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
46 */
47 public class UrlDeleteMethod extends DeleteMethod implements HttpUrlMethod {
48
49 // ----------------------------------------------------- Instance Variables
50 /*** The URL */
51 private String url;
52
53 /***
54 * No-arg constructor.
55 */
56 public UrlDeleteMethod() {
57 super();
58 }
59
60
61 /***
62 * Path-setting constructor.
63 * @param url the path of the request
64 * @throws MalformedURLException If the url is not valid.
65 */
66 public UrlDeleteMethod(String url) throws MalformedURLException {
67 super(URIUtil.getPath(url));
68 setUrl(url);
69 }
70
71 /***
72 * Sets the URL. Calls the underlying HttpMethod.setPath()
73 * with the url's path. If the url contains a query string
74 * the underlying HttpMethod.setQueryString() is called.
75 *
76 * @param url - the URL for this request.
77 * @throws MalformedURLException If the url is not valid.
78 */
79 public void setUrl(String url) throws MalformedURLException {
80 setPath(URIUtil.getPath(url));
81 this.url = url;
82 String query = URIUtil.getQuery(url);
83 if (query != null && query.length() > 0) {
84 super.setQueryString(query);
85 }
86 }
87
88 /***
89 * Gets the URL.
90 * @return The URL.
91 */
92 public String getUrl() {
93 return url;
94 }
95
96 }