|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.xins.common.servlet.container.HTTPServletHandler
HTTP server used to invoke the XINS servlet.
| Field Summary | |
static int |
DEFAULT_PORT_NUMBER
The default port number is 8080. |
| Constructor Summary | |
HTTPServletHandler(File warFile)
Creates a new HTTPServletHandler. |
|
HTTPServletHandler(File warFile,
int port,
boolean daemon)
Creates a new HTTPSevletHandler. |
|
HTTPServletHandler(int port,
boolean daemon)
Creates a new HTTPSevletHandler with no Servlet. |
|
HTTPServletHandler(String servletClassName)
Creates a new HTTPSevletHandler. |
|
HTTPServletHandler(String servletClassName,
int port,
boolean daemon)
Creates a new HTTPSevletHandler. |
|
| Method Summary | |
void |
addServlet(String servletClassName,
String virtualPath)
Adds a new servlet. |
void |
addWAR(File warFile,
String virtualPath)
Adds a WAR file to the server. |
void |
close()
Disposes the servlet and stops the web server. |
int |
getPort()
Returns the port the server is accepting connections on. |
void |
httpQuery(InputStream in,
OutputStream out)
This method parses the data sent from the client to get the input parameters and format the result as a compatible HTTP result. |
void |
removeServlet(String virtualPath)
Remove a servlet from the server. |
void |
serviceClient(Socket client)
This method is invoked when a client connects to the server. |
void |
startServer(int port,
boolean daemon)
Starts the web server. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DEFAULT_PORT_NUMBER
| Constructor Detail |
public HTTPServletHandler(int port,
boolean daemon)
throws IOException
port - The port of the servlet server.daemon - true if the thread listening to connection should be a
daemon thread, false otherwise.
IOException - if the servlet container cannot be started.
public HTTPServletHandler(File warFile)
throws ServletException,
IOException
HTTPServletHandler. This servlet handler
starts a web server on port 8080 and wait for calls from the
XINSServiceCaller.
Note that all the libraries used by this WAR file should already be in the classpath.
warFile - the war file of the application to deploy, cannot be
null.
ServletException - if the servlet cannot be initialized.
IOException - if the servlet container cannot be started.
public HTTPServletHandler(File warFile,
int port,
boolean daemon)
throws ServletException,
IOException
HTTPSevletHandler. This servlet handler
starts a web server on the specified port and waits for calls from the XINSServiceCaller.
Note that all the libraries used by this WAR file should already be in
the classpath.
warFile - the war file of the application to deploy, cannot be
null.port - The port of the servlet server.daemon - true if the thread listening to connection should be a
daemon thread, false otherwise.
ServletException - if the servlet cannot be initialized.
IOException - if the servlet container cannot be started.
public HTTPServletHandler(String servletClassName)
throws ServletException,
IOException
servletClassName - The name of the servlet's class to load, cannot be null.
ServletException - if the servlet cannot be initialized.
IOException - if the servlet container cannot be started.
public HTTPServletHandler(String servletClassName,
int port,
boolean daemon)
throws ServletException,
IOException
servletClassName - The name of the servlet's class to load, cannot be null.port - The port of the servlet server.daemon - true if the thread listening to connection should be a
daemon thread, false otherwise.
ServletException - if the servlet cannot be initialized.
IOException - if the servlet container cannot be started.| Method Detail |
public void addWAR(File warFile,
String virtualPath)
throws ServletException
warFile - The war file of the application to deploy, cannot be null.virtualPath - The virtual path of the HTTP server that links to this WAR file, cannot be null.
ServletException - if the servlet cannot be initialized.
public void addServlet(String servletClassName,
String virtualPath)
throws ServletException
servletClassName - The name of the servlet's class to load, cannot be null.virtualPath - The virtual path of the HTTP server that links to this WAR file, cannot be null.
ServletException - if the servlet cannot be initialized.public void removeServlet(String virtualPath)
virtualPath - The virtual path of the servlet to remove, cannot be null.
public void startServer(int port,
boolean daemon)
throws IOException
port - the port of the servlet server.daemon - true if the thread listening to connection should be a
daemon thread, false otherwise.
IOException - if the web server cannot be started.
public int getPort()
throws IllegalStateException
8080.
IllegalStateException - if the port cannot be determined, for example because the server is
not started.public void close()
public void serviceClient(Socket client)
throws IllegalArgumentException,
IOException
client - the connection with the client, cannot be null.
IllegalArgumentException - if client == null.
IOException - if the query is not handled correctly.
public void httpQuery(InputStream in,
OutputStream out)
throws IOException
in - the input byte stream that contains the request sent by the client.out - the output byte stream that must be fed the response towards the
client.
IOException - if the query is not handled correctly.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||