Package io.nitric.faas.http
Class HttpMiddleware
- java.lang.Object
-
- io.nitric.faas.http.HttpMiddleware
-
- Direct Known Subclasses:
HttpMiddleware.FinalMiddleware
,HttpMiddleware.HandlerAdapter
,TriggerProcessor.HttpMiddlewareWrapper
public abstract class HttpMiddleware extends Object
Provides a HTTP Middleware handler class.
- See Also:
HttpContext
,HttpHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HttpMiddleware.FinalMiddleware
Provides the final HttpMiddleware in the chain.static class
HttpMiddleware.HandlerAdapter
Provides a HttpHandler to HttpMiddleware adapter class.
-
Field Summary
Fields Modifier and Type Field Description static HttpMiddleware
FINAL_MIDDLEWARE
The final middleware in the chain.protected HttpMiddleware
next
The next HttpMiddleware to execute.
-
Constructor Summary
Constructors Constructor Description HttpMiddleware()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description HttpMiddleware
getNext()
Return the next HttpMiddleware to process request context.abstract HttpContext
handle(HttpContext context, HttpMiddleware next)
Handle the Http Request and invoke the next handler in the chain.void
setNext(HttpMiddleware middleware)
Set the next HttpMiddleware to process request context.
-
-
-
Field Detail
-
FINAL_MIDDLEWARE
public static HttpMiddleware FINAL_MIDDLEWARE
The final middleware in the chain.
-
next
protected HttpMiddleware next
The next HttpMiddleware to execute.
-
-
Method Detail
-
handle
public abstract HttpContext handle(HttpContext context, HttpMiddleware next)
Handle the Http Request and invoke the next handler in the chain.- Parameters:
context
- the HTTP request/response contextnext
- the next HttpMiddleware handler to invoke in the chain- Returns:
- the context object returned by the next handler
-
getNext
public HttpMiddleware getNext()
Return the next HttpMiddleware to process request context. If no next middleware configured, then this method will return the FinalMiddleware.- Returns:
- the next HttpMiddleware to process request context
-
setNext
public void setNext(HttpMiddleware middleware)
Set the next HttpMiddleware to process request context.- Parameters:
middleware
- the next HttpMiddleware to process request context (required)
-
-