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:
parent
fcd8a3ed1e
commit
52b77a7ac9
@ -49,7 +49,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()}.
|
||||||
*/
|
*/
|
||||||
@ -68,7 +68,7 @@ public final class HttpUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of the {@code "Connection"} header depending on the
|
* Sets the value of the {@code "Connection"} header depending on the
|
||||||
* protocol version of the specified message. This getMethod sets or removes
|
* protocol version of the specified message. This getMethod sets or removes
|
||||||
* the {@code "Connection"} header depending on what the default keep alive
|
* the {@code "Connection"} header depending on what the default keep alive
|
||||||
* mode of the message's protocol version is, as specified by
|
* mode of the message's protocol version is, as specified by
|
||||||
* {@link HttpVersion#isKeepAliveDefault()}.
|
* {@link HttpVersion#isKeepAliveDefault()}.
|
||||||
@ -103,7 +103,7 @@ public final class HttpUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the length of the content. Please note that this value is
|
* Returns the length of the content. Please note that this value is
|
||||||
* not retrieved from {@link HttpContent#content()} but from the
|
* not retrieved from {@link HttpContent#content()} but from the
|
||||||
* {@code "Content-Length"} header, and thus they are independent from each
|
* {@code "Content-Length"} header, and thus they are independent from each
|
||||||
* other.
|
* other.
|
||||||
@ -132,7 +132,7 @@ public final class HttpUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the length of the content. Please note that this value is
|
* Returns the length of the content. Please note that this value is
|
||||||
* not retrieved from {@link HttpContent#content()} but from the
|
* not retrieved from {@link HttpContent#content()} but from the
|
||||||
* {@code "Content-Length"} header, and thus they are independent from each
|
* {@code "Content-Length"} header, and thus they are independent from each
|
||||||
* other.
|
* other.
|
||||||
@ -169,7 +169,7 @@ public final class HttpUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the content length of the specified web socket message. If the
|
* Returns the content length of the specified web socket message. If the
|
||||||
* specified message is not a web socket message, {@code -1} is returned.
|
* specified message is not a web socket message, {@code -1} is returned.
|
||||||
*/
|
*/
|
||||||
private static int getWebSocketContentLength(HttpMessage message) {
|
private static int getWebSocketContentLength(HttpMessage message) {
|
||||||
@ -236,7 +236,7 @@ public final class HttpUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets or removes the {@code "Expect: 100-continue"} header to / from the
|
* Sets or removes the {@code "Expect: 100-continue"} header to / from the
|
||||||
* specified message. If the specified {@code value} is {@code true},
|
* specified message. If the specified {@code value} is {@code true},
|
||||||
* the {@code "Expect: 100-continue"} header is set and all other previous
|
* the {@code "Expect: 100-continue"} header is set and all other previous
|
||||||
* {@code "Expect"} headers are removed. Otherwise, all {@code "Expect"}
|
* {@code "Expect"} headers are removed. Otherwise, all {@code "Expect"}
|
||||||
* headers are removed completely.
|
* headers are removed completely.
|
||||||
@ -259,6 +259,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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user