RestServlet
The {@link oajr.RestServlet} class is the entry point for your REST resources.
It extends directly from HttpServlet and is deployed like any other servlet.
When the servlet init() method is called, it triggers the code to find and process the @Rest
annotations on that class and all child classes.
These get constructed into a {@link oajr.RestContext} object that holds all the configuration
information about your resource in a read-only object.
Most developers are not going to be using the RestServlet class itself, and instead will
extend from one of the preconfigured default servlets such as {@link oajr.BasicRestServlet}.
The RestServlet class by itself is not configured with any serializers and parsers, and therefore
not very useful on it's own.
However, the class does provide a couple of convenience methods to be aware of:
- {@link oajr.RestServlet} extends HttpServlet
- {@link oajr.RestServlet#init(ServletConfig) init(ServletConfig)} - Can override to provide custom initialization.
- {@link oajr.RestServlet#service(HttpServletRequest,HttpServletResponse) service(HttpServletRequest,HttpServletResponse)} - Can override to provide custom request handling.
- {@link oajr.RestServlet#destroy() destroy()} - Can override to provide custom cleanup.
- {@link oajr.RestServlet#getContext() getContext()} - Returns all aspects of the configuration of your resource pulled from all annotations on the class/parent-classes and methods.
- {@link oajr.RestServlet#log(Level,String,Object...) log(Level,String,Object...)} - Convenience logging method.
- {@link oajr.RestServlet#log(Level,Throwable,String,Object...) log(Level,Throwable,String,Object...)} - Convenience logging method.