|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.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
Field Summary | |
static String |
API_BUILD_VERSION_PROPERTY
The name of the build property that specifies the version with which the API was built. |
static String |
API_CALLING_CONVENTION_CLASS_PROPERTY
The name of the build property that specifies the class of the default calling convention. |
static String |
API_CALLING_CONVENTION_PROPERTY
The name of the build property that specifies the name of the default calling convention. |
static String |
API_CLASS_PROPERTY
The name of the build property that specifies the name of the API class to load. |
static String |
API_NAME_PROPERTY
The name of the build property that specifies the name of the API. |
static String |
CALLING_CONVENTION_PARAMETER
The name of the request parameter that specifies the name of the calling convention to use. |
static String |
CONFIG_FILE_SYSTEM_PROPERTY
The name of the system property that specifies the location of the configuration file. |
static String |
CONFIG_RELOAD_INTERVAL_PROPERTY
The name of the runtime property that specifies the interval for the configuration file modification checks, in seconds. |
static int |
DEFAULT_CONFIG_RELOAD_INTERVAL
The default configuration file modification check interval, in seconds. |
static String |
HOSTNAME_PROPERTY
The name of the runtime property that hostname for the server running the API. |
static String |
LOG_LOCALE_PROPERTY
Deprecated. Use LogCentral.LOG_LOCALE_PROPERTY . |
static String |
OLD_STYLE_CALLING_CONVENTION
The old-style XINS calling convention. |
static String |
SOAP_CALLING_CONVENTION
The name of the SOAP calling convention. |
static String |
STANDARD_CALLING_CONVENTION
The name of the XINS standard calling convention. |
static String |
XML_CALLING_CONVENTION
The XINS XML calling convention. |
static String |
XML_RPC_CALLING_CONVENTION
The name of the XML-RPC calling convention. |
static String |
XSLT_CALLING_CONVENTION
The XINS XSLT calling convention. |
Constructor Summary | |
APIServlet()
Constructs a new APIServlet object. |
Method Summary | |
void |
destroy()
Destroys this servlet. |
ServletConfig |
getServletConfig()
Returns the ServletConfig object which contains the
build 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 |
initImpl(ServletConfig config)
Deprecated. Deprecated since XINS 1.3.0. Use init(ServletConfig)
instead. |
void |
service(HttpServletRequest request,
HttpServletResponse response)
Handles an HTTP request to this servlet. |
void |
service(ServletRequest request,
ServletResponse response)
Handles a request to this servlet. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified |
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 |
Field Detail |
public static final String CONFIG_FILE_SYSTEM_PROPERTY
public static final String CONFIG_RELOAD_INTERVAL_PROPERTY
public static final String HOSTNAME_PROPERTY
public static final int DEFAULT_CONFIG_RELOAD_INTERVAL
public static final String API_CLASS_PROPERTY
public static final String API_NAME_PROPERTY
public static final String API_BUILD_VERSION_PROPERTY
public static final String API_CALLING_CONVENTION_PROPERTY
public static final String API_CALLING_CONVENTION_CLASS_PROPERTY
public static final String CALLING_CONVENTION_PARAMETER
public static final String STANDARD_CALLING_CONVENTION
public static final String OLD_STYLE_CALLING_CONVENTION
public static final String XML_CALLING_CONVENTION
public static final String XSLT_CALLING_CONVENTION
public static final String SOAP_CALLING_CONVENTION
public static final String XML_RPC_CALLING_CONVENTION
public static final String LOG_LOCALE_PROPERTY
LogCentral.LOG_LOCALE_PROPERTY
.
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 build 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 void initImpl(ServletConfig config) throws ServletException
init(ServletConfig)
instead.
init(ServletConfig)
. That method should be used
instead.
config
- the ServletConfig
object which contains build properties for
this servlet, as specified by the assembler, cannot be
null
.
ServletException
- if the servlet could not be initialized.public ServletConfig getServletConfig()
ServletConfig
object which contains the
build 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(ServletRequest request, ServletResponse response) throws NullPointerException, ClassCastException, ServletException, 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.
ClassCastException
- if ! (request instanceof HttpServletRequest
&& response instanceof HttpServletResponse
)
.
ServletException
- if this servlet failed for some other reason that an I/O error.
IOException
- if there is an error error writing to the response output stream.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 |