{title:'REST Server Overview'}
A REST resource is simply a Java class annotated with {@link oajr.annotation.Rest}. The most common case is a class that extends {@link oajr.servlet.BasicRestServlet}, which itself is simply an extension of {@link javax.servlet.http.HttpServlet} which allows it to be deployed as a servlet.
|
This is what it looks like in a browser.
| http://localhost:10000/helloWorld
Child Resources are REST servlets or objects that are linked to parent resources through the {@link oajr.annotation.Rest#children() @Rest(children)} annotation.
|
|
The path of the child resource gets appended to the path of the parent resource.
So in the example above, the child resource is accessed through the URL
A HUGE advantage of using child resources is that they do not need to be declared in the JEE
The {@link oajr.servlet.BasicRestServletGroup} class provides a default "router" page for child resources when a parent resource is nothing more than a grouping of child resources.
The
|
When you bring up this resource in a browser, you see the following that provides a list of navigable links to your child resources:
| http://localhost:10000
The real power behind the REST server API is the ability to define Java methods as REST endpoints.
|
Java methods on {@link oajr.annotation.Rest @Rest}-annotated classes have the following format:
|
The various parts require their own topics to fully appreciate the scope of abilities, but the following is a summary:
The {@link oajr.servlet.BasicRestServlet} class is the entry point for your REST resources.
It extends directly from
When the servlet
Most developers are not going to be using the
The {@link oajr.springboot.BasicSpringRestServlet} class is typically entry point for your REST resources when working within a Spring Boot environment.
The
Most developers are not going to be using the
|
|