WebServerDispatcher.Resource.Builder


public class WebServerDispatcher.Resource.Builder


Builder for Resource.

Summary

Public constructors

Constructs an instance.

Public methods

WebServerDispatcher.Resource

Builds the Resource.

WebServerDispatcher.Resource.Builder
@CanIgnoreReturnValue
resolvesToUnknownLength(boolean resolvesToUnknownLength)

Sets if the server shouldn't include the resource length in header responses.

WebServerDispatcher.Resource.Builder

Sets the data served by this resource.

WebServerDispatcher.Resource.Builder

Sets the extra response headers that should be attached.

WebServerDispatcher.Resource.Builder

Sets the level of gzip support for this resource.

WebServerDispatcher.Resource.Builder

Sets the path this data should be served at.

WebServerDispatcher.Resource.Builder
@CanIgnoreReturnValue
supportsRangeRequests(boolean supportsRangeRequests)

Sets if RFC 7233 range requests should be supported for this resource.

Public constructors

Builder

public Builder()

Constructs an instance.

Public methods

build

public WebServerDispatcher.Resource build()

Builds the Resource.

resolvesToUnknownLength

@CanIgnoreReturnValue
public WebServerDispatcher.Resource.Builder resolvesToUnknownLength(boolean resolvesToUnknownLength)

Sets if the server shouldn't include the resource length in header responses.

If true, responses to unbound requests won't include a Content-Length header and Content-Range headers won't include the total resource length.

Returns
WebServerDispatcher.Resource.Builder

this builder, for convenience.

setData

@CanIgnoreReturnValue
public WebServerDispatcher.Resource.Builder setData(byte[] data)

Sets the data served by this resource. This is required.

Returns
WebServerDispatcher.Resource.Builder

this builder, for convenience.

setExtraResponseHeaders

@CanIgnoreReturnValue
public WebServerDispatcher.Resource.Builder setExtraResponseHeaders(Multimap<StringString> extraResponseHeaders)

Sets the extra response headers that should be attached.

Returns
WebServerDispatcher.Resource.Builder

this builder, for convenience.

setGzipSupport

@CanIgnoreReturnValue
public WebServerDispatcher.Resource.Builder setGzipSupport(int gzipSupport)

Sets the level of gzip support for this resource. Defaults to GZIP_SUPPORT_DISABLED.

Returns
WebServerDispatcher.Resource.Builder

this builder, for convenience.

setPath

@CanIgnoreReturnValue
public WebServerDispatcher.Resource.Builder setPath(String path)

Sets the path this data should be served at. This is required.

Returns
WebServerDispatcher.Resource.Builder

this builder, for convenience.

supportsRangeRequests

@CanIgnoreReturnValue
public WebServerDispatcher.Resource.Builder supportsRangeRequests(boolean supportsRangeRequests)

Sets if RFC 7233 range requests should be supported for this resource. Defaults to false.

Returns
WebServerDispatcher.Resource.Builder

this builder, for convenience.