You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Sam Berlin (JIRA)" <ji...@apache.org> on 2008/02/29 23:49:51 UTC

[jira] Created: (HTTPCORE-152) Lack of NHttpRequestHandler breaks AsyncNHttpServiceHandler

Lack of NHttpRequestHandler breaks AsyncNHttpServiceHandler
-----------------------------------------------------------

                 Key: HTTPCORE-152
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-152
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore NIO
            Reporter: Sam Berlin


In AsyncNHttpServiceHandler.sendResponse, the connection is closed before the response is submitted.  The patch moves the submitResponse to before 'close', so that it correctly goes into the CLOSING state instead of CLOSED.  Also added a test to that broke before but now passes.  

Seperate from the fix is a new 'responseComplete' method that's called after an entity is fully written or immediately when submitting if there's no entity.  This is very useful for subclasses that want to hook into knowing when a response has been written.  There's no good way to do it w/o the hook because of the asynchronous nature of the sending.  (LimeWire, for example, uses to notify listeners when a response is sent and to add an event for triggering a read if there was buffered read data, since the underlying NIO layer doesn't do it automatically.)

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCORE-152) Lack of NHttpRequestHandler breaks AsyncNHttpServiceHandler

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-152.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.0-beta2

Patch checked in. Many thanks, Sam. I took liberty of changing the signature of the responseComplete method from #responseComplete(NHttpServerConnection conn, HttpResponse response) to #responseComplete(HttpResponse response, HttpContext context). I think this way it is more consistent with the rest of API and one can always obtain the connection from the context.

Oleg

> Lack of NHttpRequestHandler breaks AsyncNHttpServiceHandler
> -----------------------------------------------------------
>
>                 Key: HTTPCORE-152
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-152
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>            Reporter: Sam Berlin
>             Fix For: 4.0-beta2
>
>         Attachments: changes.txt
>
>
> In AsyncNHttpServiceHandler.sendResponse, the connection is closed before the response is submitted.  The patch moves the submitResponse to before 'close', so that it correctly goes into the CLOSING state instead of CLOSED.  Also added a test to that broke before but now passes.  
> Seperate from the fix is a new 'responseComplete' method that's called after an entity is fully written or immediately when submitting if there's no entity.  This is very useful for subclasses that want to hook into knowing when a response has been written.  There's no good way to do it w/o the hook because of the asynchronous nature of the sending.  (LimeWire, for example, uses to notify listeners when a response is sent and to add an event for triggering a read if there was buffered read data, since the underlying NIO layer doesn't do it automatically.)

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCORE-152) Lack of NHttpRequestHandler breaks AsyncNHttpServiceHandler

Posted by "Sam Berlin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sam Berlin updated HTTPCORE-152:
--------------------------------

    Attachment: changes.txt

Patch w/ fixes.

> Lack of NHttpRequestHandler breaks AsyncNHttpServiceHandler
> -----------------------------------------------------------
>
>                 Key: HTTPCORE-152
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-152
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>            Reporter: Sam Berlin
>         Attachments: changes.txt
>
>
> In AsyncNHttpServiceHandler.sendResponse, the connection is closed before the response is submitted.  The patch moves the submitResponse to before 'close', so that it correctly goes into the CLOSING state instead of CLOSED.  Also added a test to that broke before but now passes.  
> Seperate from the fix is a new 'responseComplete' method that's called after an entity is fully written or immediately when submitting if there's no entity.  This is very useful for subclasses that want to hook into knowing when a response has been written.  There's no good way to do it w/o the hook because of the asynchronous nature of the sending.  (LimeWire, for example, uses to notify listeners when a response is sent and to add an event for triggering a read if there was buffered read data, since the underlying NIO layer doesn't do it automatically.)

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org