Class Response.ResponseBuilder

java.lang.Object
jakarta.ws.rs.core.Response.ResponseBuilder
Enclosing class:
Response

public abstract static class Response.ResponseBuilder extends Object
A class used to build Response instances that contain metadata instead of or in addition to an entity. An initial instance may be obtained via static methods of the Response class, instance methods provide the ability to set metadata. E.g. to create a response that indicates the creation of a new resource:
 @POST
 Response addWidget(...) {
   Widget w = ...
   URI widgetId = UriBuilder.fromResource(Widget.class)...
   return Response.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 Response.