aspose file tools*
The moose likes Servlets and the fly likes how can get to know who Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how can get to know who" Watch "how can get to know who" New topic
Author

how can get to know who

bhagya patil
Greenhorn

Joined: Oct 14, 2007
Posts: 12
Hi,
In development environment we have tomcat services running
on our local machine.
How can we know if any one accsses my app from his browser in java?
like http://mymachine ort/my application from hi browser.

?
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

What do you mean accessing your app in browser in Java? Anyway, you can check the Tomcat access log for that. In order to enable the access log in Tomcat, edit the server.xml and uncomment this line


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
All accesses to a Tomcat instance are logged in files called "localhost_access_log.2008-01-31.txt" or some such in the TOMCAT_HOME/logs directory.

This can be configured somewhat; search for "AccessLogValve" in the TOMCAT_HOME/conf/server.xml file.


Ping & DNS - my free Android networking tools app
Aneel Ansari
Greenhorn

Joined: May 16, 2005
Posts: 7
Hi,

Http headers are set by client are used to inform server about software the client is using and how the client would prefer a server send back requested information. From a servlet, HTTP request headers can be accessed by calling several methods. In your case as you just wanna know who is accessing you application, you can implement

request.getHearderNames();
request.getHeader(headerName);

Note: getHearderNames() method returns Enumeration

Hope this will help.
[ January 31, 2008: Message edited by: Aneel Ansari ]
 
 
subject: how can get to know who