Package ninja

Class ReverseRouter.Builder

    • Constructor Detail

      • Builder

        public Builder​(String contextPath,
                       Route route)
    • Method Detail

      • absolute

        public ReverseRouter.Builder absolute​(String scheme,
                                              String hostname)
        Make this an absolute route by including the current scheme (e.g. http) and hostname (e.g. www.example.com).
        Parameters:
        scheme - The scheme such as "http" or "https"
        hostname - The hostname such as "www.example.com" or "www.example.com:8080"
        Returns:
        This builder
      • absolute

        public ReverseRouter.Builder absolute​(Context context)
        Make this an absolute route by including the current scheme (e.g. http) and hostname (e.g. www.example.com). If the route is to a websocket then this will then return "ws" or "wss" if TLS is detected.
        Parameters:
        context - The current context
        Returns:
        This builder
      • getRoute

        public Route getRoute()
      • pathParam

        public ReverseRouter.Builder pathParam​(String name,
                                               Object value)
        Add a parameter as a path replacement. Will validate the path parameter exists. This method will URL encode the values when building the final result.
        Parameters:
        name - The path parameter name
        value - The path parameter value
        Returns:
        A reference to this builder
        See Also:
        rawPathParam(java.lang.String, java.lang.Object)
      • rawQueryParam

        public ReverseRouter.Builder rawQueryParam​(String name,
                                                   Object value)
        Identical to queryParam except the queryParam string value will NOT be url encoded when building the final url.
        Parameters:
        name - The queryParam string parameter name
        value - The queryParam string parameter value
        Returns:
        A reference to this builder
        See Also:
        queryParam(java.lang.String, java.lang.Object)
      • build

        public String build()
        Builds the final url. Will validate expected parameters match actual.
        Returns:
        The final resulting url
      • redirect

        public Result redirect()
        Builds the result as a ninja.Result redirect.
        Returns:
        A Ninja redirect result