How can I send a response code and content from a resource?

I am using Jax-RS and jersey to implement a web service, I can use the Response class to send an response code to the client:

Response.status(Status.MOVED_PERMANENTLY).build();

Or I can send Response content:

Response.ok("Respose").build();

Is there a way to send an arbitrary response for an arbitrary code?

Specifically I am trying to send the authorization code in a redirect for OAuth.


Take a look at this JAX-RS — How to return JSON and HTTP status code together?

Response.status(Response.Status.NOT_FOUND).entity("Hello World").build();

链接地址: http://www.djcxy.com/p/45580.html

上一篇: 泽西岛多个获得同一路径上的回应可能?

下一篇: 我如何从资源发送响应代码和内容?