Response API
accepted()
Creates a new ResponseBuilder with an accepted status
created()
Creates a new ResponseBuilder for a created resource (with its URI)
noContent()
Creates a new ResponseBuilder for an empty response
notModified()
Creates a new ResponseBuilder with a not-modified status
ok()
Creates a new ResponseBuilder with an ok status
serverError()
Creates a new ResponseBuilder with an server error status
status()
Creates a new ResponseBuilder with the supplied status
temporaryRedirect()
Creates a new ResponseBuilder for a temporary redirection
getCookies()
Gets the cookies from the response message
getHeaders()
Gets the headers from the response message
getLinks()
Get the links attached to the message as header
getStatus()
Get the status code associated with the response
readEntity()
Read the message entity as an instance of specified Java type using a
MessageBodyReader that supports mapping the message onto the requested type
Examples
Response.ok().build();
Response.ok().cookie(new NewCookie("SessionID", "145791444df")).build();
Response.ok("Plain Text").expires(new Date()).build();
Response.ok(new Item ("Pen", "90"), MediaType.APPLICATION_JSON).build();
Response.noContent().build();
Response.accepted(new Item("Pen", "70", "hello@gmail.com", "1122")).build();
Response.notModified().header("User-Agent", "Chrome").build();
Ref : Beginning JavaEE7