List of usage examples for com.amazonaws.util SdkHttpUtils urlEncode
public static String urlEncode(final String value, final boolean path)
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)); }/* w w w . j av a2 s. c o m*/ 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; }