com.google.appengine.api.urlfetch.HTTPRequest

Here are the examples of the java api class com.google.appengine.api.urlfetch.HTTPRequest taken from open source projects.

1. GaeRequestHandler#handle()

Project: google-maps-services-java
File: GaeRequestHandler.java
@Override
public <T, R extends ApiResponse<T>> PendingResult<T> handle(String hostName, String url, String userAgent, Class<R> clazz, FieldNamingPolicy fieldNamingPolicy, long errorTimeout) {
    FetchOptions fetchOptions = FetchOptions.Builder.withDeadline(10);
    HTTPRequest req = null;
    try {
        req = new HTTPRequest(new URL(hostName + url), HTTPMethod.POST, fetchOptions);
    } catch (MalformedURLException e) {
        LOG.log(Level.SEVERE, String.format("Request: %s%s", hostName, url), e);
        throw (new RuntimeException(e));
    }
    return new GaePendingResult<T, R>(req, client, clazz, fieldNamingPolicy, errorTimeout);
}

2. GoogleAppEngineRequestor#newRequest()

Project: dropbox-sdk-java
File: GoogleAppEngineRequestor.java
private HTTPRequest newRequest(String url, HTTPMethod method, Iterable<Header> headers) throws IOException {
    HTTPRequest request = new HTTPRequest(new URL(url), method, options);
    for (Header header : headers) {
        request.addHeader(new HTTPHeader(header.getKey(), header.getValue()));
    }
    return request;
}

3. GoogleAppEngineRequestor#startPut()

Project: dropbox-sdk-java
File: GoogleAppEngineRequestor.java
@Override
public Uploader startPut(String url, Iterable<Header> headers) throws IOException {
    HTTPRequest request = newRequest(url, HTTPMethod.POST, headers);
    return new Uploader(service, request, new ByteArrayOutputStream());
}

4. GoogleAppEngineRequestor#startPost()

Project: dropbox-sdk-java
File: GoogleAppEngineRequestor.java
@Override
public Uploader startPost(String url, Iterable<Header> headers) throws IOException {
    HTTPRequest request = newRequest(url, HTTPMethod.POST, headers);
    return new Uploader(service, request, new ByteArrayOutputStream());
}

5. GoogleAppEngineRequestor#doGet()

Project: dropbox-sdk-java
File: GoogleAppEngineRequestor.java
@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);
}