Package it.unimi.dsi.law.warc.util
Class MetadataHttpResponse
java.lang.Object
it.unimi.dsi.law.warc.util.AbstractHttpResponse
it.unimi.dsi.law.warc.util.MetadataHttpResponse
- All Implemented Interfaces:
HttpResponse
,Response
- Direct Known Subclasses:
MutableHttpResponse
,WarcHttpResponse
public abstract class MetadataHttpResponse extends AbstractHttpResponse
An abstract extention of
AbstractHttpResponse
which additionally provides support
for getting and setting metadata (i.e., uri()
, statusLine()
, status()
and headers()
).-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MetadataHttpResponse.HeaderMap
A special map used for headers: keys are case-insensitive, and multiple puts are converted into comma-separated values. -
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>
headerMap
The header map.protected org.apache.http.StatusLine
statusLine
The status line of this response.protected URI
uri
The URI that is currently contained in this response.Fields inherited from class it.unimi.dsi.law.warc.util.AbstractHttpResponse
random
Fields inherited from interface it.unimi.dsi.law.warc.util.HttpResponse
DIGEST_HEADER, GUESSED_CHARSET_HEADER, HEADER_CHARSET, ISDUPLICATE_HEADER
-
Constructor Summary
Constructors Constructor Description MetadataHttpResponse()
-
Method Summary
Modifier and Type Method Description Map<String,String>
headers()
Returns the headers of this response.void
headers(Object2ObjectMap<String,String> headerMap)
Sets the headers.int
status()
Returns the response status.org.apache.http.StatusLine
statusLine()
Returns the response status line.void
statusLine(org.apache.http.StatusLine statusLine)
Sets the status lineURI
uri()
Returns the URI associated with this response.void
uri(URI url)
Sets the url.Methods inherited from class it.unimi.dsi.law.warc.util.AbstractHttpResponse
toWarcRecord
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface it.unimi.dsi.law.warc.util.HttpResponse
contentAsStream
Methods inherited from interface it.unimi.dsi.law.warc.util.Response
fromWarcRecord
-
Field Details
-
uri
The URI that is currently contained in this response. -
statusLine
protected org.apache.http.StatusLine statusLineThe status line of this response. -
headerMap
The header map.
-
-
Constructor Details
-
MetadataHttpResponse
public MetadataHttpResponse()
-
-
Method Details
-
uri
Description copied from interface:Response
Returns the URI associated with this response.- Returns:
- the URI associated with this response.
-
status
public int status()Description copied from interface:HttpResponse
Returns the response status.- Returns:
- the status of this response.
-
statusLine
public org.apache.http.StatusLine statusLine()Description copied from interface:HttpResponse
Returns the response status line.- Returns:
- the status line of this response.
-
headers
Description copied from interface:HttpResponse
Returns the headers of this response.Warning: as of LAW 3.0, and contrarily to previous behaviour, the map is case-sensitive. Use the predefined names in
HttpHeaders
orHttpHeaders
to avoid typing and casing mistakes.- Returns:
- the headers of this response.
-
uri
Sets the url.- Parameters:
url
- the url.
-
statusLine
public void statusLine(org.apache.http.StatusLine statusLine)Sets the status line- Parameters:
statusLine
- the status line.
-
headers
Sets the headers.- Parameters:
headerMap
- the content (it may benull
, in this case the headers will be left empty).
-