Interface IUrlBuilder


public interface IUrlBuilder
Definition of a URL builder following Atoti conventions.

This can be used to create full URLs or just parts of it.
It offers a much more detailed API than url(String...).

Author:
ActiveViam
  • Method Details

    • create

      static IUrlBuilder.IBuilder create()
      Creates a new builder for URLs following Atoti conventions.
    • url

      static String url(String... parts)
      Build an url by joining the different given parts separated by /.

      The url starts with /.

       E.g:  - url("a", "/b", "/c/") returns /a/b/c
             - url("http://localhost:9090", "a", "/b", "/c/") returns http://localhost:9090/a/b/c
       
    • url

      static String url(boolean withTrailingSlash, String... parts)
      Build an url by joining the different given parts separated by /.

      The url start with / and may end with /.

       E.g:  - url("a", "/b", "/c") returns /a/b/c/
             - url("http://localhost:9090", "a", "/b", "/c") returns http://localhost:9090/a/b/c/
       
      Parameters:
      withTrailingSlash - true if the url need to end with "/", false otherwise.
    • normalizeUrl

      static String normalizeUrl(String url, boolean withTrailingSlash)
      Normalizes a URL, removing extra "/" characters.
      Parameters:
      url - the url to normalize.
      withTrailingSlash - true if the url wants to end with "/", false otherwise.

      If true and the trailing / is missing, it is added to the url. If false and present, it is removed.

      Returns:
      the normalized url.