Fix and add comments to HttpUtil

Motivation:
The comments in HttpUtil need some love.

Modifications
- Update comments in HttpUtil

Result:
Comments are cleaner in HttpUtil.
This commit is contained in:
Scott Mitchell 2015-08-27 09:24:45 -07:00
parent b6a4f5de9d
commit 5498fd12dc

View File

@ -50,7 +50,7 @@ public final class HttpUtil {
/** /**
* Returns {@code true} if and only if the connection can remain open and * Returns {@code true} if and only if the connection can remain open and
* thus 'kept alive'. This methods respects the value of the * thus 'kept alive'. This methods respects the value of the.
* {@code "Connection"} header first and then the return value of * {@code "Connection"} header first and then the return value of
* {@link HttpVersion#isKeepAliveDefault()}. * {@link HttpVersion#isKeepAliveDefault()}.
*/ */
@ -260,6 +260,13 @@ public final class HttpUtil {
return message.headers().contains(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED, true); return message.headers().contains(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED, true);
} }
/**
* Set the {@link HttpHeaderNames#TRANSFER_ENCODING} to either include {@link HttpHeaderValues#CHUNKED} if
* {@code chunked} is {@code true}, or remove {@link HttpHeaderValues#CHUNKED} if {@code chunked} is {@code false}.
* @param m The message which contains the headers to modify.
* @param chunked if {@code true} then include {@link HttpHeaderValues#CHUNKED} in the headers. otherwise remove
* {@link HttpHeaderValues#CHUNKED} from the headers.
*/
public static void setTransferEncodingChunked(HttpMessage m, boolean chunked) { public static void setTransferEncodingChunked(HttpMessage m, boolean chunked) {
if (chunked) { if (chunked) {
m.headers().add(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED); m.headers().add(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);