E
- The entity typepublic static final class JResponse.JResponseBuilder<E> extends JResponse.AJResponseBuilder<E,JResponse.JResponseBuilder<E>>
JResponse
instances that contain metadata
instead of or in addition to an entity. An initial instance may be
obtained via static methods of the JResponse
class, instance
methods provide the ability to set metadata. E.g. to create a response
that indicates the creation of a new resource:
@POST JResponse addWidget(...) { Widget w = ... URI widgetId = UriBuilder.fromResource(Widget.class)... return JResponse.created(widgetId).build(); }
Several methods have parameters of type URI, UriBuilder
provides convenient methods to create such values as does
URI.create()
.
Where multiple variants of the same method are provided, the type of
the supplied parameter is retained in the metadata of the built
JResponse
.
entity, headers, statusType
Constructor and Description |
---|
JResponse.JResponseBuilder()
Default constructor.
|
JResponse.JResponseBuilder(JResponse.JResponseBuilder<E> that)
Construct a shallow copy.
|
Modifier and Type | Method and Description |
---|---|
JResponse<E> |
build()
Create a
JResponse instance from the current JResponseBuilder. |
JResponse.JResponseBuilder<E> |
clone()
Create a shallow copy preserving state.
|
cacheControl, contentLocation, cookie, encoding, entity, expires, getEntity, getMetadata, getStatus, getStatusType, header, header, headerSingle, language, language, lastModified, location, reset, status, status, status, tag, tag, type, type, variant, variants
public JResponse.JResponseBuilder()
public JResponse.JResponseBuilder(JResponse.JResponseBuilder<E> that)
that
- the JResponseBuilder to copy from.public JResponse.JResponseBuilder<E> clone()
clone
in class java.lang.Object
public JResponse<E> build()
JResponse
instance from the current JResponseBuilder.
The builder is reset to a blank state equivalent to calling
JResponse.ok()
.Copyright © 2016 Oracle Corporation. All Rights Reserved.