实验了一上午,终于可以使用jersey输出cookie了.
@POST
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@SecureValid
public Response getUserPost(@Context UriInfo context) {
URI createdUri = context.getAbsolutePath();
NewCookie nc = new NewCookie("token","tokencode1","/","","",-1,false);
return Response.created(createdUri).cookie(nc).build();
}
这样建立完cookie后,效果如下.