Package io.muserver
Class Routes
- java.lang.Object
-
- io.muserver.Routes
-
public class Routes extends java.lang.ObjectA helper class to create a handler for a specific URL. SeeMuServerBuilder.addHandler(Method, String, RouteHandler)for a simple way to add a routed handler to a server.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MuHandlerroute(Method method, java.lang.String uriTemplate, RouteHandler muHandler)Creates a new handler that will only be called if it matches the given route info.
-
-
-
Method Detail
-
route
public static MuHandler route(Method method, java.lang.String uriTemplate, RouteHandler muHandler)
Creates a new handler that will only be called if it matches the given route info.- Parameters:
method- The method to match, ornullto accept any method.uriTemplate- A URL template. Supports plain URLs like/abcor paths with named parameters such as/abc/{id}or named parameters with regexes such as/abc/{id : [0-9]+}where the named parameter values can be accessed with thepathParamsparameter in the route handler.muHandler- The handler to invoke if the method and URI matches.- Returns:
- Returns a
MuHandlerthat is only called if the request URI and method matches. - See Also:
MuServerBuilder.addHandler(Method, String, RouteHandler)
-
-