Interface RouteGroup
public interface RouteGroup
A bundle of routes mounted underneath /data/group-name/*
Each route will be activated when a web request that matches the route's method and path comes into the Ignition webserver. The route handler will then be called to provide a response. The response can then be rendered to a string via the response renderer, if desired. Some examples:
Mounts a text/plain response of "hello, world" at /data/module-id/hello_world
routeGroup.newRoute("/hello_world") .handler((request, response) -> "Hello, world!") .accessControl(AccessControlStrategy.OPEN_ROUTE) .mount();
Mounts a json response that serializes a list of widget objects using GSON
routeGroup.newRoute("/widgets") .handler(this::getWidgetList) .renderer(gson::toJson) .type("application/json") .requirePermission(PermissionType.READ) .mount();
Mounts a json response that fetches a specific object, using url parameter matching. For example, the URL request /data/module-id/widget/8271 would fetch widget with id=8271
routeGroup.newRoute("/widget/:id") .handler((request, response) -> findWidget(request.getParameter("id")) .renderer(gson::toJson) .type("application/json") .requirePermission(PermissionType.READ) .mount();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
static interface
A "list" route is a route that returns a list of items.static interface
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaddOpenApiGroup
(GroupObject group) default RouteGroup
addOpenApiGroup
(String groupName, String... tags) Invoke this to add a group name for open-api exposed routes held within this route group, organized by tag(s).Begin adding a route.
-
Field Details
-
TYPE_PLAIN_TEXT
- See Also:
-
TYPE_JSON
- See Also:
-
TYPE_XML
- See Also:
-
TYPE_TEXT_HTML
- See Also:
-
TYPE_TEXT_CSS
- See Also:
-
TYPE_TEXT_CSV
- See Also:
-
TYPE_IMG_SVG_XML
- See Also:
-
TYPE_IMG_PNG
- See Also:
-
TYPE_ZIP
- See Also:
-
TYPE_OCTET_STREAM
- See Also:
-
PLATFORM_API_GROUP
- See Also:
-
-
Method Details
-
newRoute
Begin adding a route. Creates a RouteMounter object which helps create a valid route -
addOpenApiGroup
Invoke this to add a group name for open-api exposed routes held within this route group, organized by tag(s). -
addOpenApiGroup
-