Package com.oorian.annotations
Annotation Interface Page
Annotation for registering an HttpFile subclass with the Oorian routing system.
The @Page annotation is the primary mechanism for mapping URL paths
to Oorian page classes. It supports multiple configuration options including
single paths, multiple paths, and RESTful URL parameters.
Basic Usage:
@Page("/helloworld")
public class HelloWorldPage extends HtmlPage {
// Page implementation
}
Using Named Path:
@Page(path="/helloworld")
public class HelloWorldPage extends HtmlPage { }
Multiple Paths:
@Page(paths={"/home", "/index", "/"})
public class HomePage extends HtmlPage { }
RESTful URL Parameters:
@Page("/users/{userId}")
public class UserPage extends HtmlPage {
@Override
public void build() {
Long userId = getUrlParameters().getParameterAsLong("userId");
}
}
@Page("/users/{userId}/posts/{postId}")
public class UserPostPage extends HtmlPage { }
The annotation is inherited, allowing base page classes to define common routing behavior for subclasses.
- Since:
- 2021
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
String valueThe URL path for this page (shorthand forpath()).- Returns:
- the URL path
- Default:
""
-
paths
String[] pathsMultiple URL paths that all route to this page.- Returns:
- array of URL paths
- Default:
{}
-
name
String nameAn optional name identifier for this page.- Returns:
- the page name
- Default:
""
-
path
String pathThe URL path for this page.Supports RESTful path parameters in the format
{paramName}.- Returns:
- the URL path
- Default:
""
-