public final class

ResourceResponse

extends Object
java.lang.Object
   ↳ com.pspdfkit.document.html.ResourceResponse

Class Overview

Encapsulates resource response. Custom response can be returned in shouldInterceptRequest(ResourceRequest) to override HTML page loading.

Summary

Public Constructors
ResourceResponse(InputStream inputStream, String mimeType)
Constructs a resource response provided by the input stream.
ResourceResponse(InputStream inputStream, String mimeType, String charset)
Constructs a resource response provided by the input stream.
ResourceResponse(DataProvider dataProvider, String mimeType)
Constructs a resource response provided by the data provider.
ResourceResponse(DataProvider dataProvider, String mimeType, String charset)
Constructs a resource response provided by the data provider.
Public Methods
static ResourceResponse skipResource()
Constructs a resource response that skips resource loading.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ResourceResponse (InputStream inputStream, String mimeType)

Constructs a resource response provided by the input stream.

Note: The MIME type should not include character encoding. For example a single value like the "text/html; charset=utf-8" is not supported, use just "text/html" as a mime type. This method defaults to "utf-8" charset, if you wish to use different charset, use ResourceResponse(InputStream, String, String) instead.

Parameters
inputStream The input stream with the resource data.
mimeType The MIME type of the resource, for example "text/html".

public ResourceResponse (InputStream inputStream, String mimeType, String charset)

Constructs a resource response provided by the input stream.

Note: The MIME type should not include character encoding. For example a single value like the "text/html; charset=utf-8" is not supported, use just "text/html" as a mime type and specify the charset via ResourceResponse(DataProvider, String, String).

Use ResourceResponse(InputStream, String) for content that has no character encoding (such as image resources).

Parameters
inputStream The input stream with the resource data.
mimeType The MIME type of the resource, for example "text/html".
charset The character encoding of the resource, for example "utf-8".

public ResourceResponse (DataProvider dataProvider, String mimeType)

Constructs a resource response provided by the data provider.

Note: The MIME type should not include character encoding. For example a single value like the "text/html; charset=utf-8" is not supported, use just "text/html" as a mime type. This method defaults to "utf-8" charset, if you wish to use different charset, use ResourceResponse(DataProvider, String, String) instead.

Parameters
dataProvider The data provider with the resource data.
mimeType The MIME type of the resource, for example "text/html".

public ResourceResponse (DataProvider dataProvider, String mimeType, String charset)

Constructs a resource response provided by the data provider.

Note: The MIME type should not include character encoding. For example a single value like the "text/html; charset=utf-8" is not supported, use just "text/html" as a mime type and specify the charset via ResourceResponse(DataProvider, String, String).

Use ResourceResponse(DataProvider, String) for content that has no character encoding (such as image resources).

Parameters
dataProvider The data provider with the resource data.
mimeType The MIME type of the resource, for example "text/html".
charset The character encoding of the resource, for example "utf-8".

Public Methods

public static ResourceResponse skipResource ()

Constructs a resource response that skips resource loading.