Java Reference
In-Depth Information
public
public static
static ResponseBuilder ok ( Object entity , MediaType type ) {...}
public
public static
static ResponseBuilder ok ( Object entity , String type ) {...}
public
public static
static ResponseBuilder ok ( Object entity , Variant var ) {...}
public
public static
static ResponseBuilder serverError () {...}
public
public static
static ResponseBuilder created ( URI location ) {...}
public
public static
static ResponseBuilder noContent () {...}
public
public static
static ResponseBuilder notModified () {...}
public
public static
static ResponseBuilder notModified ( EntityTag tag ) {...}
public
public static
static ResponseBuilder notModified ( String tag ) {...}
public
public static
static ResponseBuilder seeOther ( URI location ) {...}
public
public static
static ResponseBuilder temporaryRedirect ( URI location ) {...}
public
public static
static ResponseBuilder notAcceptable ( List < Variant > variants ) {...}
public
public static
static ResponseBuilder fromResponse ( Response response ) {...}
...
}
If you want an explanation of each and every static helper method, the JAX-RS Javadocs are
a great place to look. They generally center on the most common use cases for creating cus-
tom responses. For example:
public
public static
static ResponseBuilder ok ( Object entity , MediaType type ) {...}
The ok() method here takes the Java object you want converted into an HTTP response and
the Content-Type of that response. It returns a preinitialized ResponseBuilder with a
status code of 200, “OK.” The other helper methods work in a similar way, setting appropri-
ate response codes and sometimes setting up response headers automatically.
The ResponseBuilder class is a factory that is used to create one individual Response in-
stance. You store up state you want to use to create your response and when you're finished,
you have the builder instantiate the Response :
public
public static
static abstract
abstract class
class ResponseBuilder
ResponseBuilder {
public
public abstract
abstract Response build ();
public
public abstract
abstract ResponseBuilder clone ();
public
public abstract
abstract ResponseBuilder status ( int
int status );
public
public ResponseBuilder status ( Status status ) {...}
public
public abstract
abstract ResponseBuilder entity ( Object entity );
public
public abstract
abstract ResponseBuilder type ( MediaType type );
public
public abstract
abstract ResponseBuilder type ( String type );
public
public abstract
abstract ResponseBuilder variant ( Variant variant );
public
public abstract
abstract ResponseBuilder variants ( List < Variant > variants );
Search WWH ::




Custom Search