use of com.google.appengine.api.urlfetch.HTTPMethod in project OpenRefine by OpenRefine.
the class AppEngineClientConnection method sendRequestHeader.
public void sendRequestHeader(org.apache.http.HttpRequest apache_request) {
URL request_url;
HttpHost host = _route.getTargetHost();
String protocol = host.getSchemeName();
String addr = host.getHostName();
int port = host.getPort();
String path = apache_request.getRequestLine().getUri();
try {
request_url = new URL(protocol, addr, port, path);
} catch (java.net.MalformedURLException e) {
throw new RuntimeException(e);
}
HTTPMethod method = HTTPMethod.valueOf(apache_request.getRequestLine().getMethod());
_appengine_hrequest = new HTTPRequest(request_url, method, allowTruncate().doNotFollowRedirects());
Header[] apache_headers = apache_request.getAllHeaders();
for (int i = 0; i < apache_headers.length; i++) {
Header h = apache_headers[i];
_appengine_hrequest.setHeader(new HTTPHeader(h.getName(), h.getValue()));
}
}
Aggregations