Skip to content
This repository was archived by the owner on Nov 7, 2020. It is now read-only.

Commit a3e3039

Browse files
author
212675392
committed
Added javadocs for the request content block.
1 parent d007571 commit a3e3039

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

WarcReader/src/com/morethanheroic/warc/service/content/request/domain/RequestContentBlock.java

+35-2
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,69 @@
44
import java.io.InputStream;
55
import java.util.Collections;
66
import java.util.Map;
7+
import java.util.Optional;
78
import lombok.Builder;
89
import lombok.Getter;
910

1011
@Builder
1112
public class RequestContentBlock implements WarcContentBlock {
1213

14+
/**
15+
* the http method used in the request.
16+
*
17+
* @see <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods">
18+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods</a>
19+
*/
1320
@Getter
1421
private final String method;
1522

23+
/**
24+
* The target location of the request.
25+
*/
1626
@Getter
1727
private final String location;
1828

29+
/**
30+
* The payload of the request.
31+
*/
1932
@Getter
2033
private final InputStream payload;
2134

35+
/**
36+
* The protocol used for the request.
37+
*/
2238
@Getter
2339
private final String protocol;
2440

41+
/**
42+
* The major protocol version of the request.
43+
*/
2544
@Getter
2645
private final int majorProtocolVersion;
2746

47+
/**
48+
* The minor protocol version of the request.
49+
*/
2850
@Getter
2951
private final int minorProtocolVersion;
3052

3153
private final Map<String, String> headers;
3254

33-
public String getHeader(final String headerName) {
34-
return headers.get(headerName);
55+
/**
56+
* Return a value of a header from the request.
57+
*
58+
* @param headerName the name of the header to get the value for
59+
* @return the value of the header
60+
*/
61+
public Optional<String> getHeader(final String headerName) {
62+
return Optional.ofNullable(headers.get(headerName));
3563
}
3664

65+
/**
66+
* Return all of the headers of a WARC request.
67+
*
68+
* @return the headers of the response
69+
*/
3770
public Map<String, String> getHeaders() {
3871
return Collections.unmodifiableMap(headers);
3972
}

0 commit comments

Comments
 (0)