Ask A Question
0

Is it safe to suspend a http servlet request in jersey?

Asked by forty-two on 08/14/2012 at 10:15 PM

Assuming a Jersey ContainerResponseFilter implementation like this:

public class MyFilter implements ContainerResponseFilter {
    @Context
    HttpServletRequest request;

    public ContainerRersponse(ContainerRequest req, ContainerResponse resp) {
       if (shouldBeAsync(resp) {
           AsyncContext ac = request.startAsync();
           ....
       }
       return resp;
    }
}

Is this at all safe? Does Jersey assume that processing the request and producing the response content is happening on the same thread? What can happen if another thread attempts to modify the response object?

I thought I'd just ask before submerging myself into jersey code.

View Full Answer On Stackoverflow

Responses

No responses yet. Be the first one!

    [Some content on this page is from Stackoverflow]