Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can servlet get information of the Server?  RSS feed

 
Jianfeng Qian
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get some static field of the the Server object.
such as a servlet get some information fo the tomcat
or the app server.
Does anyone have some idea?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66188
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked the Servlet API?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would help if you would tell us what information you were looking for.
 
Jianfeng Qian
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My app Server integrates with tomcat.
there is a ServerAdmin.java
public class ServerAdmin {

static ConcurrentHashMap servers = new ConcurrentHashMap();
......
}

I have a serverlet HttpServerServlet.java
I want to use ServerAdmin.servers in the Servlet,but it always is empty.
When I run the app Server in Jbuilder, the Servlet can get the ServerAdmin.servers
Do I make it clear ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When and what do you put in that map ?
 
Jianfeng Qian
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when the app server started.
I wander that does the servlet and app server in the same jvm ?
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jianfeng Qian:
when the app server started.
I wander that does the servlet and app server in the same jvm ?


yes :
If your question is whether we can access a public static filed of a servlet from some object in the same heap , then the answer is yes , servlets are no different from normal java classes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!