关于 CXF、JAX-RS Web 服务的请求和会话的问题
我有一个使用 CXF、JAX-RS 和 Spring 设置的 Web 服务。我有以下方法:
@GET
@Path("/getPayload")
@Produces("application/XML")
public Response makePayload(){
Payload payload = new Payload();
payload.setUsersOnline(new Long(200));
return Response.ok().entity(payload).build();
}
如何访问 makePayload()
中的 HttpRequest
对象?
对此方法的调用是否会生成一个会话?如果是,我可以获得它的句柄吗?该会话对于来自同一客户端的所有后续请求是否会持续存在?
I have a webservice set up using CXF, JAX-RS and Spring. I have the following method:
@GET
@Path("/getPayload")
@Produces("application/XML")
public Response makePayload(){
Payload payload = new Payload();
payload.setUsersOnline(new Long(200));
return Response.ok().entity(payload).build();
}
How can I get access to the HttpRequest
object in my makePayload()
?
Will a call to this method generate a Session, and if so, can I get a handle to it and will that session be persistent for all subsequent requests from the same client?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@Context
可用于获取与请求或响应相关的上下文 Java 类型:@Context
can be used to obtain contextual Java types related to the request or response: