com.google.appengine.api.urlfetch.HTTPMethod

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

1. UrlFetchTransport#buildRequest()

Project: google-http-java-client
File: UrlFetchTransport.java
@Override
protected UrlFetchRequest buildRequest(String method, String url) throws IOException {
    Preconditions.checkArgument(supportsMethod(method), "HTTP method %s not supported", method);
    HTTPMethod httpMethod;
    if (method.equals(HttpMethods.DELETE)) {
        httpMethod = HTTPMethod.DELETE;
    } else if (method.equals(HttpMethods.GET)) {
        httpMethod = HTTPMethod.GET;
    } else if (method.equals(HttpMethods.HEAD)) {
        httpMethod = HTTPMethod.HEAD;
    } else if (method.equals(HttpMethods.POST)) {
        httpMethod = HTTPMethod.POST;
    } else if (method.equals(HttpMethods.PATCH)) {
        httpMethod = HTTPMethod.PATCH;
    } else {
        httpMethod = HTTPMethod.PUT;
    }
    // fetch options
    FetchOptions fetchOptions = FetchOptions.Builder.doNotFollowRedirects().disallowTruncate().validateCertificate();
    switch(certificateValidationBehavior) {
        case VALIDATE:
            fetchOptions.validateCertificate();
            break;
        case DO_NOT_VALIDATE:
            fetchOptions.doNotValidateCertificate();
            break;
        default:
            break;
    }
    return new UrlFetchRequest(fetchOptions, httpMethod, url);
}