Class ContainerUtils

java.lang.Object
org.glassfish.jersey.server.internal.ContainerUtils

public class ContainerUtils extends Object
Utility methods used by container implementations.
Author:
Adam Lindenthal
  • Constructor Details

    • ContainerUtils

      public ContainerUtils()
  • Method Details

    • encodeUnsafeCharacters

      public static String encodeUnsafeCharacters(String originalQueryString)
      Encodes (predefined subset of) unsafe/unwise URI characters with the percent-encoding.

      Replaces the predefined set of unsafe URI characters in the query string with its percent-encoded counterparts. The reserved characters (as defined by the RFC) are automatically encoded by browsers, but some characters are in the "gray zone" - are not explicitly forbidden, but not recommended and known to cause issues.

      Parameters:
      originalQueryString - URI query string (the part behind the question mark character).
      Returns:
      the same string with unsafe characters percent encoded.
    • reduceLeadingSlashes

      public static String reduceLeadingSlashes(String path)
      Reduces the number of slashes before the path to only one slash.
      Parameters:
      path - path string
      Returns:
      path string with reduced slashes to only one.
    • getHandlerPath

      public static String getHandlerPath(String uri)
      Splits URI address from query params and returns it.
      Parameters:
      uri - URI address in string format with query params
      Returns:
      URI address in string format without query params