Package com.spec.web.expresso.middleware
Class MiddlewareContext
java.lang.Object
com.spec.web.expresso.middleware.MiddlewareContext
The class instance curretly has the following responsibilites.
1. Controls if next middleware should be called or not.
2. Carries data between middlewares using a map.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSets the shouldExecuteNextMiddleware flag to true.Fetches the state value for a key.protected booleanChecks if next middleware shouold be executed.protected voidMarks the middleware executed.voidMarks the middleware not executed.voidSets the state value for a key.protected voidreset()Sets shouldExecuteNextMiddleware to false.protected booleanChecks if middleare was executed.
-
Constructor Details
-
MiddlewareContext
protected MiddlewareContext()Instanstiate the class.
-
-
Method Details
-
executeNextMiddleware
public void executeNextMiddleware()Sets the shouldExecuteNextMiddleware flag to true. -
reset
protected void reset()Sets shouldExecuteNextMiddleware to false. -
isFlowAllowed
protected boolean isFlowAllowed()Checks if next middleware shouold be executed.- Returns:
- Returns true if allowed.
-
markMiddlewareExecuted
protected void markMiddlewareExecuted()Marks the middleware executed. -
markMiddlewareNotExecuted
public void markMiddlewareNotExecuted()Marks the middleware not executed. -
wasMiddlewareExecutedOnCurrentPath
protected boolean wasMiddlewareExecutedOnCurrentPath()Checks if middleare was executed.- Returns:
- True if executed.
-
putState
-
getState
-