|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xins.common.manageable.Manageable
org.xins.server.CallingConvention
org.xins.server.XMLRPCCallingConvention
The XML-RPC calling convention.
Nested Class Summary |
Nested classes inherited from class org.xins.common.manageable.Manageable |
Manageable.State |
Field Summary | |
protected static String |
RESPONSE_CONTENT_TYPE
The content type of the HTTP response. |
protected static String |
RESPONSE_ENCODING
The response encoding format. |
Fields inherited from class org.xins.common.manageable.Manageable |
BOOTSTRAPPED, BOOTSTRAPPING, DEINITIALIZING, INITIALIZING, UNUSABLE, USABLE |
Constructor Summary | |
XMLRPCCallingConvention(API api)
Creates a new XMLRPCCallingConvention instance. |
Method Summary | |
protected FunctionRequest |
convertRequestImpl(HttpServletRequest httpRequest)
Converts an HTTP request to a XINS request (implementation method). |
protected void |
convertResultImpl(FunctionResult xinsResult,
HttpServletResponse httpResponse,
HttpServletRequest httpRequest)
Converts a XINS result to an HTTP response (implementation method). |
protected API |
getAPI()
Determines the current API. |
protected String[] |
getSupportedMethods()
Determines which HTTP methods are supported for function invocations. |
protected String[] |
getSupportedMethods(HttpServletRequest request)
Determines which HTTP methods are supported for function invocations, for the specified request. |
protected boolean |
matches(HttpServletRequest httpRequest)
Checks if the specified request can be handled by this calling convention. |
protected Element |
parseXMLRequest(HttpServletRequest httpRequest)
Parses XML from the specified HTTP request and checks that the content type is correct. |
protected Element |
parseXMLRequest(HttpServletRequest httpRequest,
boolean checkType)
Parses XML from the specified HTTP request and optionally checks that the content type is correct. |
Methods inherited from class org.xins.common.manageable.Manageable |
assertUsable, bootstrap, bootstrapImpl, deinit, deinitImpl, getState, init, initImpl, isBootstrapped, isUsable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final String RESPONSE_ENCODING
protected static final String RESPONSE_CONTENT_TYPE
Constructor Detail |
public XMLRPCCallingConvention(API api) throws IllegalArgumentException
XMLRPCCallingConvention
instance.
api
- the API, needed for the XML-RPC messages, cannot be
null
.
IllegalArgumentException
- if api == null
.Method Detail |
protected String[] getSupportedMethods()
org.xins.server.CallingConvention
Each String
in the returned array must be one
supported method.
The returned array must not be null
, it must only
contain valid HTTP method names, so they may not contain whitespace, for
example. Duplicates will be ignored. HTTP method names must be in uppercase.
There must be at least one HTTP method supported for function invocations.
Note that OPTIONS must not be returned by this method, as it is not an HTTP method that can ever be used to invoke a XINS function.
HTTP OPTIONS requests are treated differently. For the path
*
the capabilities of the whole server are returned. For other
paths, the appropriate calling convention is determined, after which the
set of supported HTTP methods is returned to the called.
String
array, must
not be null
.protected boolean matches(HttpServletRequest httpRequest) throws Exception
This method will not throw any exception.
httpRequest
- the HTTP request to investigate, cannot be null
.
true
if this calling convention is possibly
able to handle this request, or false
if it
definitely not able to handle this request.
Exception
- if analysis of the request causes an exception;
false
will be assumed.protected FunctionRequest convertRequestImpl(HttpServletRequest httpRequest) throws InvalidRequestException, FunctionNotSpecifiedException
org.xins.server.CallingConvention
httpRequest
argument is not null
;
CallingConvention.getSupportedMethods()
.
Note that CallingConvention.getSupportedMethods(HttpServletRequest)
will not
have been called prior to this method call.
httpRequest
- the HTTP request.
null
.
FunctionNotSpecifiedException
- if the request does not indicate the name of the function to execute.
InvalidRequestException
- if the request is considerd to be invalid.protected void convertResultImpl(FunctionResult xinsResult, HttpServletResponse httpResponse, HttpServletRequest httpRequest) throws IOException
org.xins.server.CallingConvention
null
.
xinsResult
- the XINS result object that should be converted to an HTTP response,
will not be null
.httpResponse
- the HTTP response object to configure.httpRequest
- the HTTP request.
IOException
- if the invocation of any of the methods in either
httpResponse
or httpRequest
caused an I/O
error.protected final API getAPI()
API
, never null
.protected String[] getSupportedMethods(HttpServletRequest request)
Each String
in the returned array must be one
supported method.
The returned array may be null
. If it is not, then the
returned array must only contain valid HTTP method names, so they may
not contain whitespace, for example. HTTP method names must be in uppercase.
There must be at least one HTTP method supported for function invocations.
Note that OPTIONS must not be returned by this method, as it is not an HTTP method that can ever be used to invoke a XINS function.
The set of supported methods must be a subset of the set returned by
CallingConvention.getSupportedMethods()
.
The default implementation of this method returns the set returned by
CallingConvention.getSupportedMethods()
.
request
- the request to determine the supported methods for.
String
array, can be null
.protected Element parseXMLRequest(HttpServletRequest httpRequest) throws IllegalArgumentException, InvalidRequestException
This method uses a cache to optimize performance if either of the
parseXMLRequest
methods is called multiple times for the
same request.
Calling this method is equivalent with calling
CallingConvention.parseXMLRequest(HttpServletRequest,boolean)
with the
checkType
argument set to true
.
httpRequest
- the HTTP request, cannot be null
.
null
.
IllegalArgumentException
- if httpRequest == null
.
InvalidRequestException
- if the HTTP request cannot be read or cannot be parsed correctly.protected Element parseXMLRequest(HttpServletRequest httpRequest, boolean checkType) throws IllegalArgumentException, InvalidRequestException
Since XINS 1.4.0, this method uses a cache to optimize performance if
either of the parseXMLRequest
methods is called multiple
times for the same request.
httpRequest
- the HTTP request, cannot be null
.checkType
- flag indicating whether this method should check that the content
type of the request is text/xml.
null
.
IllegalArgumentException
- if httpRequest == null
.
InvalidRequestException
- if the HTTP request cannot be read or cannot be parsed correctly.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |