public abstract class RemoteableServlet extends BasicRestServlet
Remoteable services are POJOs whose methods can be invoked remotely through proxy interfaces.
To implement a remoteable service, developers must simply subclass from this class and implement the
getServiceMap()
method that maps java interfaces to POJO instances.
Constructor and Description |
---|
RemoteableServlet() |
Modifier and Type | Method and Description |
---|---|
List<LinkString> |
getInterfaces(RestRequest req)
[GET /] - Get the list of all remote interfaces.
|
protected abstract Map<Class<?>,Object> |
getServiceMap()
Returns the list of interfaces to their implementation objects.
|
Object |
invoke(RestRequest req,
String javaInterface,
String javaMethod)
[POST /{javaInterface}/{javaMethod}] - Invoke the specified service method.
|
Collection<LinkString> |
listMethods(RestRequest req,
String javaInterface)
[GET /{javaInterface] - Get the list of all remoteable methods on the specified interface name.
|
Div |
showEntryForm(RestRequest req,
String javaInterface,
String javaMethod)
[GET /{javaInterface] - Get the list of all remoteable methods on the specified interface name.
|
getOptions
destroy, getContext, getProperties, getServletConfig, init, log, log, log, log, logObjects, service
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public RemoteableServlet()
protected abstract Map<Class<?>,Object> getServiceMap() throws Exception
This class is called often and not cached, so any caching should occur in the subclass if necessary.
Exception
@RestMethod(name="GET", path="/") public List<LinkString> getInterfaces(RestRequest req) throws Exception
req
- The HTTP servlet request.Exception
@RestMethod(name="GET", path="/{javaInterface}", summary="List of available methods on $RP{javaInterface}.") public Collection<LinkString> listMethods(RestRequest req, @Path(value="javaInterface") String javaInterface) throws Exception
req
- The HTTP servlet request.javaInterface
- The Java interface name.Exception
@RestMethod(name="GET", path="/{javaInterface}/{javaMethod}", summary="Form entry for method $RP{javaMethod} on interface $RP{javaInterface}") public Div showEntryForm(RestRequest req, @Path(value="javaInterface") String javaInterface, @Path(value="javaMethod") String javaMethod) throws Exception
req
- The HTTP servlet request.javaInterface
- The Java interface name.javaMethod
- The Java method name or signature.Exception
@RestMethod(name="POST", path="/{javaInterface}/{javaMethod}") public Object invoke(RestRequest req, @Path String javaInterface, @Path String javaMethod) throws Exception
req
- The HTTP request.javaInterface
- The Java interface name.javaMethod
- The Java method name or signature.Exception
Copyright © 2018 Apache. All rights reserved.