Query Servlet
An HttpServlet which receives query requests and handles them via a QueryBridge.
The servlet supports only POST
requests. GET
, HEAD
, PUT
, DELETE
, OPTIONS
, and TRACE
methods are not supported by default.
In order to perform a query, a client should send an HTTP POST
request to this servlet. The request body should be a JSON representation of a io.spine.client.Query.
If the request is valid (i.e. the request body contains a valid Query), the response will contain a message with the query result. The format of the result depends on the implementation of QueryBridge.
If the query cannot be parsed from the request, the response will be empty with the response code 400.
A typical implementation would extend this class and provide a QueryBridge in the constructor. No additional config is required in order for this servlet to handle the entity queries.
A QueryServlet
does not support serialization. Please keep that in mind when selecting a servlet container. When trying to serialize an instance of QueryServlet
, an UnsupportedOperationException is thrown.
Parameters
the type of the query result
Constructors
QueryServlet
with the given QueryBridge.