jersey学习笔记之AOP环境下COOKIE的写入

 实验了一上午,终于可以使用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后,效果如下.


 

 

你可能感兴趣的:(REST)