[JCLOUDS-302] Remove unnecessary String construction in HttpUtils

This commit is contained in:
Niraj Tolia 2013-09-27 10:36:20 -07:00 committed by Adrian Cole
parent 7290cc8ea6
commit 73464c3877
1 changed files with 15 additions and 15 deletions

View File

@ -225,36 +225,36 @@ public class HttpUtils {
public void checkRequestHasRequiredProperties(HttpRequest message) { public void checkRequestHasRequiredProperties(HttpRequest message) {
checkArgument( checkArgument(
message.getPayload() == null || message.getFirstHeaderOrNull(CONTENT_TYPE) == null, message.getPayload() == null || message.getFirstHeaderOrNull(CONTENT_TYPE) == null,
"configuration error please use request.getPayload().getContentMetadata().setContentType(value) as opposed to adding a content type header: " "configuration error please use request.getPayload().getContentMetadata().setContentType(value) as opposed to adding a content type header: %s",
+ message); message);
checkArgument( checkArgument(
message.getPayload() == null || message.getFirstHeaderOrNull(CONTENT_LENGTH) == null, message.getPayload() == null || message.getFirstHeaderOrNull(CONTENT_LENGTH) == null,
"configuration error please use request.getPayload().getContentMetadata().setContentLength(value) as opposed to adding a content length header: " "configuration error please use request.getPayload().getContentMetadata().setContentLength(value) as opposed to adding a content length header: %s",
+ message); message);
checkArgument( checkArgument(
message.getPayload() == null || message.getPayload().getContentMetadata().getContentLength() != null message.getPayload() == null || message.getPayload().getContentMetadata().getContentLength() != null
|| "chunked".equalsIgnoreCase(message.getFirstHeaderOrNull("Transfer-Encoding")), || "chunked".equalsIgnoreCase(message.getFirstHeaderOrNull("Transfer-Encoding")),
"either chunked encoding must be set on the http request or contentlength set on the payload: " + message); "either chunked encoding must be set on the http request or contentlength set on the payload: %s", message);
checkArgument( checkArgument(
message.getPayload() == null || message.getFirstHeaderOrNull("Content-MD5") == null, message.getPayload() == null || message.getFirstHeaderOrNull("Content-MD5") == null,
"configuration error please use request.getPayload().getContentMetadata().setContentMD5(value) as opposed to adding a content md5 header: " "configuration error please use request.getPayload().getContentMetadata().setContentMD5(value) as opposed to adding a content md5 header: %s",
+ message); message);
checkArgument( checkArgument(
message.getPayload() == null || message.getFirstHeaderOrNull("Content-Disposition") == null, message.getPayload() == null || message.getFirstHeaderOrNull("Content-Disposition") == null,
"configuration error please use request.getPayload().getContentMetadata().setContentDisposition(value) as opposed to adding a content disposition header: " "configuration error please use request.getPayload().getContentMetadata().setContentDisposition(value) as opposed to adding a content disposition header: %s",
+ message); message);
checkArgument( checkArgument(
message.getPayload() == null || message.getFirstHeaderOrNull(CONTENT_ENCODING) == null, message.getPayload() == null || message.getFirstHeaderOrNull(CONTENT_ENCODING) == null,
"configuration error please use request.getPayload().getContentMetadata().setContentEncoding(value) as opposed to adding a content encoding header: " "configuration error please use request.getPayload().getContentMetadata().setContentEncoding(value) as opposed to adding a content encoding header: %s",
+ message); message);
checkArgument( checkArgument(
message.getPayload() == null || message.getFirstHeaderOrNull(CONTENT_LANGUAGE) == null, message.getPayload() == null || message.getFirstHeaderOrNull(CONTENT_LANGUAGE) == null,
"configuration error please use request.getPayload().getContentMetadata().setContentLanguage(value) as opposed to adding a content language header: " "configuration error please use request.getPayload().getContentMetadata().setContentLanguage(value) as opposed to adding a content language header: %s",
+ message); message);
checkArgument( checkArgument(
message.getPayload() == null || message.getFirstHeaderOrNull(EXPIRES) == null, message.getPayload() == null || message.getFirstHeaderOrNull(EXPIRES) == null,
"configuration error please use request.getPayload().getContentMetadata().setExpires(value) as opposed to adding an expires header: " "configuration error please use request.getPayload().getContentMetadata().setExpires(value) as opposed to adding an expires header: %s",
+ message); message);
} }
public static void releasePayload(HttpMessage from) { public static void releasePayload(HttpMessage from) {