Package play.mvc
Class Router
java.lang.Object
play.mvc.Router
The router matches HTTP requests to action invocations
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Router
static long
Timestamp the routes file was last loaded at. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactionToUrl
(String action, Map<String, Object> actionArgs, Http.Request request, Http.Response response) static void
Add a new route.static void
static void
In PROD mode and if the routes are already loaded, this does nothing.static String
Deprecated.static String
getBaseUrl
(Http.Request request) static String
static String
getFullUrl
(String action) Deprecated.static String
getFullUrl
(String action, String baseUrl) static String
getFullUrl
(String action, Map<String, Object> args) Deprecated.static String
static String
getFullUrl
(String action, Map<String, Object> args, Http.Request request) static String
getFullUrl
(String action, Http.Request request) matchRoute
(String method, String path) static String
Deprecated.static Router.ActionDefinition
Deprecated.static Router.ActionDefinition
Deprecated.static Router.ActionDefinition
static Router.ActionDefinition
reverse
(String action, Map<String, Object> args, Http.Request request, Http.Response response) static String
reverseWithCheck
(String name, File file, boolean absolute) void
routeOnlyStatic
(Http.Request request) static List<Router.Route>
routes()
void
setRoutes
(List<Router.Route> routes) Replace routes with provided route definitions.
-
Field Details
-
instance
-
lastLoading
public static long lastLoadingTimestamp the routes file was last loaded at.
-
-
Constructor Details
-
Router
-
-
Method Details
-
routes
-
setRoutes
Replace routes with provided route definitions. -
clearForTests
public static void clearForTests() -
addRoute
Add a new route. Will be first in the route list- Parameters:
method
- The method of the route * @param action : The associated actionpath
- The path of the routeaction
- The associated action
-
detectChanges
public static void detectChanges()In PROD mode and if the routes are already loaded, this does nothing.
In DEV mode, this checks each routes file's "last modified" time to see if the routes need updated.
-
routeOnlyStatic
- Throws:
RenderStatic
- or NotFound
-
matchRoute
-
reverse
Deprecated. -
getFullUrl
Deprecated. -
getFullUrl
-
getFullUrl
-
getBaseUrl
Deprecated.Gets baseUrl from current request or application.baseUrl in application.conf -
getBaseUrl
-
getConfiguredBaseUrl
-
getFullUrl
Deprecated. -
getFullUrl
-
getFullUrl
-
reverse
Deprecated. -
reverseWithCheck
-
reverse
@Deprecated @Nonnull public static Router.ActionDefinition reverse(@Nonnull String action, @Nullable Map<String, Object> args) Deprecated. -
reverse
@Nonnull public static Router.ActionDefinition reverse(@Nonnull String action, @Nullable Map<String, Object> args, @Nullable Http.Request request, @Nullable Http.Response response) -
reverse
-
actionToUrl
@Nonnull public Router.ActionDefinition actionToUrl(@Nonnull String action, @Nullable Map<String, Object> actionArgs, @Nullable Http.Request request, @Nullable Http.Response response) -
actionToUrl
-