rickilama54 / gwt-comet

Automatically exported from code.google.com/p/gwt-comet
0 stars 0 forks source link

Add attributes support to CometServletResponse #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be convenient to be able to set/get attributes on
CometServletResponse. In this way you can tie user specific information to
your pending response. Other threads are then able to use this information
accordingly.

I.e. in my AtmosphereAsyncServlet I am now keeping track of the pair of
AtmosphereResource and CometServletResponse in a static ConcurrentMap. If
anything goes wrong and I do not get the terminate properly, references to
these resource will be lingering around in this map. It would be much nicer
and easier if I could just set the resource as an attribute on
CometServletResponse.

Original issue reported on code.google.com by PierreHa...@gmail.com on 18 Mar 2010 at 2:35

GoogleCodeExporter commented 9 years ago
Oops missed this bug.

ServletRequest.setAttribute(String, Object) is used more for passing state 
through
the request dispatcher which is not what your doing here. I'll take a look at 
your
AtmosphereAsyncServlet and see if there is a better way of doing what you want.
Perhaps by adding another field to the CometServletResponseImpl.

Original comment by rich...@zschech.net on 28 Mar 2010 at 10:57

GoogleCodeExporter commented 9 years ago
Didn't seem to get notified of your comment...

Indeed the request attributes is a good place for this (this is what I do using 
Atmosphere) but you remove the request in the CometServletResponse before the 
suspend 
happens, so I cannot refer to the request anymore later on.

I think it is safe to leave the request on CometServletResponse, because this 
is what 
Servlet3.0 does and Atmosphere also does this. The request remains valid until 
the 
connection is closed.

Original comment by PierreHa...@gmail.com on 1 Apr 2010 at 9:28