[ 
https://issues.apache.org/jira/browse/HTTPCORE-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496117
 ] 

Oleg Kalnichevski commented on HTTPCORE-73:
-------------------------------------------

Steffen

I suspect it may not be possible to introduce this functionality without losing 
ability to pipeline HTTP messages. 

And I still do not see why exiting API is not sufficient for this use case. 
Consider the following sequence of events:

NHttpServiceHandler#outputReady contentCodec#completed -> false   
NHttpServiceHandler#outputReady contentCodec#completed -> false
NHttpServiceHandler#outputReady contentCodec#completed -> true // end of the 
last response body
NHttpServiceHandler#responseReady response == null // ready to submit new 
response

If you are not pipelining messages, just keep the last response in the 
connection context. The event handler can detect the end of the message when 
NHttpServiceHandler#outputReady event is fired and update the context 
accordingly. Once NHttpServiceHandler#responseReady has been fired you can 
obtain the last response from the context

Am I still missing something?

Oleg

> Add notification to NHttpServiceHandler when response has been sent
> -------------------------------------------------------------------
>
>                 Key: HTTPCORE-73
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-73
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha5
>            Reporter: Steffen Pingel
>
> Add a new method to NHttpServiceHandler that notifies the service handler 
> that a response has been sent: 
> void responseSubmitted(NHttpServerConnection conn); 
> The sent response can be retrieved through conn.getHttpResponse() when the 
> method is invoked. The use case here is that I need to enable and disable 
> throttling per response (which is handled by the underlying NIO layer) and 
> need to know at what point the output buffer for a response has been flushed. 
> The throttling is controlled in the application layer so I need to propagate 
> the event through the layers. 
> Such an event notification could also replace 
> NHttpServerConnection.isResponseSubmitted() which currently has an 
> implementation in DefaultNHttpServerConnection that does not match the 
> JavaDoc specification.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to