WebServerDispatcher.Resource


public class WebServerDispatcher.Resource


A resource served by WebServerDispatcher.

Summary

Nested types

Builder for Resource.

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<StringString>
final int
final String

Public methods

WebServerDispatcher.Resource.Builder

Returns a new Builder initialized with the values from this instance.

byte[]

Returns the data served by this resource.

ImmutableListMultimap<StringString>

Returns the extra response headers that should be attached.

int

Returns the level of gzip support the server should provide for this resource.

String

Returns the path this resource is available at.

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

data

public final byte[] data

extraResponseHeaders

public ImmutableListMultimap<StringStringextraResponseHeaders

gzipSupport

public final int gzipSupport

path

public final String path

Public methods

buildUpon

public WebServerDispatcher.Resource.Builder buildUpon()

Returns a new Builder initialized with the values from this instance.

getData

public byte[] getData()

Returns the data served by this resource.

getExtraResponseHeaders

public ImmutableListMultimap<StringStringgetExtraResponseHeaders()

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.

getPath

public String getPath()

Returns the path this resource is available at.

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.