Package com.networknt.handler
Class Handler
- java.lang.Object
-
- com.networknt.handler.Handler
-
public class Handler extends Object
- Author:
- Nicholas Azar
-
-
Field Summary
Fields Modifier and Type Field Description static HandlerConfigconfig
-
Constructor Summary
Constructors Constructor Description Handler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.undertow.server.HttpHandlergetNext(io.undertow.server.HttpServerExchange httpServerExchange)Returns the instance of the next handler, rather then calling handleRequest on it.static io.undertow.server.HttpHandlergetNext(io.undertow.server.HttpServerExchange httpServerExchange, io.undertow.server.HttpHandler next)Returns the instance of the next handler, or the given next param if it's not null.static voidinit()static voidnext(io.undertow.server.HttpServerExchange httpServerExchange)Handle the next request in the chain.static voidnext(io.undertow.server.HttpServerExchange httpServerExchange, io.undertow.server.HttpHandler next)Go to the next handler if the given next is none null.static voidnext(io.undertow.server.HttpServerExchange httpServerExchange, String execName, Boolean returnToOrigFlow)Allow nexting directly to a flow.static voidsetLastHandler(io.undertow.server.HttpHandler handler)static booleanstart(io.undertow.server.HttpServerExchange httpServerExchange)On the first step of the request, match the request against the configured paths.static booleanstartDefaultHandlers(io.undertow.server.HttpServerExchange httpServerExchange)If there is no matching path, the OrchestrationHandler is going to try to start the defaultHandlers.
-
-
-
Field Detail
-
config
public static HandlerConfig config
-
-
Method Detail
-
setLastHandler
public static void setLastHandler(io.undertow.server.HttpHandler handler)
-
init
public static void init()
-
next
public static void next(io.undertow.server.HttpServerExchange httpServerExchange) throws ExceptionHandle the next request in the chain.- Parameters:
httpServerExchange- The current requests server exchange.- Throws:
Exception- Propagated exception in the handleRequest chain.
-
next
public static void next(io.undertow.server.HttpServerExchange httpServerExchange, io.undertow.server.HttpHandler next) throws ExceptionGo to the next handler if the given next is none null. Reason for this is for middleware to provide their instance next if it exists. Since if it exists, the server hasn't been able to find the handler.yml.- Parameters:
httpServerExchange- The current requests server exchange.next- The next HttpHandler to go to if it's not null.- Throws:
Exception- exception
-
next
public static void next(io.undertow.server.HttpServerExchange httpServerExchange, String execName, Boolean returnToOrigFlow) throws ExceptionAllow nexting directly to a flow.- Parameters:
httpServerExchange- The current requests server exchange.execName- The name of the next executable to go to, ie chain or handler. Chain resolved first.returnToOrigFlow- True if you want to call the next handler defined in your original chain after the provided execName is completed. False otherwise.- Throws:
Exception- exception
-
getNext
public static io.undertow.server.HttpHandler getNext(io.undertow.server.HttpServerExchange httpServerExchange)
Returns the instance of the next handler, rather then calling handleRequest on it.- Parameters:
httpServerExchange- The current requests server exchange.- Returns:
- The HttpHandler that should be executed next.
-
getNext
public static io.undertow.server.HttpHandler getNext(io.undertow.server.HttpServerExchange httpServerExchange, io.undertow.server.HttpHandler next) throws ExceptionReturns the instance of the next handler, or the given next param if it's not null.- Parameters:
httpServerExchange- The current requests server exchange.next- If not null, return this.- Returns:
- The next handler in the chain, or next if it's not null.
- Throws:
Exception- exception
-
start
public static boolean start(io.undertow.server.HttpServerExchange httpServerExchange)
On the first step of the request, match the request against the configured paths. If the match is successful, store the chain id within the exchange. Otherwise return false.- Parameters:
httpServerExchange- The current requests server exchange.- Returns:
- true if a handler has been defined for the given path.
-
startDefaultHandlers
public static boolean startDefaultHandlers(io.undertow.server.HttpServerExchange httpServerExchange)
If there is no matching path, the OrchestrationHandler is going to try to start the defaultHandlers. If there are default handlers defined, store the chain id within the exchange. Otherwise return false.- Parameters:
httpServerExchange- The current requests server exchange.- Returns:
- true if a handler has been defined for the given path.
-
-