Class UrlSupport

java.lang.Object
org.opencastproject.util.UrlSupport

public final class UrlSupport extends Object
UrlSupport is a helper class to deal with urls.
  • Field Details

  • Method Details

    • uri

      public static URI uri(String uri)
      URI constructor function without checked exceptions.
    • url

      public static URL url(String url)
      URL constructor function without checked exceptions.
    • url

      public static URL url(String protocol, String host, int port)
      URL constructor function without checked exceptions.
    • url

      public static URL url(URL context, String spec)
      URL constructor function without checked exceptions.
      See Also:
    • concat

      public static String concat(String prefix, String suffix)
      Concatenates the two urls with respect to leading and trailing slashes.

      Note that returned path will only end with a slash if suffix does. If you need a trailing slash, see concat(String, String, boolean).

      Returns:
      the concatenated url of the two arguments
    • concat

      public static String concat(String prefix, String suffix, boolean close)
      Concatenates the two urls with respect to leading and trailing slashes. The path will always end with a trailing slash.
      Returns:
      the concatenated url of the two arguments
    • concat

      public static String concat(String... parts)
      Concatenates the urls with respect to leading and trailing slashes.
      Parameters:
      parts - the parts to concat
      Returns:
      the concatenated url
    • concat

      public static String concat(List<String> parts)
      Concatenates the urls with respect to leading and trailing slashes.
      Parameters:
      parts - the parts to concat
      Returns:
      the concatenated url
    • uri

      public static URI uri(Object... parts)
      Create a URI from the given parts.
    • removeDoubleSeparator

      public static String removeDoubleSeparator(String path)
      Removes any occurrence of double separators ("//") and replaces it with "/". Any double separators right after the protocol part are left untouched so that, e.g. http://localhost stays http://localhost
      Parameters:
      path - the path to check
      Returns:
      the corrected path