# WebServerDispatcher.Resource

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/WebServerDispatcher.java+class:androidx.media3.test.utils.WebServerDispatcher.Resource)

*** ** * ** ***


```
public final class WebServerDispatcher.Resource
```

<br />

*** ** * ** ***

A resource served by `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher`.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource.Builder` Builder for `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource`. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#GZIP_SUPPORT_DISABLED() = 1` The server doesn't support gzip. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#GZIP_SUPPORT_ENABLED() = 2` The server supports gzip. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#GZIP_SUPPORT_FORCED() = 3` The server supports gzip. |

| ### Public fields |
|---|---|
| `final byte[]` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#data()` |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableListMultimap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#extraResponseHeaders()` |
| `final int` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#gzipSupport()` |
| `final int` | `@https://developer.android.com/reference/androidx/media3/datasource/DataSpec.HttpMethod https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#httpMethod()` |
| `final int` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#nonRangeResponseCode()` |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#path()` |
| `final byte[]` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#requestBody()` |
| `final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableListMultimap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#requestHeaders()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource.Builder` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#buildUpon()()` Returns a new `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource.Builder` initialized with the values from this instance. |
| `byte[]` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#getData()()` Returns the data served by this resource. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableListMultimap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#getExtraResponseHeaders()()` Returns the extra response headers that should be attached. |
| `int` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#getGzipSupport()()` Returns the level of gzip support the server should provide for this resource. |
| `int` | `@https://developer.android.com/reference/androidx/media3/datasource/DataSpec.HttpMethod https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#getHttpMethod()()` The HTTP method that should be used to request the resource. |
| `int` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#getNonRangeResponseCode()()` The HTTP response code when a range is not supported or not requested. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#getPath()()` Returns the path this resource is available at. |
| `byte[]` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#getRequestBody()()` The body that should be included in a request for the resource. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableListMultimap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#getRequestHeaders()()` The headers that should be included in a request for the resource. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#includesContentLengthInRangeResponses()()` Returns true if RFC 7233 HTTP 206 responses should include a `Content-Length` header. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#resolvesToUnknownLength()()` Returns true if the resource should resolve to an unknown length. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource#supportsRangeRequests()()` 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<String, String> extraResponseHeaders
```

### gzipSupport

```
public final int gzipSupport
```

### httpMethod

```
@DataSpec.HttpMethod
public final int httpMethod
```

### nonRangeResponseCode

```
public final int nonRangeResponseCode
```

### path

```
public final String path
```

### requestBody

```
public final byte[] requestBody
```

### requestHeaders

```
public final ImmutableListMultimap<String, String> requestHeaders
```

## Public methods

### buildUpon

```
public WebServerDispatcher.Resource.Builder buildUpon()
```

Returns a new `https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource.Builder` initialized with the values from this instance.

### getData

```
public byte[] getData()
```

Returns the data served by this resource.

### 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.

### getNonRangeResponseCode

```
public int getNonRangeResponseCode()
```

The HTTP response code when a range is not supported or not requested.

### getPath

```
public String getPath()
```

Returns the path this resource is available at.

### 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.