Re: is there a way to get the hostname:port and IP address

2013-03-17 Thread Bob Harner
The Tapestry-related answer is that Tapestry provides an injectable
service, Request [1],  that is a shadow of the current thread's
HTTPServletRequest [2]:

import org.apache.tapestry5.services.Request;
@Inject
Request request;
public String getRemoteHost() {
return request.getRemoteHost();
}
public int getLocalPort() {
return request.getLocalPort();
}

but since Request only has a subset of the properties that
HTTPServletRequest offers, for many purposes you'll need to directly
access HTTPServletRequest directly, which you can also inject:

import javax.servlet.http.HttpServletRequest;
@Inject
private HttpServletRequest httpServletRequest;
public String getRemoteAddr() {
return httpServletRequest.getRemoteAddr();
}

Be sure the servlet API is on your classpath. If using Maven, for example:

!-- Provided by the servlet container, but sometimes referenced in
the application code. --
dependency
groupIdjavax.servlet/groupId
artifactIdservlet-api/artifactId
version2.5/version
scopeprovided/scope
/dependency

Also note that if you have a separate web server (e.g. Apache HTTP)
in front of your app server, it may or may not be configured to pass
the correct client information to the app.

[1] 
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/Request.html
[2] 
http://docs.oracle.com/javaee/5/api/javax/servlet/http/HttpServletRequest.html

On Sat, Mar 16, 2013 at 5:32 PM, Ivan Khalopik ikhalo...@gmail.com wrote:
 It is not a tapestry question.

 http://docs.oracle.com/javaee/5/api/javax/servlet/ServletRequest.html

 On Sat, Mar 16, 2013 at 11:42 PM, nhhockeyplayer nashua
 nhhockeypla...@hotmail.com wrote:
 Folks,

 I want to track my users. Is there a way to get host:port and ip ?

 Best regards
 and thanks... KEN



 --
 BR
 Ivan

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



RE: is there a way to get the hostname:port and IP address

2013-03-17 Thread nhhockeyplayer nashua
Thanks Bob... awesome answer... blows the others right off the boards.

I wish your development opens up for a breakout and terrific designs to follow.

- cheers

Best regards 
and thanks... KEN

From: nhhockeypla...@hotmail.com
To: users@tapestry.apache.org
Subject: is there a way to get the hostname:port and IP address
Date: Sat, 16 Mar 2013 16:42:41 -0400




Folks,

I want to track my users. Is there a way to get host:port and ip ?

Best regards 
and thanks... KEN   
  

is there a way to get the hostname:port and IP address

2013-03-16 Thread nhhockeyplayer nashua
Folks,

I want to track my users. Is there a way to get host:port and ip ?

Best regards 
and thanks... KEN 

Re: is there a way to get the hostname:port and IP address

2013-03-16 Thread Ivan Khalopik
It is not a tapestry question.

http://docs.oracle.com/javaee/5/api/javax/servlet/ServletRequest.html

On Sat, Mar 16, 2013 at 11:42 PM, nhhockeyplayer nashua
nhhockeypla...@hotmail.com wrote:
 Folks,

 I want to track my users. Is there a way to get host:port and ip ?

 Best regards
 and thanks... KEN



-- 
BR
Ivan

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org