Return-Path: Delivered-To: apmail-jakarta-httpcomponents-dev-archive@www.apache.org Received: (qmail 45203 invoked from network); 29 Aug 2007 05:10:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Aug 2007 05:10:06 -0000 Received: (qmail 75512 invoked by uid 500); 29 Aug 2007 05:10:01 -0000 Delivered-To: apmail-jakarta-httpcomponents-dev-archive@jakarta.apache.org Received: (qmail 75493 invoked by uid 500); 29 Aug 2007 05:10:01 -0000 Mailing-List: contact httpcomponents-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list httpcomponents-dev@jakarta.apache.org Received: (qmail 75484 invoked by uid 99); 29 Aug 2007 05:10:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Aug 2007 22:10:01 -0700 X-ASF-Spam-Status: No, hits=-97.1 required=10.0 tests=ALL_TRUSTED,URIBL_BLACK,URIBL_RHS_DOB X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Aug 2007 05:10:49 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8E4CC7141F2 for ; Tue, 28 Aug 2007 22:09:31 -0700 (PDT) Message-ID: <32218536.1188364171579.JavaMail.jira@brutus> Date: Tue, 28 Aug 2007 22:09:31 -0700 (PDT) From: "Hubert Sieh (JIRA)" To: httpcomponents-dev@jakarta.apache.org Subject: [jira] Commented: (HTTPCORE-111) Provide method to get remote_ip, URI and status In-Reply-To: <12386771.1188257851503.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on 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