Java Doc for RPC.java in  » Ajax » GWT » com » google » gwt » user » server » rpc » 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 » Ajax » GWT » com.google.gwt.user.server.rpc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.google.gwt.user.server.rpc.RPC

RPC
final public class RPC (Code)
Utility class for integrating with the RPC system. This class exposes methods for decoding of RPC requests, encoding of RPC responses, and invocation of RPC calls on service objects. The operations exposed by this class can be reused by framework implementors such as Spring and G4jsf to support a wide range of service invocation policies.

Canonical Example

The following example demonstrates the canonical way to use this class.

Advanced Example

The following example shows a more advanced way of using this class to create an adapter between GWT RPC entities and POJOs.




Method Summary
public static  RPCRequestdecodeRequest(String encodedRequest)
     Returns an RPCRequest that is built by decoding the contents of an encoded RPC request.
public static  RPCRequestdecodeRequest(String encodedRequest, Class type)
     Returns an RPCRequest that is built by decoding the contents of an encoded RPC request and optionally validating that type can handle the request.
public static  RPCRequestdecodeRequest(String encodedRequest, Class type, SerializationPolicyProvider serializationPolicyProvider)
     Returns an RPCRequest that is built by decoding the contents of an encoded RPC request and optionally validating that type can handle the request.
public static  StringencodeResponseForFailure(Method serviceMethod, Throwable cause)
     Returns a string that encodes an exception.
public static  StringencodeResponseForFailure(Method serviceMethod, Throwable cause, SerializationPolicy serializationPolicy)
     Returns a string that encodes an exception.
public static  StringencodeResponseForSuccess(Method serviceMethod, Object object)
     Returns a string that encodes the object.
public static  StringencodeResponseForSuccess(Method serviceMethod, Object object, SerializationPolicy serializationPolicy)
     Returns a string that encodes the object.
public static  SerializationPolicygetDefaultSerializationPolicy()
     Returns a default serialization policy.
public static  StringinvokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args)
     Returns a string that encodes the result of calling a service method, which could be the value returned by the method or an exception thrown by it.
public static  StringinvokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args, SerializationPolicy serializationPolicy)
     Returns a string that encodes the result of calling a service method, which could be the value returned by the method or an exception thrown by it.

If the serializationPolicy parameter is not null, it is used to determine what types can be encoded as part of this response.




Method Detail
decodeRequest
public static RPCRequest decodeRequest(String encodedRequest)(Code)
Returns an RPCRequest that is built by decoding the contents of an encoded RPC request.

This method is equivalent to calling RPC.decodeRequest(String,Class) with null for the type parameter.


Parameters:
  encodedRequest - a string that encodes the RemoteServiceinterface, the service method to call, and the arguments to forthe service method an RPCRequest instance
throws:
  IncompatibleRemoteServiceException - if any of the followingconditions apply:
  • if the types in the encoded request cannot be deserialized
  • if the ClassLoader acquired fromThread.currentThread().getContextClassLoader()cannot load the service interface or any of the types specifiedin the encodedRequest
  • the requested interface is not assignable toRemoteService
  • the service method requested in the encodedRequest is not amember of the requested service interface
  • the type parameter is not null and is notassignable to the requested RemoteService interface



decodeRequest
public static RPCRequest decodeRequest(String encodedRequest, Class type)(Code)
Returns an RPCRequest that is built by decoding the contents of an encoded RPC request and optionally validating that type can handle the request. If the type parameter is not null, the implementation checks that the type is assignable to the RemoteService interface requested in the encoded request string.

Invoking this method with null for the type parameter, decodeRequest(encodedRequest, null), is equivalent to calling decodeRequest(encodedRequest).


Parameters:
  encodedRequest - a string that encodes the RemoteServiceinterface, the service method, and the arguments to pass to theservice method
Parameters:
  type - if not null, the implementation checks that thetype is assignable to the RemoteService interface encodedin the encoded request string. an RPCRequest instance
throws:
  NullPointerException - if the encodedRequest is null
throws:
  IllegalArgumentException - if the encodedRequest is an empty string
throws:
  IncompatibleRemoteServiceException - if any of the followingconditions apply:
  • if the types in the encoded request cannot be deserialized
  • if the ClassLoader acquired fromThread.currentThread().getContextClassLoader()cannot load the service interface or any of the types specifiedin the encodedRequest
  • the requested interface is not assignable toRemoteService
  • the service method requested in the encodedRequest is not amember of the requested service interface
  • the type parameter is not null and is notassignable to the requested RemoteService interface



decodeRequest
public static RPCRequest decodeRequest(String encodedRequest, Class type, SerializationPolicyProvider serializationPolicyProvider)(Code)
Returns an RPCRequest that is built by decoding the contents of an encoded RPC request and optionally validating that type can handle the request. If the type parameter is not null, the implementation checks that the type is assignable to the RemoteService interface requested in the encoded request string.

If the serializationPolicyProvider parameter is not null, it is asked for a SerializationPolicy to use to restrict the set of types that can be decoded from the request. If this parameter is null, then only subtypes of com.google.gwt.user.client.rpc.IsSerializable IsSerializable or types which have custom field serializers can be decoded.

Invoking this method with null for the type parameter, decodeRequest(encodedRequest, null), is equivalent to calling decodeRequest(encodedRequest).


Parameters:
  encodedRequest - a string that encodes the RemoteServiceinterface, the service method, and the arguments to pass to theservice method
Parameters:
  type - if not null, the implementation checks that thetype is assignable to the RemoteService interface encodedin the encoded request string.
Parameters:
  serializationPolicyProvider - if not null, theimplementation asks this provider for aSerializationPolicy which will be used to restrict the setof types that can be decoded from this request an RPCRequest instance
throws:
  NullPointerException - if the encodedRequest is null
throws:
  IllegalArgumentException - if the encodedRequest is an empty string
throws:
  IncompatibleRemoteServiceException - if any of the followingconditions apply:
  • if the types in the encoded request cannot be deserialized
  • if the ClassLoader acquired fromThread.currentThread().getContextClassLoader()cannot load the service interface or any of the types specifiedin the encodedRequest
  • the requested interface is not assignable toRemoteService
  • the service method requested in the encodedRequest is not amember of the requested service interface
  • the type parameter is not null and is notassignable to the requested RemoteService interface



encodeResponseForFailure
public static String encodeResponseForFailure(Method serviceMethod, Throwable cause) throws SerializationException(Code)
Returns a string that encodes an exception. If method is not null, it is an error if the exception is not in the method's list of checked exceptions.
Parameters:
  serviceMethod - the method that threw the exception, may benull
Parameters:
  cause - the Throwable that was thrown a string that encodes the exception
throws:
  NullPointerException - if the the cause is null
throws:
  SerializationException - if the result cannot be serialized
throws:
  UnexpectedException - if the result was an unexpected exception (achecked exception not declared in the serviceMethod's signature)



encodeResponseForFailure
public static String encodeResponseForFailure(Method serviceMethod, Throwable cause, SerializationPolicy serializationPolicy) throws SerializationException(Code)
Returns a string that encodes an exception. If method is not null, it is an error if the exception is not in the method's list of checked exceptions.

If the serializationPolicy parameter is not null, it is used to determine what types can be encoded as part of this response. If this parameter is null, then only subtypes of com.google.gwt.user.client.rpc.IsSerializable IsSerializable or types which have custom field serializers may be encoded.


Parameters:
  serviceMethod - the method that threw the exception, may benull
Parameters:
  cause - the Throwable that was thrown
Parameters:
  serializationPolicy - determines the serialization policy to be used a string that encodes the exception
throws:
  NullPointerException - if the the cause or the serializationPolicyare null
throws:
  SerializationException - if the result cannot be serialized
throws:
  UnexpectedException - if the result was an unexpected exception (achecked exception not declared in the serviceMethod's signature)



encodeResponseForSuccess
public static String encodeResponseForSuccess(Method serviceMethod, Object object) throws SerializationException(Code)
Returns a string that encodes the object. It is an error to try to encode an object that is not assignable to the service method's return type.
Parameters:
  serviceMethod - the method whose result we are encoding
Parameters:
  object - the instance that we wish to encode a string that encodes the object, if the object is compatible withthe service method's declared return type
throws:
  IllegalArgumentException - if the result is not assignable to theservice method's return type
throws:
  NullPointerException - if the service method is null
throws:
  SerializationException - if the result cannot be serialized



encodeResponseForSuccess
public static String encodeResponseForSuccess(Method serviceMethod, Object object, SerializationPolicy serializationPolicy) throws SerializationException(Code)
Returns a string that encodes the object. It is an error to try to encode an object that is not assignable to the service method's return type.

If the serializationPolicy parameter is not null, it is used to determine what types can be encoded as part of this response. If this parameter is null, then only subtypes of com.google.gwt.user.client.rpc.IsSerializable IsSerializable or types which have custom field serializers may be encoded.


Parameters:
  serviceMethod - the method whose result we are encoding
Parameters:
  object - the instance that we wish to encode
Parameters:
  serializationPolicy - determines the serialization policy to be used a string that encodes the object, if the object is compatible withthe service method's declared return type
throws:
  IllegalArgumentException - if the result is not assignable to theservice method's return type
throws:
  NullPointerException - if the serviceMethod or theserializationPolicy are null
throws:
  SerializationException - if the result cannot be serialized



getDefaultSerializationPolicy
public static SerializationPolicy getDefaultSerializationPolicy()(Code)
Returns a default serialization policy. the default serialization policy.



invokeAndEncodeResponse
public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args) throws SerializationException(Code)
Returns a string that encodes the result of calling a service method, which could be the value returned by the method or an exception thrown by it.

This method does no security checking; security checking must be done on the method prior to this invocation.


Parameters:
  target - instance on which to invoke the serviceMethod
Parameters:
  serviceMethod - the method to invoke
Parameters:
  args - arguments used for the method invocation a string which encodes either the method's return or a checkedexception thrown by the method
throws:
  SecurityException - if the method cannot be accessed or if the numberor type of actual and formal arguments differ
throws:
  SerializationException - if an object could not be serialized by thestream
throws:
  UnexpectedException - if the serviceMethod throws a checked exceptionthat is not declared in its signature



invokeAndEncodeResponse
public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args, SerializationPolicy serializationPolicy) throws SerializationException(Code)
Returns a string that encodes the result of calling a service method, which could be the value returned by the method or an exception thrown by it.

If the serializationPolicy parameter is not null, it is used to determine what types can be encoded as part of this response. If this parameter is null, then only subtypes of com.google.gwt.user.client.rpc.IsSerializable IsSerializable or types which have custom field serializers may be encoded.

This method does no security checking; security checking must be done on the method prior to this invocation.


Parameters:
  target - instance on which to invoke the serviceMethod
Parameters:
  serviceMethod - the method to invoke
Parameters:
  args - arguments used for the method invocation
Parameters:
  serializationPolicy - determines the serialization policy to be used a string which encodes either the method's return or a checkedexception thrown by the method
throws:
  NullPointerException - if the serviceMethod or theserializationPolicy are null
throws:
  SecurityException - if the method cannot be accessed or if the numberor type of actual and formal arguments differ
throws:
  SerializationException - if an object could not be serialized by thestream
throws:
  UnexpectedException - if the serviceMethod throws a checked exceptionthat is not declared in its signature



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.