public abstract class RrpcServlet extends BasicRestServlet
Remote Interface Services are POJOs whose methods can be invoked remotely through proxy interfaces.
To implement a remote interface service, developers must simply subclass from this class and implement the
getServiceMap()
method that maps java interfaces to POJO instances.
Constructor and Description |
---|
RrpcServlet() |
Modifier and Type | Method and Description |
---|---|
List<LinkString> |
getInterfaces() |
protected abstract Map<Class<?>,Object> |
getServiceMap()
Returns the list of interfaces to their implementation objects.
|
Object |
invoke(Reader r,
ReaderParser p,
ContentType contentType,
String javaInterface,
String javaMethod) |
Collection<LinkString> |
listMethods(String javaInterface) |
Div |
showEntryForm(String javaInterface,
String javaMethod) |
getOptions
destroy, getContext, getProperties, getRequest, getResponse, getServletConfig, init, log, log, log, log, logObjects, service, setContext
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public RrpcServlet()
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="/", summary="List of available remote interfaces", description="Shows a list of the interfaces registered with this remote interface servlet.") public List<LinkString> getInterfaces() throws Exception
Exception
@RestMethod(name="GET", path="/{javaInterface}", summary="List of available methods on interface", description="Shows a list of all the exposed methods on an interface.", htmldoc=) public Collection<LinkString> listMethods(@Path(name="javaInterface",description="Java interface name",example="com.foo.MyInterface") String javaInterface) throws Exception
Exception
@RestMethod(name="GET", path="/{javaInterface}/{javaMethod}", summary="Form entry for interface method call", description="Shows a form entry page for executing a remote interface method.", htmldoc=) public Div showEntryForm(@Path(name="javaInterface",description="Java interface name",example="com.foo.MyInterface") String javaInterface, @Path(name="javaMethod",description="Java method name",example="myMethod") String javaMethod) throws NotFound, Exception
@RestMethod(name="POST", path="/{javaInterface}/{javaMethod}", summary="Invoke an interface method", description="Invoke a Java method by passing in the arguments as an array of serialized objects.\nThe returned object is then serialized to the response.", htmldoc=, swagger=) public Object invoke(Reader r, ReaderParser p, @Header(value="Content-Type") ContentType contentType, @Path(name="javaInterface",description="Java interface name",example="com.foo.MyInterface") String javaInterface, @Path(name="javaMethod",description="Java method name",example="myMethod") String javaMethod) throws UnsupportedMediaType, NotFound, Exception
UnsupportedMediaType
NotFound
Exception
Copyright © 2018 Apache. All rights reserved.