Class AbstractEndpointSpec<INPUT extends AbstractMiddlewareInput,OUTPUT extends AbstractMiddlewareOutputInterface,EXECUTOR extends AbstractMiddlewareExecutor<INPUT,? super OUTPUT>>
java.lang.Object
com.kingsrook.qqq.middleware.javalin.specs.AbstractEndpointSpec<INPUT,OUTPUT,EXECUTOR>
- Direct Known Subclasses:
AuthenticationMetaDataSpecV1,ManageSessionSpecV1,MetaDataSpecV1,ProcessInitSpecV1,ProcessMetaDataSpecV1,ProcessStatusSpecV1,ProcessStepSpecV1,TableCountSpecV1,TableMetaDataSpecV1,TableQuerySpecV1
public abstract class AbstractEndpointSpec<INPUT extends AbstractMiddlewareInput,OUTPUT extends AbstractMiddlewareOutputInterface,EXECUTOR extends AbstractMiddlewareExecutor<INPUT,? super OUTPUT>>
extends Object
Base class for individual endpoint specs.
e.g., one path, that has one "spec" (a "Method" in openapi structure),
with one implementation (executor + input invalid input: '&' output)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract INPUTbuildInput(io.javalin.http.Context context) build the endpoint's input object from a javalin contextprotected voidcustomizeMethod(Method method) voiddefineRoute(AbstractMiddlewareVersion abstractMiddlewareVersion, String versionBasePath) define a javalin route for the specprotected org.json.JSONObjectgetRequestBodyAsJsonObject(io.javalin.http.Context context) protected StringgetRequestParam(io.javalin.http.Context context, String name) protected IntegergetRequestParamInteger(io.javalin.http.Context context, String name) protected Map<String, Serializable> getRequestParamMap(io.javalin.http.Context context, String name) protected voidhandleException(io.javalin.http.Context context, Exception e) voidhandleOutput(io.javalin.http.Context context, OUTPUT output) build the endpoint's http response (written to the javalin context) from an execution output objectbooleanConstruct a new instance of the executor class, based on type-argumentConstruct a new instance of the output class, based on type-argumentserveRequest(AbstractMiddlewareVersion abstractMiddlewareVersion, io.javalin.http.Context context) voidsetQInstance(QInstance qInstance) For initial setup when server boots, set the qInstance - but also, e.g., for development, to do a hot-swap.
-
Field Details
-
qInstance
-
-
Constructor Details
-
AbstractEndpointSpec
public AbstractEndpointSpec()
-
-
Method Details
-
buildInput
-
handleOutput
-
newExecutor
Construct a new instance of the executor class, based on type-argument -
newOutput
Construct a new instance of the output class, based on type-argument -
defineRoute
public void defineRoute(AbstractMiddlewareVersion abstractMiddlewareVersion, String versionBasePath) define a javalin route for the spec -
serveRequest
public OUTPUT serveRequest(AbstractMiddlewareVersion abstractMiddlewareVersion, io.javalin.http.Context context) throws Exception - Throws:
Exception
-
handleException
-
defineMethod
-
customizeMethod
-
defineBasicOperation
-
defineCompleteOperation
-
isSecured
public boolean isSecured() -
defineBasicSuccessResponse
-
defineAdditionalBasicResponses
-
defineResponses
-
defineRequestParameters
-
defineRequestBody
-
defineComponentSchemas
-
getRequestBodyAsJsonObject
protected org.json.JSONObject getRequestBodyAsJsonObject(io.javalin.http.Context context) -
getRequestParam
-
getRequestParamMap
-
getRequestParamInteger
-
setQInstance
For initial setup when server boots, set the qInstance - but also, e.g., for development, to do a hot-swap.
-