com.informationkinematics.weblogic
Class TracerouteWrapperServlet
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--com.informationkinematics.weblogic.TracerouteWrapperServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class TracerouteWrapperServlet
- extends javax.servlet.http.HttpServlet
Title: TracerouteWrapperServlet
Description: Platform independent webinterface for traceroute (or any other commandline
program, that expects an IP address as an input).
Organization: Information Kinematics
- Version:
- 0.5.2
- Author:
- Copyright (c) 2002 by information
kinematics under GNU General Public License
- See Also:
- Serialized Form
Fields inherited from class javax.servlet.http.HttpServlet |
HEADER_IFMODSINCE, HEADER_LASTMOD, LSTRING_FILE, lStrings, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, METHOD_TRACE |
Fields inherited from class javax.servlet.GenericServlet |
config |
Method Summary |
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Check the input from the HTML form, call a system process and put the output
into the prepared HTML page. |
private void |
dynamicReloader()
Reload the properties file or HTML template if needed. |
void |
init(javax.servlet.ServletConfig config)
On initialization read the servlet's inifile and HTML output template. |
private boolean |
isEmpty(java.lang.String sTestString)
Check wether a string is empty or null. |
private boolean |
isPossibleInetAddress(java.lang.String address)
Checks the given string for "undecent" characters, if none are found the string
might be an IP address. |
private boolean |
isWindows()
Returns the type of the operation system, as follows:
true: Windows family
false: Others
|
private void |
loadHTMLTemplate()
Load a template for HTML output. |
private void |
loadPropertiesFile()
Load the properties file and read the initial parameters, check them for plausibility. |
Methods inherited from class javax.servlet.http.HttpServlet |
, doDelete, doGet, doHead, doOptions, doPut, doTrace, getAllDeclaredMethods, getLastModified, maybeSetLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
fHTMLTemplate
private java.io.File fHTMLTemplate
fPropertiesFile
private java.io.File fPropertiesFile
lPropertiesFileLastModified
private long lPropertiesFileLastModified
lTemplateLastModified
private long lTemplateLastModified
sContentType
private java.lang.String sContentType
sError
private java.lang.String sError
sHTMLAfterTracerouteOutput
private java.lang.String sHTMLAfterTracerouteOutput
sHTMLBeforeTracerouteOutput
private java.lang.String sHTMLBeforeTracerouteOutput
sNoResolvSwitch
private java.lang.String sNoResolvSwitch
sPlaceholderString
private java.lang.String sPlaceholderString
sTracerouteExecutablePath
private java.lang.String sTracerouteExecutablePath
TracerouteWrapperServlet
public TracerouteWrapperServlet()
doPost
public void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.io.IOException,
javax.servlet.ServletException
- Check the input from the HTML form, call a system process and put the output
into the prepared HTML page.
- Overrides:
doPost
in class javax.servlet.http.HttpServlet
- Parameters:
req
- Servlet's request object.res
- Servlet's response object.- Throws:
java.io.IOException
- javax.servlet.ServletException
-
dynamicReloader
private void dynamicReloader()
throws java.io.IOException
- Reload the properties file or HTML template if needed.
- Throws:
java.io.IOException
- Description of the Exception
init
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
- On initialization read the servlet's inifile and HTML output template.
- Overrides:
init
in class javax.servlet.GenericServlet
- Parameters:
config
- Description of the Parameter- Throws:
javax.servlet.ServletException
-
isEmpty
private boolean isEmpty(java.lang.String sTestString)
- Check wether a string is empty or null.
- Parameters:
sTestString
- The string to test.- Returns:
- Returns true if the test string is empty or null.
isPossibleInetAddress
private boolean isPossibleInetAddress(java.lang.String address)
throws java.lang.IndexOutOfBoundsException
- Checks the given string for "undecent" characters, if none are found the string
might be an IP address. Anything other than letters, digits, dots and dashes
are regarded as undecent.
- Parameters:
address
- The address to test.- Returns:
- Returns true, if the given string could
be an IP address or hostname.
- Throws:
java.lang.IndexOutOfBoundsException
-
isWindows
private boolean isWindows()
- Returns the type of the operation system, as follows:
true: Windows family
false: Others
- Returns:
- boolean - true if OS name contains "Win", else false
loadHTMLTemplate
private void loadHTMLTemplate()
throws java.io.IOException
- Load a template for HTML output.
- Throws:
java.io.IOException
- Description of the Exception
loadPropertiesFile
private void loadPropertiesFile()
throws java.io.IOException
- Load the properties file and read the initial parameters, check them for plausibility.
- Throws:
java.io.IOException
-