Package com.spec.web.expresso.middleware
Class MiddlewareExecutor
java.lang.Object
com.spec.web.expresso.middleware.MiddlewareExecutor
The following class will be used to call the next callback on the callback
chain.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a instance of the classMiddlewareExecutor(MiddlewareMetaData middlewareMetadata) Creates an instance with a single middleware.MiddlewareExecutor(List<MiddlewareMetaData> middlewaresMetadata) Creates and instance with a list of middlewares -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(HttpRequest req, HttpResponse res, String path, String method) The following method will execute request and response on the defined middleware list.
-
Constructor Details
-
MiddlewareExecutor
public MiddlewareExecutor()Constructs a instance of the class -
MiddlewareExecutor
Creates an instance with a single middleware.- Parameters:
middlewareMetadata- the middlware function that needs to be called
-
MiddlewareExecutor
Creates and instance with a list of middlewares- Parameters:
middlewaresMetadata- List of middlewares to add
-
-
Method Details
-
execute
The following method will execute request and response on the defined middleware list.- Parameters:
req- The Http request objectres- The Http response objectpath- The path on which the exector is currently working.method- The http method on which the executor is currently working.
-