Class ZulipUrlUtils

java.lang.Object
com.github.jamesnetherton.zulip.client.util.ZulipUrlUtils

public class ZulipUrlUtils extends Object
A utility class to resolve API endpoint.
  • Field Details

  • Method Details

    • getZulipApiUrl

      public static URL getZulipApiUrl(String baseUrl) throws MalformedURLException
      Returns the URL to a Zulip API endpoint.
      Parameters:
      baseUrl - The base URL of the Zulip server
      Returns:
      The URL of the Zulip API
      Throws:
      MalformedURLException - if the URL is invalid
    • pathSegment

      public static String pathSegment(String value)
      Verifies that a value destined for a single Zulip API request path segment cannot modify the structure of that path.
      Parameters:
      value - The value to be interpolated into the request path
      Returns:
      The unmodified value
    • pathSegments

      public static String pathSegments(String value)
      Verifies that a value destined for one or more Zulip API request path segments cannot traverse outside of the request path that it is interpolated into.
      Parameters:
      value - The value to be interpolated into the request path
      Returns:
      The unmodified value
    • containsRelativePathSegment

      public static boolean containsRelativePathSegment(String path)
      Determines whether a request path contains a segment that a server could resolve to a different path.
      Parameters:
      path - The request path to check
      Returns:
      true if the path contains a relative path segment. false otherwise