Annotation Interface Page


@Retention(RUNTIME) @Target(TYPE) @Inherited public @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
    Modifier and Type
    Optional Element
    Description
    An optional name identifier for this page.
    The URL path for this page.
    Multiple URL paths that all route to this page.
    The URL path for this page (shorthand for path()).
  • Element Details

    • value

      String value
      The URL path for this page (shorthand for path()).
      Returns:
      the URL path
      Default:
      ""
    • paths

      String[] paths
      Multiple URL paths that all route to this page.
      Returns:
      array of URL paths
      Default:
      {}
    • name

      String name
      An optional name identifier for this page.
      Returns:
      the page name
      Default:
      ""
    • path

      String path
      The URL path for this page.

      Supports RESTful path parameters in the format {paramName}.

      Returns:
      the URL path
      Default:
      ""