private static HttpMethod toNettyHttpMethod(HttpMethodName method) { return HttpMethod.valueOf(method.name()); } }
/** * @param value Raw string representing value of enum * @return HttpMethodName enum or null if value is not present. * @throws IllegalArgumentException If value does not represent a known enum value. */ public static HttpMethodName fromValue(String value) { if (StringUtils.isNullOrEmpty(value)) { return null; } final String upperCaseValue = StringUtils.upperCase(value); for (HttpMethodName httpMethodName : values()) { if (httpMethodName.name().equals(upperCaseValue)) { return httpMethodName; } } throw new IllegalArgumentException("Unsupported HTTP method name " + value); }
/** * @param value Raw string representing value of enum * @return HttpMethodName enum or null if value is not present. * @throws IllegalArgumentException If value does not represent a known enum value. */ public static HttpMethodName fromValue(String value) { if (StringUtils.isNullOrEmpty(value)) { return null; } final String upperCaseValue = StringUtils.upperCase(value); for (HttpMethodName httpMethodName : values()) { if (httpMethodName.name().equals(upperCaseValue)) { return httpMethodName; } } throw new IllegalArgumentException("Unsupported HTTP method name " + value); }
protected boolean shouldAddContentUnsignedPayloadInHeader(final String httpMethodName) { return HttpMethodName.POST.name().equals(httpMethodName); } }
private static HttpMethod toNettyHttpMethod(HttpMethodName method) { return HttpMethod.valueOf(method.name()); } }
/** * @param value Raw string representing value of enum * @return HttpMethodName enum or null if value is not present. * @throws IllegalArgumentException If value does not represent a known enum value. */ public static HttpMethodName fromValue(String value) { if (StringUtils.isNullOrEmpty(value)) { return null; } final String upperCaseValue = StringUtils.upperCase(value); for (HttpMethodName httpMethodName : values()) { if (httpMethodName.name().equals(upperCaseValue)) { return httpMethodName; } } throw new IllegalArgumentException("Unsupported HTTP method name " + value); }
@Override protected String calculateContentHash(final SignableRequest<?> request) { if (shouldAddContentUnsignedPayloadInHeader(request.getHttpMethod().name())) { return CONTENT_UNSIGNED_PAYLOAD; } return super.calculateContentHash(request); }