You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Hubert Sieh (JIRA)" <ji...@apache.org> on 2007/08/28 01:37:31 UTC
[jira] Created: (HTTPCORE-111) Provide method to get remote_ip, URI
and status
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: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Commented: (HTTPCORE-111) Provide method to get remote_ip,
URI and status
Posted by "Hubert Sieh (JIRA)" <ji...@apache.org>.
[ 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: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Closed: (HTTPCORE-111) Provide method to get remote_ip, URI
and status
Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Roland Weber closed HTTPCORE-111.
---------------------------------
Resolution: Invalid
I'd guess the getRemoteAddress() is the one that returned null after the connection is closed.
cheers,
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: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
[jira] Commented: (HTTPCORE-111) Provide method to get remote_ip,
URI and status
Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523289 ]
Roland Weber commented on HTTPCORE-111:
---------------------------------------
Hello Hubert,
the remote IP address is available from a connection that implements the optional interface HttpInetConnection.
HttpRequestHandler.handleRequest has an HttpContext argument, the connection should be available in the context.
Please provide details of "some IO Exception".
Our NIO expert should be back next week and will probably be able to help you then.
cheers,
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: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org