|
|||||||||||
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.xins.server.APIServlet
HTTP servlet that forwards requests to an API
.
This servlet supports various HTTP methods, depending on the calling
conventions. A request with an unsupported method makes this servlet
return the HTTP status code 405 Method Not Allowed
.
If no matching function is found, then this servlet returns HTTP status
code 404 Not Found
.
If the servlet is temporarily unavailable, then the HTTP status
503 Service Unavailable
is returned.
If the servlet encountered an initialization error, then the HTTP status
code 500 Internal Server Error
is returned.
If the state is ready then the HTTP status code
200 OK
is returned.
When the servlet is initialized, it gathers configuration information from different sources:
web.xml
file with
build-time settings. Some of these settings are required in order
for the XINS/Java Server Framework to start up, while others are
optional. These build-time settings are passed to the servlet by the
application server as a ServletConfig
object. See
init(ServletConfig)
.
java -Dorg.xins.server.config=`pwd`/config/xins.properties
-jar orion.jar
log4j.rootLogger=DEBUG, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d %-5p [%c]
%m%n
Constructor Summary | |
APIServlet()
Constructs a new APIServlet object. |
Method Summary | |
void |
destroy()
Destroys this servlet. |
ServletConfig |
getServletConfig()
Returns the ServletConfig object which contains the
bootstrap properties for this servlet. |
String |
getServletInfo()
Returns information about this servlet, as plain text. |
void |
init(ServletConfig config)
Initializes this servlet using the specified configuration. |
void |
service(HttpServletRequest request,
HttpServletResponse response)
Handles an HTTP request to this servlet. |
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, getServletContext, 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 APIServlet()
APIServlet
object.
Method Detail |
public String getServletInfo()
null
and not an
empty character string.public void init(ServletConfig config) throws IllegalArgumentException, ServletException
config
- the ServletConfig
object which contains bootstrap properties for
this servlet, as specified by the assembler, cannot be
null
.
IllegalArgumentException
- if config == null
|| config.ServletConfig.getServletContext()
== null
.
ServletException
- if the servlet could not be initialized.public ServletConfig getServletConfig()
ServletConfig
object which contains the
bootstrap properties for this servlet. The returned ServletConfig
object is the one passed to the init(ServletConfig)
method.
ServletConfig
object that was used to initialize this
servlet, or null
if this servlet is not yet
initialized.public void service(HttpServletRequest request, HttpServletResponse response) throws NullPointerException, IOException
null
, then the behaviour of this method is undefined.
request
- the servlet request, should not be null
.response
- the servlet response, should not be null
.
NullPointerException
- if this servlet is yet uninitialized.
IOException
- if there is an error error writing to the response output stream.public void destroy()
After this method has finished, no more requests will be handled successfully.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |