1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
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 }