Interface RouteGroup.RouteMounter
- All Known Subinterfaces:
RouteGroup.ListRouteMounter<T>
- Enclosing interface:
- RouteGroup
public static interface RouteGroup.RouteMounter
-
Method Summary
Modifier and TypeMethodDescriptionacceptedTypes
(String... acceptedTypes) The content types that this route can accept.accessControl
(AccessControlStrategy accessControl) Adds an access control strategy to this route.default RouteGroup.RouteMounter
Enables caching.cache
(long time, TimeUnit timeUnit, RouteGroup.CacheKeyGen keyGen) Enables caching.concurrency
(int concurrencyLimit, int waitTime) Sets the maximum number of concurrent instances of this route that may be handled at one time.gzip()
Delegates togzip(boolean)
with a param of falsegzip
(boolean withContentLength) Will encode the result in a gzip output stream if the incoming request specifies that it accepts gzip in the Accept-Encoding header.handler
(RouteHandler handler) The handler that fetches the information from this route.<T> RouteGroup.ListRouteMounter<T>
itemListHandler
(ItemListRouteHandler<T> handler) Specialized handler for item list routes which support query-string style parameters for paging, filtering, searching, and sorting.method
(HttpMethod method) The HTTP method that triggers this route.void
mount()
Call this at the end to mount the routenocache()
Will set the `Cache-Control: no-cache, no-store` header on the response.openApi
(Consumer<OpenApiOperationBuilder> openApiConfigurationDelegate) If this method is invoked, the route will be exposed as part of the gateway's open api descriptor file, mounted at /openapi.json.renderer
(ResponseRenderer renderer) An optional renderer that will transform the model result of the RouteHandler into a body stringrequirePermission
(PermissionType permissionType) Adds access control strategies to this route that will require that the permissions required for the given access type are possessed by the calling client.The content type of the response.
-
Method Details
-
method
The HTTP method that triggers this route. Default is GET -
type
The content type of the response. Default is "text/plain" -
acceptedTypes
The content types that this route can accept. Default is */*. If the request's content-type header contains a mime type that does not match any of the accepted content types, then "415 - Unsupported Media Type" and the proper "Accept" header is returned to the client from this route. -
handler
The handler that fetches the information from this route. May not be used in combination withitemListHandler(ItemListRouteHandler)
-
itemListHandler
Specialized handler for item list routes which support query-string style parameters for paging, filtering, searching, and sorting. May not be used in combination withhandler(RouteHandler)
Calling this method also implies method=GET and type=application/json, and therefore those attributes need not be specified. -
renderer
An optional renderer that will transform the model result of the RouteHandler into a body string -
accessControl
Adds an access control strategy to this route. If multiple access controls strategies are added, only one must pass for the request to be allowed. In other words, the strategies are combined with an OR. UseAccessControlStrategy.OPEN_ROUTE
to allow all requests.If no access control strategy is added, the route will always be denied.
-
requirePermission
Adds access control strategies to this route that will require that the permissions required for the given access type are possessed by the calling client. -
concurrency
Sets the maximum number of concurrent instances of this route that may be handled at one time. Additional incoming requests will receive an HTTP 503. Default setting is count=5, wait=2000ms- Parameters:
concurrencyLimit
- Number of concurrent instances allowed to be executing at a timewaitTime
- Amount of time, in milliseconds, to wait for a slot to become available before a 503
-
cache
Enables caching. This version assumes that the route does not look at any arguments (i.e. the route's return value does not depend on any arguments, and so only a single value needs to be cached.)- Parameters:
time
- Amount of time for items in the cache to be held. Not a guarantee, as values will be soft.timeUnit
- unit for the time argument.
-
cache
Enables caching. This version takes a CacheKeyGen, which should calculate a hashable key representing the set of params that make each request unique so that cached values can be cached based on keys. Consider using something likeMultikey
for this purpose. -
nocache
RouteGroup.RouteMounter nocache()Will set the `Cache-Control: no-cache, no-store` header on the response. Will also set the `Pragma: no-cache` header on the response for HTTP/1.0 backwards-compatibility. -
gzip
RouteGroup.RouteMounter gzip()Delegates togzip(boolean)
with a param of false -
gzip
Will encode the result in a gzip output stream if the incoming request specifies that it accepts gzip in the Accept-Encoding header.- Parameters:
withContentLength
- if true, the response will include the Content-Length header with the length of the gzipped response. if false, the content length will not be calculated and the length will be indeterminate from the client's perspective
-
openApi
If this method is invoked, the route will be exposed as part of the gateway's open api descriptor file, mounted at /openapi.json. Use the providedOpenApiOperationBuilder
to configure your settings. Note that routes mounted with wildcard paths are not eligible. Also, any path parameters will be exposed and should be documented. -
mount
void mount()Call this at the end to mount the route
-