In some cases we might need to support navigation for different modules in the same app, or maybe the web page is hosting different applications, and eah application need to have its own routing, and each application assumes a different base path in the URL, for example a customer relationship application path always starts with http://localhost:8080/customers/... meanwhile the ticketing application always starts with the path http://localhost:8080/tickets, then the internal navigation and routing for each app will omit this root or base path from its routing tokens, In domino-history we can achieve this by creating new StateHistory instances with the desired root or base path, Example :
//Assuming we start with the URL http://localhost:8080
StateHistory customersRouter = new StateHistory("customers");
StateHistory ticketsRouter = new StateHistory("tickets");
customersRouter.pushState(StateToken.of("profiles/customer-1"));
//Result : http://localhost:8080/customers/profiles/customer-1
ticketsRouter.pushState(StateToken.of("open/ticket-3"));
//Result : http://localhost:8080/tickets/open/ticket-3
Same thing if we try to read the current token with a StateHistory instance with a root path
List<String> paths = customersRouter.currentToken().paths();
//Result : paths will contain only "profiles" and "customer-1"