public final class ContainerRequestBuilder extends Object
ContainerRequest
instances.Modifier and Type | Method and Description |
---|---|
ContainerRequestBuilder |
accept(javax.ws.rs.core.MediaType... mediaTypes)
Add the accepted response media types.
|
ContainerRequestBuilder |
accept(String... mediaTypes)
Add the accepted response media types.
|
ContainerRequest |
build()
Build a Jersey container request context.
|
ContainerRequestBuilder |
cookie(javax.ws.rs.core.Cookie cookie)
Add a cookie to be set.
|
ContainerRequestBuilder |
cookies(javax.ws.rs.core.Cookie... cookies)
Add cookies to be set.
|
ContainerRequestBuilder |
entity(InputStream stream)
Set the request entity input stream.
|
ContainerRequestBuilder |
entity(Object entity,
ApplicationHandler handler)
Set the request entity and entity input stream.
|
ContainerRequestBuilder |
entity(Object entity,
MessageBodyWorkers workers)
Set the request entity and entity input stream.
|
static ContainerRequestBuilder |
from(String requestUri,
String method)
Create new Jersey container request context builder.
|
static ContainerRequestBuilder |
from(String baseUri,
String requestUri,
String method)
Create new Jersey container request context builder.
|
static ContainerRequestBuilder |
from(String baseUri,
String requestUri,
String method,
javax.ws.rs.core.SecurityContext securityContext,
org.glassfish.jersey.internal.PropertiesDelegate propertiesDelegate)
Create new Jersey container request context builder.
|
static ContainerRequestBuilder |
from(URI requestUri,
String method)
Create new Jersey container request context builder.
|
static ContainerRequestBuilder |
from(URI baseUri,
URI requestUri,
String method)
Create new Jersey container request context builder.
|
static ContainerRequestBuilder |
from(URI baseUri,
URI requestUri,
String method,
javax.ws.rs.core.SecurityContext securityContext,
org.glassfish.jersey.internal.PropertiesDelegate propertiesDelegate)
Create new Jersey container request context builder.
|
ContainerRequestBuilder |
header(String name,
Object value)
Add an arbitrary header.
|
ContainerRequestBuilder |
type(javax.ws.rs.core.MediaType contentType)
Add content type of the entity.
|
ContainerRequestBuilder |
type(String contentType)
Add content type of the entity.
|
public static ContainerRequestBuilder from(String requestUri, String method)
requestUri
- request URI.method
- request HTTP method name.public static ContainerRequestBuilder from(String baseUri, String requestUri, String method)
baseUri
- base application URI.requestUri
- request URI.method
- request HTTP method name.public static ContainerRequestBuilder from(String baseUri, String requestUri, String method, javax.ws.rs.core.SecurityContext securityContext, org.glassfish.jersey.internal.PropertiesDelegate propertiesDelegate)
baseUri
- base application URI.requestUri
- request URI.method
- request HTTP method name.securityContext
- security context of the current request. May be null
.
The SecurityContext.getUserPrincipal()
must return null
if the current request
has not been authenticated by the container.propertiesDelegate
- custom properties delegate
to be used by the context, may be
null
.public static ContainerRequestBuilder from(URI requestUri, String method)
requestUri
- request URI.method
- request HTTP method name.public static ContainerRequestBuilder from(URI baseUri, URI requestUri, String method)
baseUri
- base application URI.requestUri
- request URI.method
- request HTTP method name.public static ContainerRequestBuilder from(URI baseUri, URI requestUri, String method, javax.ws.rs.core.SecurityContext securityContext, org.glassfish.jersey.internal.PropertiesDelegate propertiesDelegate)
baseUri
- base application URI.requestUri
- request URI.method
- request HTTP method name.securityContext
- security context of the current request. May be null
.
The SecurityContext.getUserPrincipal()
must return null
if the current request
has not been authenticated by the container.propertiesDelegate
- custom properties delegate
to be used by the context, may be
null
.public ContainerRequest build()
ApplicationHandler.apply(org.glassfish.jersey.server.ContainerRequest)
method to obtain
response from Jersey.public ContainerRequestBuilder accept(String... mediaTypes)
mediaTypes
- accepted response media types. If cookie
is null
then all current headers of the same
name will be removed.public ContainerRequestBuilder accept(javax.ws.rs.core.MediaType... mediaTypes)
mediaTypes
- accepted response media types. If cookie
is null
then all current headers of the same
name will be removed.public ContainerRequestBuilder entity(InputStream stream)
null
values are ignored.stream
- request entity input stream.public ContainerRequestBuilder entity(Object entity, MessageBodyWorkers workers)
null
values are ignored.
MessageBodyWorkers
are used to transform the object into entity input stream required
to process the request.
NOTE: Entity transformation into entity input stream doesn't have any impact on benchmarks.entity
- request entity instance.workers
- message body workers to transform entity into entity input stream.public ContainerRequestBuilder entity(Object entity, ApplicationHandler handler)
null
values are ignored.
ApplicationHandler
is required to obtain
MessageBodyWorkers
to transform the object into entity input stream used for
processing the request.
NOTE: Entity transformation into entity input stream doesn't have any impact on benchmarks.entity
- request entity instance.handler
- application handler to obtain message body workers from.public ContainerRequestBuilder type(String contentType)
contentType
- content media type.public ContainerRequestBuilder type(javax.ws.rs.core.MediaType contentType)
contentType
- content media type.public ContainerRequestBuilder header(String name, Object value)
name
- the name of the headervalue
- the value of the header, the header will be serialized
using a RuntimeDelegate.HeaderDelegate
if
one is available via RuntimeDelegate.createHeaderDelegate(java.lang.Class)
for the class of value
or using its toString
method
if a header delegate is not available. If value
is null
then all current headers of the same name will be removed.public ContainerRequestBuilder cookie(javax.ws.rs.core.Cookie cookie)
cookie
- to be set. If cookie
is null
then all current headers of the same name will be removed.public ContainerRequestBuilder cookies(javax.ws.rs.core.Cookie... cookies)
cookies
- to be set. If cookies
is null
then all current headers of the same name will be removed.Copyright © 2007-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.