WebServerDispatcher.Resource
public final class WebServerDispatcher.Resource
A resource served by WebServerDispatcher.
Summary
Nested types |
|---|
public final class WebServerDispatcher.Resource.BuilderBuilder for |
Constants |
|
|---|---|
static final int |
The server doesn't support gzip. |
static final int |
The server supports gzip. |
static final int |
The server supports gzip. |
Public fields |
|
|---|---|
final byte[] |
|
ImmutableListMultimap<String, String> |
|
final int |
|
final int |
|
final String |
|
final byte[] |
|
final ImmutableListMultimap<String, String> |
Public methods |
|
|---|---|
WebServerDispatcher.Resource.Builder |
Returns a new |
byte[] |
getData()Returns the data served by this resource. |
ImmutableListMultimap<String, String> |
Returns the extra response headers that should be attached. |
int |
Returns the level of gzip support the server should provide for this resource. |
int |
The HTTP method that should be used to request the resource. |
String |
getPath()Returns the path this resource is available at. |
byte[] |
The body that should be included in a request for the resource. |
ImmutableListMultimap<String, String> |
The headers that should be included in a request for the resource. |
boolean |
Returns true if RFC 7233 HTTP 206 responses should include a |
boolean |
Returns true if the resource should resolve to an unknown length. |
boolean |
Returns true if RFC 7233 range requests should be supported for this resource. |
Constants
GZIP_SUPPORT_DISABLED
public static final int GZIP_SUPPORT_DISABLED = 1
The server doesn't support gzip.
GZIP_SUPPORT_ENABLED
public static final int GZIP_SUPPORT_ENABLED = 2
The server supports gzip. Responses are only compressed if the request signals "gzip" is an acceptable content-coding using an Accept-Encoding header.
GZIP_SUPPORT_FORCED
public static final int GZIP_SUPPORT_FORCED = 3
The server supports gzip. Responses are compressed if the request contains no
Accept-Encoding header or one that accepts "gzip".
RFC 2616 14.3 recommends a server use "identity" content-coding if no
Accept-Encoding is present, but some servers will still compress responses in this case. This option mimics that behaviour.
Public fields
Public methods
buildUpon
public WebServerDispatcher.Resource.Builder buildUpon()
Returns a new Builder initialized with the values from this instance.
getExtraResponseHeaders
public ImmutableListMultimap<String, String> getExtraResponseHeaders()
Returns the extra response headers that should be attached.
getGzipSupport
public int getGzipSupport()
Returns the level of gzip support the server should provide for this resource.
getHttpMethod
@DataSpec.HttpMethod
public int getHttpMethod()
The HTTP method that should be used to request the resource.
getRequestBody
public byte[] getRequestBody()
The body that should be included in a request for the resource.
getRequestHeaders
public ImmutableListMultimap<String, String> getRequestHeaders()
The headers that should be included in a request for the resource.
includesContentLengthInRangeResponses
public boolean includesContentLengthInRangeResponses()
Returns true if RFC 7233 HTTP 206 responses should include a Content-Length header.
resolvesToUnknownLength
public boolean resolvesToUnknownLength()
Returns true if the resource should resolve to an unknown length.
supportsRangeRequests
public boolean supportsRangeRequests()
Returns true if RFC 7233 range requests should be supported for this resource.