| java.lang.Object org.xins.common.servlet.container.LocalServletHandler
LocalServletHandler | public class LocalServletHandler (Code) | | This class allows to invoke a XINS API without using HTTP.
Example:
LocalServletHandler handler = LocalServletHandler.getInstance("c:\\test\\myproject.war");
String xmlResult = handler.query("http://127.0.0.1:8080/myproject/?_function=MyFunction&gender=f&personLastName=Lee");
version: $Revision: 1.25 $ $Date: 2007/09/18 08:45:09 $ author: Anthony Goubard |
Constructor Summary | |
public | LocalServletHandler(File warFile) Creates a Servlet handler that allow to invoke a Servlet without starting
a HTTP server. | public | LocalServletHandler(String servletClassName) Creates a Servlet handler that allow to invoke a Servlet without starting
a HTTP server. |
Method Summary | |
public void | close() Disposes the Servlet and closes this Servlet handler. | public Object | getServlet() Gets the Servlet. | public void | initServlet(File warFile) Initializes the Servlet. | public void | initServlet(String servletClassName) Initializes the Servlet. | public XINSServletResponse | query(String url) Queries the Servlet with the specified URL. | public XINSServletResponse | query(String method, String url, String data, Map headers) Queries the servlet with the specified method, URL, content and HTTP
headers.
Parameters: method - the request method, cannot be null . Parameters: url - the url query for the request, if null then the /path is used as default with no parameters. Parameters: data - the data post for the request. |
LocalServletHandler | public LocalServletHandler(File warFile) throws ServletException(Code) | | Creates a Servlet handler that allow to invoke a Servlet without starting
a HTTP server.
Parameters: warFile - the location of the war file containing the Servlet, cannot benull . throws: ServletException - if the Servlet cannot be created. |
LocalServletHandler | public LocalServletHandler(String servletClassName) throws ServletException(Code) | | Creates a Servlet handler that allow to invoke a Servlet without starting
a HTTP server.
Parameters: servletClassName - The name of the servlet's class to load, cannot be null . throws: ServletException - if the Servlet cannot be created. |
close | public void close()(Code) | | Disposes the Servlet and closes this Servlet handler.
|
getServlet | public Object getServlet()(Code) | | Gets the Servlet.
the created Servlet or null if no Servlet was created. |
initServlet | public void initServlet(File warFile) throws ServletException(Code) | | Initializes the Servlet.
Parameters: warFile - the location of the war file, cannot be null . throws: ServletException - if the Servlet cannot be loaded. |
initServlet | public void initServlet(String servletClassName) throws ServletException(Code) | | Initializes the Servlet.
Parameters: servletClassName - The name of the servlet's class to load, cannot be null . throws: ServletException - if the Servlet cannot be loaded. |
query | public XINSServletResponse query(String method, String url, String data, Map headers) throws IOException(Code) | | Queries the servlet with the specified method, URL, content and HTTP
headers.
Parameters: method - the request method, cannot be null . Parameters: url - the url query for the request, if null then the /path is used as default with no parameters. Parameters: data - the data post for the request. null for HTTP GET queries. Parameters: headers - the HTTP headers passed with the query, cannot be null .The key and the value of the Map is String. The keys are all inuppercase.the servlet response. throws: IOException - If the query is not handled correctly by the servlet. since: XINS 1.5.0 |
|
|