1 19 20 package com.maverick.http; 21 22 import java.io.IOException ; 23 24 28 public class PutMethod extends AsyncHttpMethod { 29 30 ContentSource source; 31 32 public PutMethod(String uri, ContentSource source) throws IOException { 33 super("PUT", uri); this.source = source; 35 } 36 37 public PutMethod(String name, String uri, ContentSource source) throws IOException { 38 super(name, uri); 39 this.source = source; 40 } 41 42 public void executeAsync(HttpRequest request, HttpConnection con) throws IOException { 43 44 request.setHeaderField("Host", con.getHostHeaderValue()); request.setHeaderField("User-Agent", HttpClient.USER_AGENT); if (source != null) 47 source.setHeaders(request, con); 48 request.performRequest(this, con); 49 50 } 51 52 public HttpResponse execute(HttpRequest request, HttpConnection con) throws IOException { 53 executeAsync(request, con); 54 return new HttpResponse(con); 55 } 56 } 57 | Popular Tags |