Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Servlet response failure detection

This is discouraged.

As you have discovered, there are many layers between your code on the servlet side and the implementation of generating and sending back the response to the client.
Each layer can consume the the response content buffer from the servlet entirely, making it highly unreliable to test for errors at the servlet side.
(this generalization includes Jetty, JVM, OS, and networking level layers)

Question is, why do you need to do this?


--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Developer advice, services and support
from the Jetty & CometD experts


On Tue, Apr 16, 2013 at 10:37 AM, T C <mandor_allen@xxxxxxxxxxx> wrote:
Hi there,
 
I'm working on something that uses jetty to respond to http requests, and I'm stuck on a problem and could really use some advice/help. I hope this is the right place to ask.
 
My issue is that I would like to know if the response generated any errors or exceptions when it gets sent to the client. From what I can tell, it seems that jetty handles the actual sending of the response, so I'm not quite sure what to do. I tried writing the response directly to the output stream from the ContainerResponse and then flushing it, and managed to catch an exception this way, but this basically bypasses any processing jetty might do before actually sending the response, which seems pretty dangerous to me.
 
I know that there is no guarantee that sending a response will generate an exception if the client is no longer connected, but in this specific case, I know it is generating an exception. I just can't figure out how I can retrieve it. Is there some way of setting a callback, or retrieving an error code related to a particular response?
 
 
Thanks,
 
Mandor

_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev



Back to the top