Search in sources :

Example 1 with HTTPRequest

use of com.google.appengine.api.urlfetch.HTTPRequest 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)

Example 2 with HTTPRequest

use of com.google.appengine.api.urlfetch.HTTPRequest in project dropbox-sdk-java by dropbox.

the class GoogleAppEngineRequestor method doGet.

@Override
public Response doGet(String url, Iterable<Header> headers) throws IOException {
    HTTPRequest request = newRequest(url, HTTPMethod.GET, headers);
    HTTPResponse response = service.fetch(request);
    return toRequestorResponse(response);
}
Also used : HTTPRequest(com.google.appengine.api.urlfetch.HTTPRequest) HTTPResponse(com.google.appengine.api.urlfetch.HTTPResponse)

Aggregations

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