天天看點

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後,效果如下.

jersey學習筆記之AOP環境下COOKIE的寫入

繼續閱讀