|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.semoa.bin.ServletLauncher
This tool is used to publish servlets to and retract servlets from
the Environment
and thereby adjust the corresponding
web server links.
There are several perameters for the Servlet
-tool:
-publish
Publish the Servlet with the given class.
-retract
Retract the Servlet registered under the
given path.
-class
[publish]: The Servlet's class.
-name
[publish]: The name for the servlet.
If this parameter is not given, the classname (without package name)
will be used.
-path
[publish|retract]: The pathname where the
Servlet will be registered. If not given the name
parameter will be used.
-http
[publish|retract]: If set the servlet will be
registered for access through the HTTP-Server resp. retracted
(this flag can be used in combination with '-https').
-https
[publish|retract]: If set the servlet will be
registered for access through the HTTP-Server resp. retracted
(this flag can be used in combination with '-http').
-params
[publish]: A property file with the servlet's
init parameters. (Java System Properties, SeMoA Shell Variables,
and WhatIs Variables will be used for variable substitution, when
the property file is parsed. Thereby, variables within the property
file have to be given in the following format:
${<variable_name>}.)
-basepath
[publish]: The servlet specific base path
used to construct by ServletContext#getRealPath()
.
-list
List currently registered 1st-level servlets.
-verbose
Verbose mode.
-help
Prints some help.
HttpServer
,
HttpsServer
Field Summary | |
static String |
DESCR
The command line parameters. |
static int |
HTTP
Variables denoting the HTTP protocol to provide the servlet for. |
static int |
HTTPS
Variables denoting the HTTPS protocol to provide the servlet for. |
Constructor Summary | |
ServletLauncher()
|
Method Summary | |
protected static String |
getServletInfo(javax.servlet.http.HttpServlet servlet)
Returns servlet specific information as String . |
static void |
main(String[] args)
Publishes a Servlet with the given parameters. |
protected static void |
printUsage()
Prints usage of the command line parameters to System.out . |
static void |
publish(javax.servlet.Servlet servlet,
String servletPath,
String servletName,
Properties initParams,
String basePath,
int protocols)
Publishes a Servlet with the given parameters. |
static void |
publish(String servletClass,
String servletPath,
String servletName,
Properties initParams,
String basePath,
int protocols)
Publishes a Servlet with the given parameters. |
static void |
retract(String servletPath,
int protocols)
Retract the servlet registered under the the given path. |
static SortedMap |
servletPaths(int protocols)
Returns all servlet paths currently registered for the given protocol(s), whereas the paths contain the corresponding web server prefix within the Environment . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int HTTP
public static final int HTTPS
public static final String DESCR
Constructor Detail |
public ServletLauncher()
Method Detail |
public static void publish(String servletClass, String servletPath, String servletName, Properties initParams, String basePath, int protocols) throws ObjectExistsException, javax.servlet.ServletException
Servlet
with the given parameters.
If both protocols HTTP and HTTPS are given, one
instance of the servletClass
is created,
and then linked to the HTTP as well as the HTTPS server.
To create two separate servletClass
instances
for the HTTP resp. the HTTPS server, this method has to
be called twice, one time for each protocol.
The servlet's method init()
is invoked automatically
before the link(s) to the corresponding web server(s) is/are
established.
servletClass
- The servlet's class name.servletPath
- The relative path under which the
Servlet will be registered. If null
the given the servletName
will be used.
The servlet URL will then be:
(http|https)
://localhost:<webserverPort>
/<servletPath>servletName
- The name for the servlet. If
this parameter is null
, the classname
(without package prefix) will be used
(see ServletConfig#getServletName()
).initParams
- The servlet's init parameters
(see ServletConfig#getInitParameter()
).basePath
- The servlet specific base path used
to construct by ServletContext#getRealPath()
.protocols
- The protocol(s), to provide the
servlet for (HTTP
, HTTPS
,
or HTTP | HTTPS
).
ObjectExistsException
- if a servlet has already
been published under the same path.
javax.servlet.ServletException
- if an exception has occured
during servlet initialization.public static void publish(javax.servlet.Servlet servlet, String servletPath, String servletName, Properties initParams, String basePath, int protocols) throws ObjectExistsException, javax.servlet.ServletException
Servlet
with the given parameters.
The servlet's method init()
is invoked automatically
before the link(s) to the corresponding web server(s) is/are
established.
servletPath
- The relative path under which the
Servlet will be registered. If null
the given the servletName
will be used.
The servlet URL will then be:
(http|https)
://localhost:<webserverPort>
/<servletPath>servletName
- The name for the servlet. If
this parameter is null
, the classname
(without package prefix) will be used
(see ServletConfig#getServletName()
).initParams
- The servlet's init parameters
(see ServletConfig#getInitParameter()
).basePath
- The servlet specific base path used
to construct by ServletContext#getRealPath()
.protocols
- The protocol(s), to provide the
servlet for (HTTP
, HTTPS
,
or HTTP | HTTPS
).
ObjectExistsException
- if a servlet has already
been published under the same path.
javax.servlet.ServletException
- if an exception has occured
during servlet initialization.public static void retract(String servletPath, int protocols) throws NoSuchObjectException
destroy()
is only
invoked (once), if both links are retracted.
servletPath
- The relative path under which the
Servlet will be registered (see publish()).protocols
- The protocol(s), to retract the
servlet from (HTTP
, HTTPS
,
or HTTP | HTTPS
).
NoSuchObjectException
- if no servlet is registered
under the given path (dependent of the given protocols).
This exception is thrown, before the first web server
link is rtracted resp. the destroy() method has been called.public static SortedMap servletPaths(int protocols)
Environment
.
protocols
- The protocol(s), to list the servlet
paths for (HTTP
, HTTPS
,
or HTTP | HTTPS
).
CanonicalPath
/Servlet
entries.public static void main(String[] args) throws Exception
Servlet
with the given parameters.
args
- The command line arguments.
Exception
protected static String getServletInfo(javax.servlet.http.HttpServlet servlet)
String
.
String
.protected static void printUsage()
System.out
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |