Goals
- Simplify how remoteable interface proxies are exposed in the server and used in the clients.
User interaction and design
The goal on the server side is to simply map a method URL to a method using the existing @RestMethod annotation. A new "PROXY" method name is used in place of the usual GET/PUT/POST/DELETE...
/** @RestProxy(path="/proxy/*") @Remoteable(path="/proxy/*") |
- A GET request against /proxy returns the method signatures that can be called on the interface.
- POST requests are used to invoke methods. The signature for a method request with a String and boolean parameter would be...
- POST /resource-uri/proxy/callMyMethod(java.lang.String,boolean)
- The parameters are passed in the HTTP request body as an array of object (e.g. ["foo",true]).
- The response is serialized and sent back in the HTTP response body.
On the client side, the proxy is retrieved using the RestClient class:
IAddressBook ab = |
Optionally, the @Remoteable annotation can be used to specify the URL on the client side....
@Remoteable(path="/addressBook/proxy")
// or a new @RestProxy annotation with no path? @RestProxy IAddressBook ab = |
Questions...
- Can the path on the @Remoteable annotation be used in leu of the path attribute in the @RestMethod annotation? I'm not sure how that would work with the path defined on the servlet class. Would we cause an error if @RestResource(path="/addressBook") is defined and the @Remoteable path does not start with /addressBook?
- Would the @Remoteable path be used by the RemoteableServlet as well?
- Can/should the @Remoteable path allow for absolute URLs as well?