java - jetty hangs on when accessing ServletRequest methods in async context -
i running code given in answer question-
servlet-3 async context, how asynchronous writes?
instead of response.getwriter().write(some_big_data); i've changed line
servletrequest req= ctx.getrequest(); response.getwriter().write(req.getcontenttype()); now, request timing out. how can access request object?
i'm assuming having problems using code snippet within own thread after startasync() call.
per servlet 3.0 spec, section 2.3.3.4, access request , response objects not thread-safe. in fact, depending on state of object lifecycle, request , response objects can recycled.
it encouraged grab need request , response objects before startasync() , use references own thread.
in other words, use of ctx.getrequest() , response.getwriter() should done before startasync()
Comments
Post a Comment