{title:'org.apache.juneau.http.resource', created:'9.0.0'}

The {@link oaj.http.resource} package contains implementations of {@link oaj.http.resource.HttpResource} which are extensions of org.apache.http.HttpEntity with arbitrary headers added.

HttpResourceBuilder

HTTP entities are created through builders created in the {@link oaj.http.HttpResources} class or individual create() methods defined in the subclasses above. The builder contains the following methods:

Example

| import static org.apache.juneau.http.HttpResources.*; | | byte[] payload = {...}; | | // Create via type builder. | HttpResource resource = ByteArrayResource | .create() | .content(payload) | .contentType(ContentType.APPLICATION_OCTET_STREAM) | .build(); | | // Create via HttpResources. | HttpResource resource = byteArrayResource(payload, ContentType.APPLICATION_OCTET_STREAM).build();