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

Hi Joakim,
 
Basically, we store some data on our servers, and the client makes requests to retrieve the data. Once it is retrieved, I'd like to either remove it from our servers, or flag it so that it won't get resent on a subsequent request. That's why I was hoping to detect if the response was successfully sent.
 
Mandor
 

Date: Tue, 16 Apr 2013 10:48:58 -0700
From: joakim@xxxxxxxxxxx
To: jetty-dev@xxxxxxxxxxx
Subject: 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



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

Back to the top