|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.restlet.ext.servlet.ServerServlet
org.restlet.ext.xdb.XdbServerServlet
public class XdbServerServlet
Servlet acting like an HTTP server connector. See Developper FAQ #2 for details on how to
integrate a Restlet application into a Servlet container.
Here is a sample configuration for your Restlet webapp:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>Restlet adapter</display-name> <!-- Restlet adapter --> <servlet> <servlet-name>XDBServerServlet</servlet-name> <servlet-class> org.restlet.ext.xdb.XDBServerServlet </servlet-class> <!-- Your application class name --> <init-param xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"> <param-name>org.restlet.application</param-name> <param-value> SCOTT:org.restlet.example.tutorial.Part12 </param-value> <description>REST Application</description> </init-param> </servlet> <!-- Catch all requests --> <servlet-mapping> <servlet-name>XDBServerServlet</servlet-name> <url-pattern>/userapp/*</url-pattern> </servlet-mapping> </web-app>The enumeration of initParameters of your Servlet will be copied to the "context.parameters" property of your application. This way, you can pass additional initialization parameters to your Restlet application, and share them with existing Servlets.
Constructor Summary | |
---|---|
XdbServerServlet()
Constructor. |
Method Summary | |
---|---|
static void |
closeDbResources(Statement statement,
ResultSet resultSet)
Closes JDBC resources |
protected ServerCall |
createCall(Server server,
HttpServletRequest request,
HttpServletResponse response)
Creates a new Servlet call wrapping a Servlet request/response couple and a Server connector. |
protected Client |
createWarClient(Context appCtx,
ServletConfig config)
Creates a new client for the WAR protocol. |
void |
destroy()
|
static Connection |
getConnection()
Returns a JDBC connection. |
protected String |
getContextPath(HttpServletRequest request)
Intercepter method need for subclasses such as XdbServerServlet. |
String |
getInitParameter(String name,
String defaultValue)
Returns the value of a given initialization parameter, first from the Servlet configuration, then from the Web Application context. |
protected String |
getLocalAddr(HttpServletRequest request)
Intercepter method need for subclasses such as XdbServerServlet. |
protected int |
getLocalPort(HttpServletRequest request)
Intercepter method need for subclasses such as XdbServerServlet. |
void |
init()
|
protected Class<?> |
loadClass(String className)
Returns a class for a given qualified class name. |
Methods inherited from class org.restlet.ext.servlet.ServerServlet |
---|
createApplication, createComponent, createServer, getApplication, getComponent, getServer, init, init, service |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XdbServerServlet()
Method Detail |
---|
public static void closeDbResources(Statement statement, ResultSet resultSet)
statement
- Any statement.resultSet
- Any result set.public static Connection getConnection() throws ServletException
ServletException
protected ServerCall createCall(Server server, HttpServletRequest request, HttpServletResponse response)
ServerServlet
createCall
in class ServerServlet
server
- The Server connector.request
- The Servlet request.response
- The Servlet response.
protected Client createWarClient(Context appCtx, ServletConfig config)
ServerServlet
createWarClient
in class ServerServlet
appCtx
- The parent context.config
- The Servlet config.
public void destroy()
destroy
in interface Servlet
destroy
in class ServerServlet
protected Class<?> loadClass(String className) throws ClassNotFoundException
ServerServlet
loadClass
in class ServerServlet
className
- The class name to lookup.
ClassNotFoundException
public String getInitParameter(String name, String defaultValue)
ServerServlet
getInitParameter
in class ServerServlet
name
- The parameter name.defaultValue
- The default to use in case the parameter is not found.
public void init() throws ServletException
init
in class ServerServlet
ServletException
protected String getContextPath(HttpServletRequest request)
ServerServlet
getContextPath
in class ServerServlet
request
- The Servlet request.
protected String getLocalAddr(HttpServletRequest request)
ServerServlet
getLocalAddr
in class ServerServlet
request
- The Servlet request.
protected int getLocalPort(HttpServletRequest request)
ServerServlet
getLocalPort
in class ServerServlet
request
- The Servlet request.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |