com.ls.lars.communication
Class HTTPListenerServlet
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--com.ls.lars.communication.HTTPListenerServlet
- All Implemented Interfaces:
- Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- public class HTTPListenerServlet
- extends javax.servlet.http.HttpServlet
This servlet establishes communication betweeen applications and a LARS platform.
HTTPListenerServlet communicates with HTTPMessengers, which first send a registration message to the
servlet. The servlet then creates a new messenger connecting the servlet to the LARS for the newly registered
HTTPMessenger according to the parameters supplied in the register message.
This servlet acts as a gateway between LARS and HTTPMessenger.
Security Note:
You need to configure your web server not to allow any IP address to connect to this servlet, but only the
ones from where clients may contact the LARS!
- Version:
- $Revision: 1.16 $
- Author:
- Last modified by $Author: MFehrenbach $
- See Also:
- Serialized Form
Method Summary |
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Any doGet message will also forwarded to the doPost method |
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
All incomming requests for this servlet are handled in this method.
|
void |
init(javax.servlet.ServletConfig config)
Initiates HttpServlet with its configuration.
|
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HTTPListenerServlet
public HTTPListenerServlet()
init
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
- Initiates HttpServlet with its configuration.
Reads configuration information from servlet properties file.
- globalLogPath
-
- logFile
-
- logLevel
-
- logType Note:this field is optional
-
- connectionProtocol
- RMI, socket, ... (see constants in
ICommunication
)
- connectionHostPort
-
- connectionMaximumMessageLength
-
- connectionHostIp
-
- connectionHostId
-
- Overrides:
init
in class javax.servlet.GenericServlet
- Parameters:
config
- the configuration of the servlet- Throws:
javax.servlet.ServletException
- If the servlet can not be started
doGet
public void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws IOException
- Any doGet message will also forwarded to the doPost method
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
- Parameters:
req
- The input streamresp
- The output stream- Throws:
IOException
- if a problem occures reading from req or writing to resp
doPost
public void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws IOException
- All incomming requests for this servlet are handled in this method.
In the processing mechanism, the following meta messages are processed;
SERVICE_HTTP_REGISTER_AGENT : All messanger has to be connect to the
LARS platform. By using this message, they send all required information
to communicate with the LARS platform.
SERVICE_HTTP_GET_MESSAGES : By using this message, HTTPMessengers
may retrieve their messages from LARS platform.
SERVICE_HTTP_CLOSE_CONNECTION : Closes the connection for the related HTTPMessenger.
All other valid messages are forwarded to LARS platform by using the related
messenger.
- Overrides:
doPost
in class javax.servlet.http.HttpServlet
- Parameters:
req
- The input streamresp
- The output stream- Throws:
IOException
- if a problem occurs while reading from req