Interface UrlRouting

All Known Implementing Classes:
WebUrlRouting

public interface UrlRouting
Interface defining methods for reflecting app state to URL based on currently opened screen.
Passed params map enables to reflect inner screen state to URL to use it later.
Can be used only Web client.
Usage example (this - Screen controller):
     @Inject
     private UrlRouting urlRouting;

     private void changeUrl() {
         Map<String, String> params = ParamsMap.of(
                 "param1", "value1",
                 "param2", "value2");

         urlRouting.pushState(this, params);
     }
 
  • Method Details

    • pushState

      default void pushState(Screen screen)
      Pushes the state corresponding to the given screen.

      Creates new entry in browser history.

      Parameters:
      screen - screen that is used to build new navigation state
    • pushState

      void pushState(Screen screen, Map<String,String> urlParams)
      Pushes the state corresponding to the given screen.

      The given urlParams will be reflected in URI as GET request params.

      Creates new entry in browser history.

      Parameters:
      screen - screen that is used to build new navigation state
      urlParams - URI params map
    • replaceState

      default void replaceState(Screen screen)
      Replaces current state by the state corresponding to the given screen.

      Doesn't create new entry in browser history.

      Parameters:
      screen - screen that is used to build new navigation state
    • replaceState

      void replaceState(Screen screen, Map<String,String> urlParams)
      Replaces current state by the state corresponding to the given screen.

      The given urlParams will be reflected in URI as GET request params.

      Doesn't create new entry in browser history.

      Parameters:
      screen - screen that is used to build new navigation state
      urlParams - URI params map
    • getState

      NavigationState getState()
      Returns:
      current state parsed from URI fragment.
    • getRouteGenerator

      UrlRouting.RouteGenerator getRouteGenerator()
      Returns:
      UrlRouting.RouteGenerator instance
    • getLastHistoryOperation

      String getLastHistoryOperation()