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

Hubert Sieh commented on HTTPCORE-111:
--------------------------------------

You're right.  When I looked at the context.getAttribute method, I didn't see 
that it actually returned an Object, selectable by the constants. 

The IO Exception was actually not an IO Exception.  It was a 
NullPointerException.  The statements above were executed in the 
"connectionClosed" eventListener.  Presumably the getHttpRequest method 
returned null because the object was freed?

You can mark this as resolved/closed.  Thank you, Roland.

> Provide method to get remote_ip, URI and status
> -----------------------------------------------
>
>                 Key: HTTPCORE-111
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-111
>             Project: HttpComponents Core
>          Issue Type: New Feature
>          Components: HttpCore NIO
>    Affects Versions: 4.0-alpha5
>         Environment: Ubuntu Linux
>            Reporter: Hubert Sieh
>            Priority: Minor
>
> Following your example for the basic, non-blocking HTTP server, I am trying 
> to simulate the info that you would get from the standard apache httpd 
> daemon, e.g.  remote IP, URI and return code that is typically found in 
> access.log.
> First, I tried getting this information from the EventLogger/EventListener
>             if (conn instanceof DefaultNHttpServerConnection)
>             {
>               DefaultNHttpServerConnection d = (DefaultNHttpServerConnection) 
> conn;
>               logger.info("connection from " + 
> d.getRemoteAddress().getHostAddress());
>               logger.info("requested: " + 
> d.getHttpRequest().getRequestLine().getUri());
>               logger.info("responded: " + 
> d.getHttpResponse().getStatusLine().getStatusCode());
>             }
> ... but this causes some IO/Exception
> Second, I tried logging this from the handle method in your 
> HttpRequestHandler, but I do not see how I can get the remote IP address.
> Seems like I can get the remote IP from the eventlistener, but not the URI 
> and status code.
> Or I can get the URI and status code from the httprequesthandler, but not the 
> remote IP.
> Thanks.

-- 
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