Hello, Sigurđur Bjarnason,

I recently ran into this problem, as well. I found a solution that works nicely with all web-servers (Tomcat, JRun, Weblogic, etc...). Probably others have emailed you with this solution, but in case they haven't:

First, create the following jsp:

getServerInfo.jsp
---------------
<html>
<body>
<%= application.getServerInfo() %>
</body>
</html>
---------------

Then access it however you can, assuming your webserver is running. At work we use lynx, eg. "lynx http://localhost:8080/getServerInfo.jsp. There are some flags you can use to make lynx just dump the output on std-out. Another possibility is Curl, or even Ant's "get" task.


That's it! However, I've added extra information to this email which you may find useful... you may be wondering where this undefined 'application' variable in the jsp comes from!

In any jsp you have the following variables already in scope, among others. Here's the link where I found this:

http://developer.java.sun.com/developer/onlineTraining/JSPIntro/contents.html#JSPIntro5

request
response
application
out

"request" is an instance of javax.servlet.http.HttpServletRequest.
"response" is an instance of javax.servlet.http.HttpServletResponse.
"application" is an instance of javax.servlet.ServletContext.
"out" is an instance of javax.servlet.jsp.JspWriter. I tend to think of the superclass, java.io.Writer, instead, though.

As you can see, ServletContext provides the very useful "getServerInfo()" method. Here's the link in the J2EE api for ServletContext.getServerInfo():

http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getServerInfo()


Good luck!

yours,

Julius Davies
Vancouver, Canada



--
To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to