Search in sources :

Example 1 with HTTPMethod

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()));
    }
}
Also used : HTTPRequest(com.google.appengine.api.urlfetch.HTTPRequest) HTTPHeader(com.google.appengine.api.urlfetch.HTTPHeader) Header(org.apache.http.Header) HTTPMethod(com.google.appengine.api.urlfetch.HTTPMethod) HttpHost(org.apache.http.HttpHost) URL(java.net.URL) HTTPHeader(com.google.appengine.api.urlfetch.HTTPHeader)

Aggregations

HTTPHeader (com.google.appengine.api.urlfetch.HTTPHeader)1 HTTPMethod (com.google.appengine.api.urlfetch.HTTPMethod)1 HTTPRequest (com.google.appengine.api.urlfetch.HTTPRequest)1 URL (java.net.URL)1 Header (org.apache.http.Header)1 HttpHost (org.apache.http.HttpHost)1