Package io.undertow.server
Class RoutingHandler
java.lang.Object
io.undertow.server.RoutingHandler
- All Implemented Interfaces:
HttpHandler
A Handler that handles the common case of routing via path template and method name.
- Author:
- Stuart Douglas
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(HttpString method, String template, Predicate predicate, HttpHandler handler) add
(HttpString method, String template, HttpHandler handler) add
(String method, String template, Predicate predicate, HttpHandler handler) add
(String method, String template, HttpHandler handler) addAll
(RoutingHandler routingHandler) delete
(String template, Predicate predicate, HttpHandler handler) delete
(String template, HttpHandler handler) get
(String template, Predicate predicate, HttpHandler handler) get
(String template, HttpHandler handler) void
handleRequest
(HttpServerExchange exchange) Handle the request.post
(String template, Predicate predicate, HttpHandler handler) post
(String template, HttpHandler handler) put
(String template, Predicate predicate, HttpHandler handler) put
(String template, HttpHandler handler) remove
(HttpString method, String path) Removes the specified route from the handlerRemoves the specified route from the handlersetFallbackHandler
(HttpHandler fallbackHandler) setInvalidMethodHandler
(HttpHandler invalidMethodHandler) Sets the handler called when this instance can not match the http method but can match another http method.
-
Constructor Details
-
RoutingHandler
public RoutingHandler(boolean rewriteQueryParameters) -
RoutingHandler
public RoutingHandler()
-
-
Method Details
-
handleRequest
Description copied from interface:HttpHandler
Handle the request.- Specified by:
handleRequest
in interfaceHttpHandler
- Parameters:
exchange
- the HTTP request/response exchange- Throws:
Exception
-
add
-
add
-
get
-
post
-
put
-
delete
-
add
-
add
public RoutingHandler add(HttpString method, String template, Predicate predicate, HttpHandler handler) -
get
-
post
-
put
-
delete
-
addAll
-
remove
Removes the specified route from the handler- Parameters:
method
- The method to removepath
- the path tempate to remove- Returns:
- this handler
-
remove
Removes the specified route from the handler- Parameters:
path
- the path tempate to remove- Returns:
- this handler
-
getFallbackHandler
- Returns:
- Handler called when no match was found and invalid method handler can't be invoked.
-
setFallbackHandler
- Parameters:
fallbackHandler
- Handler that will be called when no match was found and invalid method handler can't be invoked.- Returns:
- This instance.
-
getInvalidMethodHandler
- Returns:
- Handler called when this instance can not match the http method but can match another http method.
-
setInvalidMethodHandler
Sets the handler called when this instance can not match the http method but can match another http method. For example: For an exchange the POST method is not matched by this instance but at least one http method matched for the exchange. If this handler is null the fallbackHandler will be used.- Parameters:
invalidMethodHandler
- Handler that will be called when this instance can not match the http method but can match another http method.- Returns:
- This instance.
-