## com.sun.jersey.api
Class JResponse.JResponseBuilder<E>

    java.lang.Object
      com.sun.jersey.api.JResponse.AJResponseBuilder<E,JResponse.JResponseBuilder<E>>
          com.sun.jersey.api.JResponse.JResponseBuilder<E>

Type Parameters:
  `E` - The entity type

Enclosing class:
  JResponse<E>

    public static final class JResponse.JResponseBuilder<E>

extends JResponse.AJResponseBuilder<E,JResponse.JResponseBuilder<E>>

A class used to build `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`.

Field Summary

Fields inherited from class com.sun.jersey.api.JResponse.AJResponseBuilder
`entity, headers, statusType`

Constructor Summary
`JResponse.JResponseBuilder()` Default constructor.
`JResponse.JResponseBuilder(JResponse.JResponseBuilder<E> that)` Construct a shallow copy.

Method Summary
`JResponse<E>` | `build()` Create a `JResponse` instance from the current JResponseBuilder.
`JResponse.JResponseBuilder<E>` | `clone()` Create a shallow copy preserving state.

Methods inherited from class com.sun.jersey.api.JResponse.AJResponseBuilder
`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`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JResponse.JResponseBuilder

    public JResponse.JResponseBuilder()

  Default constructor.

### JResponse.JResponseBuilder

    public JResponse.JResponseBuilder(JResponse.JResponseBuilder<E> that)

  Construct a shallow copy. The metadata map will be copied but not the key/value references.

  Parameters:
    `that` - the JResponseBuilder to copy from.

Method Detail

### clone

    public JResponse.JResponseBuilder<E> clone()

  Create a shallow copy preserving state. The metadata map will be copied but not the key/value references.

  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    the copy.

### build

    public JResponse<E> build()

  Create a `JResponse` instance from the current JResponseBuilder. The builder is reset to a blank state equivalent to calling `JResponse.ok()`.

  Returns:
    a JResponse instance

Copyright © 2017 Oracle Corporation. All Rights Reserved.