Example usage for com.amazonaws Request setHttpMethod

List of usage examples for com.amazonaws Request setHttpMethod

Introduction

In this page you can find the example usage for com.amazonaws Request setHttpMethod.

Prototype

void setHttpMethod(HttpMethodName httpMethod);

Source Link

Document

Sets the HTTP method (GET, POST, etc) to use when sending this request.

Usage

From source file:com.erudika.para.rest.Signer.java

License:Apache License

private Request<?> buildAWSRequest(String httpMethod, String endpoint, String resourcePath,
        Map<String, String> headers, Map<String, String> params, InputStream entity) {
    Request<?> r = new DefaultRequest<AmazonWebServiceRequest>(Config.PARA);

    if (!StringUtils.isBlank(httpMethod)) {
        r.setHttpMethod(HttpMethodName.valueOf(httpMethod));
    }/*from   www.  j a v  a  2 s  .c  om*/
    if (!StringUtils.isBlank(endpoint)) {
        if (!endpoint.startsWith("http")) {
            endpoint = "https://" + endpoint;
        }
        r.setEndpoint(URI.create(endpoint));
    }
    if (!StringUtils.isBlank(resourcePath)) {
        r.setResourcePath(SdkHttpUtils.urlEncode(resourcePath, true));
    }
    if (headers != null) {
        if (headers.containsKey("x-amz-date")) {
            overriddenDate = parseAWSDate(headers.get("x-amz-date"));
        }
        // we don't need these here, added by default
        headers.remove("host");
        headers.remove("x-amz-date");
        r.setHeaders(headers);
    }
    if (params != null) {
        for (Map.Entry<String, String> param : params.entrySet()) {
            r.addParameter(param.getKey(), param.getValue());
        }
    }
    if (entity != null) {
        r.setContent(entity);
    }
    return r;
}

From source file:com.ivona.services.tts.model.transform.createspeech.CreateSpeechGetRequestMarshaller.java

License:Open Source License

public Request<CreateSpeechRequest> marshall(CreateSpeechRequest createSpeechRequest) {
    if (createSpeechRequest == null) {
        throw new AmazonClientException("null createSpeechRequest passed to marshall(...)");
    }//from  ww  w .  ja  v a  2s  .  c  o m

    Request<CreateSpeechRequest> request = new DefaultRequest<CreateSpeechRequest>(createSpeechRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    setRequestParameters(request, createSpeechRequest);
    request.setHttpMethod(HttpMethodName.GET);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}

From source file:com.ivona.services.tts.model.transform.createspeech.CreateSpeechPostRequestMarshaller.java

License:Open Source License

public Request<CreateSpeechRequest> marshall(CreateSpeechRequest createSpeechRequest) {

    if (createSpeechRequest == null) {
        throw new AmazonClientException("null createSpeechRequest passed to marshall(...)");
    }/*  ww w . j av a 2s .c  om*/

    Request<CreateSpeechRequest> request = new DefaultRequest<CreateSpeechRequest>(createSpeechRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.POST);
    setRequestPayload(request, createSpeechRequest);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}

From source file:com.ivona.services.tts.model.transform.lexicons.DeleteLexiconPostRequestMarshaller.java

License:Open Source License

public Request<DeleteLexiconRequest> marshall(DeleteLexiconRequest deleteLexiconRequest) {
    if (deleteLexiconRequest == null) {
        throw new AmazonClientException("null deleteLexiconRequest passed to marshall(...)");
    }//from   w ww .  ja  va 2 s.  com

    Request<DeleteLexiconRequest> request = new DefaultRequest<DeleteLexiconRequest>(deleteLexiconRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.POST);
    setRequestPayload(request, deleteLexiconRequest);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}

From source file:com.ivona.services.tts.model.transform.lexicons.GetLexiconPostRequestMarshaller.java

License:Open Source License

public Request<GetLexiconRequest> marshall(GetLexiconRequest getLexiconRequest) {
    if (getLexiconRequest == null) {
        throw new AmazonClientException("null getLexiconRequest passed to marshall(...)");
    }//w w w.jav a  2s . c o  m

    Request<GetLexiconRequest> request = new DefaultRequest<GetLexiconRequest>(getLexiconRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.POST);
    setRequestPayload(request, getLexiconRequest);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}

From source file:com.ivona.services.tts.model.transform.lexicons.ListLexiconsPostRequestMarshaller.java

License:Open Source License

public Request<ListLexiconsRequest> marshall(ListLexiconsRequest listLexiconsRequest) {
    if (listLexiconsRequest == null) {
        throw new AmazonClientException("null listLexiconsRequest passed to marshall(...)");
    }/*  w  w w.jav a 2  s . com*/

    Request<ListLexiconsRequest> request = new DefaultRequest<ListLexiconsRequest>(listLexiconsRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.POST);
    setRequestPayload(request, listLexiconsRequest);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}

From source file:com.ivona.services.tts.model.transform.lexicons.PutLexiconPostRequestMarshaller.java

License:Open Source License

public Request<PutLexiconRequest> marshall(PutLexiconRequest putLexiconRequest) {
    if (putLexiconRequest == null) {
        throw new AmazonClientException("null putLexiconRequest passed to marshall(...)");
    }/*from w  ww  . j  a  v  a 2 s  .com*/

    Request<PutLexiconRequest> request = new DefaultRequest<PutLexiconRequest>(putLexiconRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.POST);
    setRequestPayload(request, putLexiconRequest);
    request.setResourcePath(RESOURCE_PATH);

    return request;
}

From source file:com.ivona.services.tts.model.transform.listvoices.ListVoicesGetRequestMarshaller.java

License:Open Source License

public Request<ListVoicesRequest> marshall(ListVoicesRequest listVoicesRequest) {

    if (listVoicesRequest == null) {
        throw new AmazonClientException("null listVoicesRequest passed to marshall(...)");
    }/* w ww.j a  va 2 s.co  m*/

    Request<ListVoicesRequest> request = new DefaultRequest<ListVoicesRequest>(listVoicesRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.GET);
    request.setResourcePath(RESOURCE_PATH);

    setRequestParameters(request, listVoicesRequest);

    return request;
}

From source file:com.ivona.services.tts.model.transform.listvoices.ListVoicesPostRequestMarshaller.java

License:Open Source License

public Request<ListVoicesRequest> marshall(ListVoicesRequest listVoicesRequest) {

    if (listVoicesRequest == null) {
        throw new AmazonClientException("null listVoicesRequest passed to marshall(...)");
    }/*from   ww  w . j  av a2  s.c  o  m*/

    Request<ListVoicesRequest> request = new DefaultRequest<ListVoicesRequest>(listVoicesRequest,
            IvonaSpeechCloudClient.SERVICE_NAME);
    request.setHttpMethod(HttpMethodName.POST);
    request.setResourcePath(RESOURCE_PATH);
    setRequestPayload(request, listVoicesRequest);
    return request;
}