Utility Beans
The org.apache.juneau.rest.server.beans package contains a set of reusable utility beans meant to help with putting together explorable REST interfaces.
The AboutRest class in the petstore console shows how these
beans are used.
The resource class is hosted in the petstore sample applications at /console/about/beans, rendered below:
ResourceDescriptions
The beans() method shows an example of rendering a list of descriptive links for child endpoints.
@RestGet(path="/beans")
public ResourceDescriptions beans() {
return ResourceDescriptions.create()
.append("BeanDescription", "beans/BeanDescription", "Example of a BeanDescription bean, describing the Pet domain bean")
.append("Hyperlink", "beans/Hyperlink", "Example of a Hyperlink bean")
.append("SeeOtherRoot", "beans/SeeOtherRoot", "Example of a SeeOtherRoot bean");
}
HTML representation

JSON representation

BeanDescription
The beanDescription()
method shows an example of rendering simple schema information about an arbitrary bean class.
@RestGet(path="/beans/BeanDescription")
public BeanDescription beanDescription() {
return BeanDescription.of(Pet.class);
}
HTML representation

JSON representation

Hyperlink
The hyperlink() method shows an
example of rendering a simple hyperlink.
@RestGet(path="/beans/Hyperlink")
public Hyperlink hyperlink() {
return Hyperlink.create("/console/about", "Back to About");
}
HTML representation

JSON representation

SeeOtherRoot
The seeOtherRoot() method
shows an example of sending a 303 See Other with a Location header pointing to the servlet root.
@RestGet(path="/beans/SeeOtherRoot")
public SeeOtherRoot seeOtherRoot() {
return SeeOtherRoot.INSTANCE;
}
Clicking on the link will just redirect to this same page.
Typically this is useful for endpoints where you want to redirect back to the servlet root, such as a DELETE.