Пример #1
0
 public void setRequestMethod(String method) throws ProtocolException {
   this.method = method;
   if (METHOD_GET.equalsIgnoreCase(method)) {
     req = new HttpGet(url.toString());
   } else if (METHOD_HEAD.equalsIgnoreCase(method)) {
     req = new HttpHead(url.toString());
   } else if (METHOD_PUT.equalsIgnoreCase(method)) {
     req = new HttpPut(url.toString());
   } else if (METHOD_POST.equalsIgnoreCase(method)) {
     req = new HttpPost(url.toString());
   } else {
     this.method = null;
     throw new UnsupportedOperationException();
   }
 }