Page Annotation Routing
Clean, declarative routing with @Page annotations—path variables, wildcards, and more.
@Page Annotation
Annotate any HtmlPage subclass with @Page("/path") to define its URL. The framework handles the rest.
Path Variables
Use curly-brace placeholders like /users/{userId} to capture path segments as named parameters.
Clean URLs
Create human-readable, SEO-friendly URLs. No file extensions, no query string spaghetti.
Wildcard Patterns
Match flexible URL structures with wildcard segments for catch-all routes and dynamic content.
Static Pages
Serve static HTML pages alongside dynamic ones. Mix and match within the same application.
Auto-Discovery
Register a package and Oorian automatically discovers all @Page-annotated classes at startup. No manual registration.
@Page Annotation
Define routes by annotating your page classes. Path variables are automatically extracted and accessible through the URL parameters API.
// Simple route
@Page("/about")
public class AboutPage extends HtmlPage { }
// Path variable
@Page("/users/{userId}")
public class UserPage extends HtmlPage
{
@Override
protected void createBody(Body body)
{
String userId = getUrlParameters().getParameter("userId");
// Build page for this user
}
}
// Multiple path variables
@Page("/blog/{year}/{slug}")
public class BlogPostPage extends HtmlPage { }Developer Benefits
Zero Configuration
No web.xml servlet mappings, no routing configuration files. Just annotate your class and deploy.
Compile-Time Validation
Routes are defined in Java annotations. Typos in class names or missing pages are caught by the compiler, not at runtime.
Clean URL Structure
Build SEO-friendly URLs with meaningful path segments. No file extensions or framework-specific prefixes cluttering your URLs.
Auto-Discovery
Register a package once in your Application class. Oorian scans it at startup and finds every @Page-annotated class automatically.
Familiar Pattern
If you have used JAX-RS @Path or Spring @RequestMapping, you already understand @Page. The same annotation-driven approach, purpose-built for Oorian pages.