Java Doc for CallingConvention.java in  » Web-Services » xins » org » xins » server » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Services » xins » org.xins.server 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.xins.common.manageable.Manageable
      org.xins.server.CallingConvention

All known Subclasses:   org.xins.server.XMLRPCCallingConvention,  org.xins.server.CustomCallingConvention,  org.xins.server.JSONCallingConvention,  org.xins.server.JSONRPCCallingConvention,  org.xins.server.XMLCallingConvention,  org.xins.server.SOAPCallingConvention,  org.xins.server.StandardCallingConvention,
CallingConvention
abstract class CallingConvention extends Manageable (Code)
Abstraction of a calling convention. A calling convention determines how an HTTP request is converted to a XINS function invocation request and how a XINS function result is converted back to an HTTP response.

Thread safety

Calling convention implementations must be thread-safe.
version:
   $Revision: 1.105.2.1 $ $Date: 2007/09/27 14:43:33 $
author:
   Anthony Goubard
author:
   Ernst de Haan
See Also:   CallingConventionManager




Constructor Summary
protected  CallingConvention()
     Constructs a new CallingConvention.

Method Summary
static  voidcleanUpParameters(BasicPropertyReader parameters)
     Changes a parameter set to remove all parameters that should not be passed to functions.
final  FunctionRequestconvertRequest(HttpServletRequest httpRequest)
     Converts an HTTP request to a XINS request (wrapper method).
abstract protected  FunctionRequestconvertRequestImpl(HttpServletRequest httpRequest)
     Converts an HTTP request to a XINS request (implementation method).
final  voidconvertResult(FunctionResult xinsResult, HttpServletResponse httpResponse, HttpServletRequest httpRequest)
     Converts a XINS result to an HTTP response (wrapper method).
abstract protected  voidconvertResultImpl(FunctionResult xinsResult, HttpServletResponse httpResponse, HttpServletRequest httpRequest)
     Converts a XINS result to an HTTP response (implementation method).
 BasicPropertyReadergatherParams(HttpServletRequest httpRequest)
     Gathers all parameters from the specified request.
final protected  APIgetAPI()
     Determines the current API.
final  StringgetConventionName()
     Gets the name of the convention associated with this CC.
protected  String[]getSupportedMethods()
     Determines which HTTP methods are supported for function invocations.

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.

protected  String[]getSupportedMethods(HttpServletRequest request)
     Determines which HTTP methods are supported for function invocations, for the specified request.

Each String in the returned array must be one supported method.

The returned array may be null.

abstract protected  booleanmatches(HttpServletRequest httpRequest)
     Checks if the specified request can possibly be handled by this calling convention as a function invocation.

Implementations of this method should be optimized for performance, as this method may be called for each incoming request.

final  booleanmatchesRequest(HttpServletRequest httpRequest)
     Checks if the specified request can be handled by this calling convention.
protected  ElementparseXMLRequest(HttpServletRequest httpRequest)
     Parses XML from the specified HTTP request and checks that the content type is correct.
protected  ElementparseXMLRequest(HttpServletRequest httpRequest, boolean checkType)
     Parses XML from the specified HTTP request and optionally checks that the content type is correct.
final  voidsetAPI(API api)
     Sets the current API.
final  voidsetConventionName(String conventionName)
     Sets the name of the convention associated with this CC.


Constructor Detail
CallingConvention
protected CallingConvention()(Code)
Constructs a new CallingConvention. A CallingConvention instance can only be generated by the XINS/Java Server Framework.




Method Detail
cleanUpParameters
static void cleanUpParameters(BasicPropertyReader parameters) throws IllegalArgumentException(Code)
Changes a parameter set to remove all parameters that should not be passed to functions.

A parameter will be removed if it matches any of the following conditions:

  • parameter name is null;
  • parameter name is empty;
  • parameter value is null;
  • parameter value is empty;
  • parameter name equals "function".

Parameters:
  parameters - the BasicPropertyReader containing the set of parametersto investigate, cannot be null.
throws:
  IllegalArgumentException - if parameters == null.



convertRequest
final FunctionRequest convertRequest(HttpServletRequest httpRequest) throws IllegalStateException, IllegalArgumentException, InvalidRequestException, FunctionNotSpecifiedException(Code)
Converts an HTTP request to a XINS request (wrapper method). This method checks the arguments, checks that the HTTP method is actually supported, calls the implementation method and then checks the return value from that method.
Parameters:
  httpRequest - the HTTP request, cannot be null.the XINS request object, never null.
throws:
  IllegalStateException - if this calling convention is currently not usable, seeManageable.assertUsable.
throws:
  IllegalArgumentException - if httpRequest == null.
throws:
  InvalidRequestException - if the request is considerd to be invalid, at least for this callingconvention; either because the HTTP method is not supported, orbecause CallingConvention.convertRequestImpl(HttpServletRequest) indicates so.
throws:
  FunctionNotSpecifiedException - if the request does not indicate the name of the function to execute.



convertRequestImpl
abstract protected FunctionRequest convertRequestImpl(HttpServletRequest httpRequest) throws InvalidRequestException, FunctionNotSpecifiedException(Code)
Converts an HTTP request to a XINS request (implementation method). This method should only be called from the XINS/Java Server Framework self. Then it is guaranteed that:

Note that CallingConvention.getSupportedMethods(HttpServletRequest) will not have been called prior to this method call.
Parameters:
  httpRequest - the HTTP request.the XINS request object, should not be null.
throws:
  InvalidRequestException - if the request is considerd to be invalid.
throws:
  FunctionNotSpecifiedException - if the request does not indicate the name of the function to execute.




convertResult
final void convertResult(FunctionResult xinsResult, HttpServletResponse httpResponse, HttpServletRequest httpRequest) throws IllegalStateException, IllegalArgumentException, IOException(Code)
Converts a XINS result to an HTTP response (wrapper method). This method checks the arguments, then calls the implementation method and then checks the return value from that method.

Note that this method is not called if there is an error while converting the request.
Parameters:
  xinsResult - the XINS result object that should be converted to an HTTP response,cannot be null.
Parameters:
  httpResponse - the HTTP response object to configure, cannot be null.
Parameters:
  httpRequest - the HTTP request, cannot be null.
throws:
  IllegalStateException - if this calling convention is currently not usable, seeManageable.assertUsable.
throws:
  IllegalArgumentException - if xinsResult == null|| httpResponse == null|| httpRequest == null.
throws:
  IOException - if the invocation of any of the methods in eitherhttpResponse or httpRequest caused an I/Oerror.




convertResultImpl
abstract protected void convertResultImpl(FunctionResult xinsResult, HttpServletResponse httpResponse, HttpServletRequest httpRequest) throws IOException(Code)
Converts a XINS result to an HTTP response (implementation method). This method should only be called from the XINS/Java Server Framework self. Then it is guaranteed that none of the arguments is null.
Parameters:
  xinsResult - the XINS result object that should be converted to an HTTP response,will not be null.
Parameters:
  httpResponse - the HTTP response object to configure.
Parameters:
  httpRequest - the HTTP request.
throws:
  IOException - if the invocation of any of the methods in eitherhttpResponse or httpRequest caused an I/Oerror.



gatherParams
BasicPropertyReader gatherParams(HttpServletRequest httpRequest) throws InvalidRequestException(Code)
Gathers all parameters from the specified request. The parameters are returned as a BasicPropertyReader . If no parameters are found, then null is returned.

If a parameter is found to have multiple values, then an InvalidRequestException is thrown.
Parameters:
  httpRequest - the HTTP request to get the parameters from, cannot benull.the properties found, or null if none were found.
throws:
  InvalidRequestException - if a parameter is found that has multiple values.




getAPI
final protected API getAPI()(Code)
Determines the current API. the current API, never null.
since:
   XINS 1.5.0



getConventionName
final String getConventionName()(Code)
Gets the name of the convention associated with this CC. the name of this calling convention, never null.
since:
   XINS 2.1



getSupportedMethods
protected String[] getSupportedMethods()(Code)
Determines which HTTP methods are supported for function invocations.

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. the HTTP methods supported, in a String array, mustnot be null.
since:
   XINS 1.5.0




getSupportedMethods
protected String[] getSupportedMethods(HttpServletRequest request)(Code)
Determines which HTTP methods are supported for function invocations, for the specified 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() .
Parameters:
  request - the request to determine the supported methods for.the HTTP methods supported for the specified request, in aString array, can be null.
since:
   XINS 1.5.0




matches
abstract protected boolean matches(HttpServletRequest httpRequest) throws Exception(Code)
Checks if the specified request can possibly be handled by this calling convention as a function invocation.

Implementations of this method should be optimized for performance, as this method may be called for each incoming request. Also, this method should not have any side-effects except possibly some caching in case there is a match.

If this method throws any exception, the exception is logged as an ignorable exception and false is assumed.

This method should only be called by the XINS/Java Server Framework.
Parameters:
  httpRequest - the HTTP request to investigate, never null.true if this calling convention is possiblyable to handle this request, or false if it isdefinitely not able to handle this request.
throws:
  Exception - if analysis of the request causes an exception; in this casefalse will be assumed by the framework.
since:
   XINS 1.4.0




matchesRequest
final boolean matchesRequest(HttpServletRequest httpRequest)(Code)
Checks if the specified request can be handled by this calling convention. Assuming this CallingConvention instance is usable and the HTTP method is supported, this method delegates to CallingConvention.matches(HttpServletRequest) .

If this calling convention is not usable (see CallingConvention.isUsable() ), then false is returned, even before calling CallingConvention.matches(HttpServletRequest) .

If this method does not support the HTTP method for function invocations, then false is returned.

If CallingConvention.matches(HttpServletRequest) throws an exception, then this exception is ignored and false is returned.

This method is guaranteed not to throw any exception.
Parameters:
  httpRequest - the HTTP request to investigate, cannot be null.true if this calling convention is possiblyable to handle this request, or false if it isdefinitely not able to handle this request.




parseXMLRequest
protected Element parseXMLRequest(HttpServletRequest httpRequest) throws IllegalArgumentException, InvalidRequestException(Code)
Parses XML from the specified HTTP request and checks that the content type is correct.

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.
Parameters:
  httpRequest - the HTTP request, cannot be null.the parsed element, never null.
throws:
  IllegalArgumentException - if httpRequest == null.
throws:
  InvalidRequestException - if the HTTP request cannot be read or cannot be parsed correctly.
since:
   XINS 1.4.0




parseXMLRequest
protected Element parseXMLRequest(HttpServletRequest httpRequest, boolean checkType) throws IllegalArgumentException, InvalidRequestException(Code)
Parses XML from the specified HTTP request and optionally checks that the content type is correct.

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.
Parameters:
  httpRequest - the HTTP request, cannot be null.
Parameters:
  checkType - flag indicating whether this method should check that the contenttype of the request is text/xml.the parsed element, never null.
throws:
  IllegalArgumentException - if httpRequest == null.
throws:
  InvalidRequestException - if the HTTP request cannot be read or cannot be parsed correctly.
since:
   XINS 1.3.0




setAPI
final void setAPI(API api)(Code)
Sets the current API.
Parameters:
  api - the current API, never null.



setConventionName
final void setConventionName(String conventionName)(Code)
Sets the name of the convention associated with this CC.
Parameters:
  conventionName - the calling convention name, never null.
since:
   XINS 2.1



Fields inherited from org.xins.common.manageable.Manageable
final public static State BOOTSTRAPPED(Code)(Java Doc)
final public static State BOOTSTRAPPING(Code)(Java Doc)
final public static State DEINITIALIZING(Code)(Java Doc)
final public static State INITIALIZING(Code)(Java Doc)
final public static State UNUSABLE(Code)(Java Doc)
final public static State USABLE(Code)(Java Doc)

Methods inherited from org.xins.common.manageable.Manageable
final protected void assertUsable() throws IllegalStateException(Code)(Java Doc)
final public void bootstrap(PropertyReader properties) throws IllegalStateException, MissingRequiredPropertyException, InvalidPropertyValueException, BootstrapException(Code)(Java Doc)
protected void bootstrapImpl(PropertyReader properties) throws MissingRequiredPropertyException, InvalidPropertyValueException, BootstrapException(Code)(Java Doc)
final public void deinit() throws IllegalStateException, DeinitializationException(Code)(Java Doc)
protected void deinitImpl() throws Throwable(Code)(Java Doc)
final public State getState()(Code)(Java Doc)
final public void init(PropertyReader properties) throws IllegalStateException, MissingRequiredPropertyException, InvalidPropertyValueException, InitializationException(Code)(Java Doc)
protected void initImpl(PropertyReader properties) throws MissingRequiredPropertyException, InvalidPropertyValueException, InitializationException(Code)(Java Doc)
final public boolean isBootstrapped()(Code)(Java Doc)
final public boolean isUsable()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.