1 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.io.File ; 38 import java.net.MalformedURLException ; 39 40 50 public class UrlGetMethod extends GetMethod implements HttpUrlMethod { 51 53 private String url; 54 55 58 public UrlGetMethod() { 59 super(); 60 } 61 62 67 public UrlGetMethod(String url) throws MalformedURLException { 68 super(URIUtil.getPath(url)); 69 setUrl(url); 70 } 71 72 78 public UrlGetMethod(String url, String tempDir) throws MalformedURLException { 79 super(URIUtil.getPath(url), tempDir); 80 setUrl(url); 81 } 82 83 90 public UrlGetMethod(String url, String tempDir, String tempFile) 91 throws MalformedURLException { 92 super(URIUtil.getPath(url), tempDir, tempFile); 93 setUrl(url); 94 } 95 96 102 public UrlGetMethod(String url, File fileData) 103 throws MalformedURLException { 104 super(URIUtil.getPath(url), fileData); 105 setUrl(url); 106 } 107 108 116 public void setUrl(String url) throws MalformedURLException { 117 super.setPath(URIUtil.getPath(url)); 118 this.url = url; 119 String query = URIUtil.getQuery(url); 120 if (query != null && query.length() > 0) { 121 super.setQueryString(query); 122 } 123 } 124 125 130 public String getUrl() { 131 return url; 132 } 133 } 134 | Popular Tags |