public abstract class AbstractRestDbHandler
extends io.cdap.http.AbstractHttpHandler
To assign an entry point to a handler, use the Path
annotation with the URI as value.
This annotation can also be used on methods of the handler to create entry
points below the handler's one.
For each entry point, all the desired HTTP methods must be assigned a
corresponding Java method using the
appropriate HttpMethod
. These methods must all have an
HttpRequest
and a
HttpResponder
as their first 2 parameters, which
correspond respectively to the
request and its reply. The methods may also have other parameters marked with
the
PathParam
annotation, meaning that these parameters
correspond to the {id} given in the
URI of the request. Some parameters may also be marked with the QueryParam
an
annotation, in which case the parameter marked is referring to the query
parameter whose name is given in
the annotation's parameter. A query parameter can be given a default value
with the
DefaultValue
which will be assigned to the parameter when
the request does not contain
a value for it.
These methods should also be annotated with the Consumes
annotation to indicate the
expected content type of the request. Finally, each method should also be
annotated with the
RequiredRole
annotation to make the method only accessible to users
with the specified
RoleDefault.ROLE
or higher.
Modifier and Type | Field and Description |
---|---|
protected byte |
crud
A byte mask defining which HTTP methods are allowed on the handler.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractRestDbHandler(byte crud)
Initializes the handler with the given CRUD mask.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkCRUD(io.netty.handler.codec.http.HttpRequest request)
Checks whether the
HttpRequest given can be made on the handler
in accordance with the handler's
CRUD configuration. |
protected final byte crud
protected AbstractRestDbHandler(byte crud)
crud
- the CRUD mask for this handlerpublic boolean checkCRUD(io.netty.handler.codec.http.HttpRequest request)
HttpRequest
given can be made on the handler
in accordance with the handler's
CRUD configuration.request
- the HTTP request to checktrue
if the request is active, false
otherwise.Copyright © 2009–2020 Waarp. All rights reserved.