1 30 31 32 package org.apache.commons.httpclient; 33 34 import org.apache.commons.logging.Log; 35 import org.apache.commons.logging.LogFactory; 36 37 import java.io.IOException ; 38 39 40 45 class SimpleHttpMethod extends HttpMethodBase{ 46 47 static Log log = LogFactory.getLog("httpclient.test"); 48 Header header = null; 49 50 SimpleHttpMethod(){ 51 super(); 52 } 53 54 SimpleHttpMethod(String path){ 55 super(path); 56 } 57 58 SimpleHttpMethod(Header header){ 59 super(); 60 this.header = header; 61 } 62 63 public String getName() { 64 return "Simple"; 65 } 66 67 71 private void ensureResponseHeaderIsSet() { 72 if ( header != null ) { 73 super.getResponseHeaderGroup().addHeader(header); 74 header = null; 75 } 76 } 77 78 81 public int execute(HttpState state, HttpConnection connection) 82 throws HttpException, IOException { 83 return super.execute(state, connection); 84 } 85 86 90 public Header getResponseHeader(String headerName) { 91 ensureResponseHeaderIsSet(); 92 return super.getResponseHeader(headerName); 93 } 94 95 98 protected HeaderGroup getResponseHeaderGroup() { 99 ensureResponseHeaderIsSet(); 100 return super.getResponseHeaderGroup(); 101 } 102 103 106 public Header[] getResponseHeaders() { 107 ensureResponseHeaderIsSet(); 108 return super.getResponseHeaders(); 109 } 110 111 112 public String getTestRequestLine(HttpConnection connection) { 113 return HttpMethodBase.generateRequestLine(connection, 114 this.getName(), this.getPath(), this.getQueryString(), "HTTP/1.1"); 115 } 116 } 117 | Popular Tags |