Full URL Parameter Support

Build clean, RESTful URLs with path variables and query parameters.

Clean, Bookmarkable URLs

Oorian supports modern URL patterns for SEO-friendly, user-friendly applications.

Path Variables

Define dynamic path segments like /users/{id} or /products/{category}/{slug}.

Query Parameters

Access query strings like ?page=1&sort=name with type-safe methods.

Bookmarkable

Every state can have a unique URL. Users can share and bookmark specific views.

SEO Friendly

Clean URLs that search engines can index. /products/widgets not /page?id=123.

Type Safety

Convert parameters to int, boolean, double with built-in methods.

Deep Linking

Link directly to specific pages, items, or states within your application.

Path Parameters

Define dynamic segments in your @Page route using {paramName} syntax.

java
// Single path parameter
@Page("/users/{id}")
public class UserPage extends HtmlPage
{
    @Override
    protected void createBody(Body body)
    {
        // Access the path parameter
        String userId = getUrlParameters().getParameter("id");
        User user = userService.findById(userId);

        body.addElement(new H1(user.getName()));
    }
}

// Multiple path parameters
@Page("/products/{category}/{slug}")
public class ProductPage extends HtmlPage
{
    @Override
    protected void createBody(Body body)
    {
        String category = getUrlParameters().getParameter("category");
        String slug = getUrlParameters().getParameter("slug");

        Product product = productService.findByCategoryAndSlug(category, slug);
        displayProduct(product);
    }
}

// Nested path parameters
@Page("/organizations/{orgId}/teams/{teamId}/members/{memberId}")
public class MemberPage extends HtmlPage
{
    @Override
    protected void createBody(Body body)
    {
        UrlParameters urlParams = getUrlParameters();
        String orgId = urlParams.getParameter("orgId");
        String teamId = urlParams.getParameter("teamId");
        String memberId = urlParams.getParameter("memberId");

        // Access nested resources
    }
}

Query Parameters

Access query string parameters with the Parameters object.

java
// URL: /search?q=widgets&page=2&sort=price&order=asc
@Page("/search")
public class SearchPage extends HtmlPage
{
    @Override
    protected void createBody(Body body)
    {
        Parameters params = getParameters();

        // Get string value
        String query = params.getParameterValue("q");

        // Get string with default (check if exists first)
        String sort = params.containsParameter("sort")
            ? params.getParameterValue("sort")
            : "relevance";

        // Get as integer (returns null if not found)
        Integer pageParam = params.getParameterValueAsInt("page");
        int page = (pageParam != null) ? pageParam : 1;

        // Get as boolean
        // URL: ?featured=true
        boolean featured = params.getParameterValueAsBoolean("featured");

        // Get as double
        // URL: ?minPrice=9.99
        Double minPriceParam = params.getParameterValueAsDouble("minPrice");
        double minPrice = (minPriceParam != null) ? minPriceParam : 0.0;

        // Check if parameter exists
        if (params.containsParameter("category"))
        {
            String category = params.getParameterValue("category");
        }

        // Get multi-value parameter
        // URL: ?tag=java&tag=web&tag=framework
        List<String> tags = params.getParameterValues("tag");

        // Perform search with parameters
        SearchResults results = searchService.search(query, page, sort, featured);
        displayResults(results);
    }
}

Parameters API

getParameterValue(name)

Returns the string value or null

getParameterValues(name)

Returns all values as a List

getParameterValueAsInt(name)

Parses as Integer, null if not found

getParameterValueAsLong(name)

Parses as Long, null if not found

getParameterValueAsDouble(name)

Parses as Double, null if not found

getParameterValueAsBoolean(name)

Parses as Boolean, false if not found

containsParameter(name)

Returns true if parameter exists

getParameterNames()

Returns list of all parameter names

Real-World Examples

E-Commerce Product Page

/products/electronics/wireless-headphones

Clean, SEO-friendly URLs that are easy to read and share

Search with Filters

/search?q=widgets&category=electronics&minPrice=10&maxPrice=100

Bookmarkable search results with all filters preserved in URL

Paginated List

/orders?page=2&size=25&sort=date&order=desc

Share specific pages of data with consistent ordering

User Profile Section

/users/123/settings/security

Deep links to specific settings pages within your application

Report with Date Range

/reports/sales?start=2024-01-01&end=2024-12-31&format=pdf

Generate reports with specific date ranges and export formats