|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.servlet.container.LocalServletHandler
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");
Constructor Summary | |
LocalServletHandler(File warFile)
Creates a Servlet handler that allow to invoke a Servlet without starting a HTTP server. |
|
LocalServletHandler(String servletClassName)
Creates a Servlet handler that allow to invoke a Servlet without starting a HTTP server. |
Method Summary | |
void |
close()
Disposes the Servlet and closes this Servlet handler. |
Object |
getServlet()
Gets the Servlet. |
void |
initServlet(File warFile)
Initializes the Servlet. |
void |
initServlet(String servletClassName)
Initializes the Servlet. |
XINSServletResponse |
query(String url)
Queries the Servlet with the specified URL. |
XINSServletResponse |
query(String url,
char[] data,
Map headers)
Deprecated. Since XINS 1.5.0. The way the HTTP method is determined is incorrect. Use query(String,String,String,Map) instead. |
XINSServletResponse |
query(String url,
char[] data,
String contentType)
Deprecated. Since XINS 1.5.0. The way the HTTP method is determined is incorrect. Use query(String,String,String,Map) instead. |
XINSServletResponse |
query(String method,
String url,
String data,
Map headers)
Queries the servlet with the specified method, URL, content and HTTP headers. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LocalServletHandler(File warFile) throws ServletException
warFile
- the location of the war file containing the Servlet, cannot be
null
.
ServletException
- if the Servlet cannot be created.public LocalServletHandler(String servletClassName) throws ServletException
servletClassName
- The name of the servlet's class to load, cannot be null
.
ServletException
- if the Servlet cannot be created.Method Detail |
public void initServlet(File warFile) throws ServletException
warFile
- the location of the war file, cannot be null
.
ServletException
- if the Servlet cannot be loaded.public void initServlet(String servletClassName) throws ServletException
servletClassName
- The name of the servlet's class to load, cannot be null
.
ServletException
- if the Servlet cannot be loaded.public Object getServlet()
null
if no Servlet was created.public XINSServletResponse query(String url) throws IOException
url
- the url query for the request.
IOException
- If the query is not handled correctly by the servlet.public XINSServletResponse query(String url, char[] data, String contentType) throws IOException
query(String,String,String,Map)
instead.
url
- the url query for the request, if null
then the /
path is used as default with no parameters.data
- the data post for the request, can be null
.contentType
- the content type of the request, can be null
.
IOException
- If the query is not handled correctly by the servlet.public XINSServletResponse query(String url, char[] data, Map headers) throws IOException
query(String,String,String,Map)
instead.
url
- the url query for the request, if null
then the /
path is used as default with no parameters.data
- the data post for the request. null
for HTTP GET queries.headers
- the HTTP headers passed with the query, cannot be null
.
The key and the value of the Map is String.
IOException
- If the query is not handled correctly by the servlet.public XINSServletResponse query(String method, String url, String data, Map headers) throws IOException
method
- the request method, cannot be null
.url
- the url query for the request, if null
then the /
path is used as default with no parameters.data
- the data post for the request. null
for HTTP GET queries.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 in
uppercase.
IOException
- If the query is not handled correctly by the servlet.public void close()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |