uk.co.westhawk.servlet
Class Interfaces
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--uk.co.westhawk.servlet.Interfaces
- All Implemented Interfaces:
- java.util.Observer, java.lang.Runnable, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class Interfaces
- extends javax.servlet.http.HttpServlet
- implements java.util.Observer, java.lang.Runnable
The Interfaces servlet collects information about all the interfaces
on a SNMP server.
It will collect continuously information (depending on the update
interval) unregarded it being accessed.
It will start when the servlet is
initialized (that is when the web server is started and loading all its
servlets) until it is destroyed.
The following parameters should be configured when installing this
servlet on a Java based webserver:
- HOST the hostname or IP address of the SNMP server, default
localhost
- PORT the port number of the SNMP server, default
161
- INTERVAL the update interval, default 10 sec
When accessing this servlet (with a GET action) it will print its
last updated information to your webpage.
The servlet will respond quickly, since it already has the
information.
This information can easily be parsed
so you can to combine it with an application.
In order to use a servlet you need to have a Java based webserver
where you can add and removed servlets.
The benefit of an servlet is that:
- this servlet is the only one to collect this information
- every one (that is allowed by the web server) can access
this information
- the network traffic will be kept low
- the chance of success is bigger, since a servlet has much more
privileges than an application
- no application is needed if the servlet returns the information as
(html) text
- Version:
- $Revision: 3.11 $ $Date: 2002/10/22 16:34:23 $
- Author:
- Birgit Arkesteijn
- See Also:
InterfaceGetNextPdu
,
getAllInterfaces
, Serialized Form
Method Summary |
void |
destroy()
|
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
|
java.lang.String |
getHost()
|
java.lang.String |
getInterval()
|
protected long |
getLastModified(javax.servlet.http.HttpServletRequest req)
|
java.lang.String |
getPort()
|
java.lang.String |
getServletInfo()
|
void |
init(javax.servlet.ServletConfig config)
|
protected void |
letItBegin(javax.servlet.ServletConfig config)
|
void |
run()
|
void |
setHost(java.lang.String h)
|
void |
setInterval(java.lang.String s)
Set the update interval time in sec. |
void |
setPort(java.lang.String p)
|
protected void |
showAllInterface(javax.servlet.http.HttpServletResponse res)
|
protected void |
showAllInterface(javax.servlet.http.HttpServletResponse res,
int index)
|
void |
update(java.util.Observable obs,
java.lang.Object ov)
|
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPost, doPut, doTrace, service, service |
Methods inherited from class javax.servlet.GenericServlet |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Interfaces
public Interfaces()
init
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
- Overrides:
init
in class javax.servlet.GenericServlet
destroy
public void destroy()
- Overrides:
destroy
in class javax.servlet.GenericServlet
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
setHost
public void setHost(java.lang.String h)
setPort
public void setPort(java.lang.String p)
setInterval
public void setInterval(java.lang.String s)
- Set the update interval time in sec.
getHost
public java.lang.String getHost()
getPort
public java.lang.String getPort()
getInterval
public java.lang.String getInterval()
letItBegin
protected void letItBegin(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
getLastModified
protected long getLastModified(javax.servlet.http.HttpServletRequest req)
- Overrides:
getLastModified
in class javax.servlet.http.HttpServlet
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
update
public void update(java.util.Observable obs,
java.lang.Object ov)
- Specified by:
update
in interface java.util.Observer
showAllInterface
protected void showAllInterface(javax.servlet.http.HttpServletResponse res)
showAllInterface
protected void showAllInterface(javax.servlet.http.HttpServletResponse res,
int index)
getServletInfo
public java.lang.String getServletInfo()
- Overrides:
getServletInfo
in class javax.servlet.GenericServlet