List of usage examples for com.amazonaws.http HttpMethodName POST
HttpMethodName POST
To view the source code for com.amazonaws.http HttpMethodName POST.
Click Source Link
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(...)"); }/*from w w w .j a v a 2 s . c o m*/ 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(...)"); }/* w ww. ja v a2 s . c o m*/ 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(...)"); }/*from ww w .j a v a 2 s .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 ww . j ava2 s . c o m 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 www . j ava2s . c om 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.ListVoicesPostRequestMarshaller.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 v a 2 s . c om Request<ListVoicesRequest> request = new DefaultRequest<ListVoicesRequest>(listVoicesRequest, IvonaSpeechCloudClient.SERVICE_NAME); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(RESOURCE_PATH); setRequestPayload(request, listVoicesRequest); return request; }
From source file:org.apache.nifi.processors.aws.wag.AbstractAWSGatewayApiProcessor.java
License:Apache License
protected GenericApiGatewayRequest configureRequest(final ProcessContext context, final ProcessSession session, final String resourcePath, final FlowFile requestFlowFile, final HttpMethodName methodName) { GenericApiGatewayRequestBuilder builder = new GenericApiGatewayRequestBuilder() .withResourcePath(resourcePath); final Map<String, List<String>> parameters = getParameters(context); builder = builder.withParameters(parameters); InputStream requestBody = null; switch (methodName) { case GET:// ww w . ja va 2 s . c o m builder = builder.withHttpMethod(HttpMethodName.GET); break; case POST: requestBody = getRequestBodyToSend(session, context, requestFlowFile); builder = builder.withHttpMethod(HttpMethodName.POST).withBody(requestBody); break; case PUT: requestBody = getRequestBodyToSend(session, context, requestFlowFile); builder = builder.withHttpMethod(HttpMethodName.PUT).withBody(requestBody); break; case PATCH: requestBody = getRequestBodyToSend(session, context, requestFlowFile); builder = builder.withHttpMethod(HttpMethodName.PATCH).withBody(requestBody); break; case HEAD: builder = builder.withHttpMethod(HttpMethodName.HEAD); break; case DELETE: builder = builder.withHttpMethod(HttpMethodName.DELETE); break; case OPTIONS: requestBody = getRequestBodyToSend(session, context, requestFlowFile); builder = builder.withHttpMethod(HttpMethodName.OPTIONS).withBody(requestBody); break; } builder = setHeaderProperties(context, builder, methodName, requestFlowFile); return builder.build(); }
From source file:org.apache.nifi.processors.aws.wag.AbstractAWSGatewayApiProcessor.java
License:Apache License
protected GenericApiGatewayRequestBuilder setHeaderProperties(final ProcessContext context, GenericApiGatewayRequestBuilder requestBuilder, HttpMethodName methodName, final FlowFile requestFlowFile) { Map<String, String> headers = new HashMap<>(); for (String headerKey : dynamicPropertyNames) { String headerValue = context.getProperty(headerKey).evaluateAttributeExpressions(requestFlowFile) .getValue();//from ww w .j av a 2 s .c om headers.put(headerKey, headerValue); } // iterate through the flowfile attributes, adding any attribute that // matches the attributes-to-send pattern. if the pattern is not set // (it's an optional property), ignore that attribute entirely if (regexAttributesToSend != null && requestFlowFile != null) { Map<String, String> attributes = requestFlowFile.getAttributes(); Matcher m = regexAttributesToSend.matcher(""); for (Map.Entry<String, String> entry : attributes.entrySet()) { String headerKey = trimToEmpty(entry.getKey()); // don't include any of the ignored attributes if (IGNORED_ATTRIBUTES.contains(headerKey)) { continue; } // check if our attribute key matches the pattern // if so, include in the request as a header m.reset(headerKey); if (m.matches()) { String headerVal = trimToEmpty(entry.getValue()); headers.put(headerKey, headerVal); } } } String contentType = context.getProperty(PROP_CONTENT_TYPE).evaluateAttributeExpressions(requestFlowFile) .getValue(); boolean sendBody = context.getProperty(PROP_SEND_BODY).asBoolean(); contentType = StringUtils.isBlank(contentType) ? DEFAULT_CONTENT_TYPE : contentType; if (methodName == HttpMethodName.PUT || methodName == HttpMethodName.POST || methodName == HttpMethodName.PATCH) { if (sendBody) { headers.put("Content-Type", contentType); } } else { headers.put("Content-Type", contentType); } if (!headers.isEmpty()) { requestBuilder = requestBuilder.withHeaders(headers); } return requestBuilder; }
From source file:org.springframework.vault.authentication.AwsIamAuthentication.java
License:Apache License
private static String getSignedHeaders(AwsIamAuthenticationOptions options) { Map<String, String> headers = createIamRequestHeaders(options); AWS4Signer signer = new AWS4Signer(); DefaultRequest<String> request = new DefaultRequest<>("sts"); request.setContent(new ByteArrayInputStream(REQUEST_BODY.getBytes())); request.setHeaders(headers);/*from w w w . java2 s .co m*/ request.setHttpMethod(HttpMethodName.POST); request.setEndpoint(options.getEndpointUri()); signer.setServiceName(request.getServiceName()); signer.sign(request, options.getCredentialsProvider().getCredentials()); Map<String, Object> map = new LinkedHashMap<>(); for (Entry<String, String> entry : request.getHeaders().entrySet()) { map.put(entry.getKey(), Collections.singletonList(entry.getValue())); } try { return OBJECT_MAPPER.writeValueAsString(map); } catch (JsonProcessingException e) { throw new IllegalStateException("Cannot serialize headers to JSON", e); } }