Class UriParser

java.lang.Object
org.glassfish.jersey.uri.internal.UriParser

class UriParser extends Object
Parser for string URI with template parameters which produces URIs from Strings. Example of parsed uri: "http://user@{host}:{port}/a/{path}?query=1#fragment". The parser is not thread safe.
  • Field Details

    • ERROR_STATE

      private static final String ERROR_STATE
    • input

      private final String input
    • ci

      private CharacterIterator ci
    • scheme

      private String scheme
    • userInfo

      private String userInfo
    • host

      private String host
    • port

      private String port
    • query

      private String query
    • path

      private String path
    • fragment

      private String fragment
    • ssp

      private String ssp
    • authority

      private String authority
    • opaque

      private boolean opaque
    • parserExecuted

      private boolean parserExecuted
  • Constructor Details

    • UriParser

      UriParser(String uri)
      Creates new parser initialized with uri.
      Parameters:
      uri - String with URI to be parsed. May contain template parameters.
  • Method Details

    • parseComponentWithIP

      private String parseComponentWithIP(String delimiters, boolean mayEnd)
    • parseComponent

      private String parseComponent(String delimiters, boolean mayEnd)
    • parseComponent

      private String parseComponent(String delimiters, boolean mayEnd, boolean isIp)
      Parses the URI component. Parsing starts at position of the first character of component and ends with position of one of the delimiters. The string and current position is taken from the CharacterIterator.
      Parameters:
      delimiters - String with delimiters which terminates the component.
      mayEnd - True if component might be the last part of the URI.
      isIp - True if the component might contain IPv6 address.
      Returns:
      Extracted component.
    • parse

      public void parse()
      Parses the input string URI. After calling this method The result components can be retrieved by calling appropriate getter methods like getHost(), getPort(), etc.
    • parseHierarchicalUri

      private void parseHierarchicalUri()
    • parseAuthority

      private void parseAuthority()
    • parsePath

      private void parsePath()
    • getSsp

      public String getSsp()
      Returns parsed scheme specific part. The method must be called before executing this method.
      Returns:
      Scheme specific part.
    • getScheme

      public String getScheme()
      Returns parsed scheme component. The method must be called before executing this method.
      Returns:
      Scheme.
    • getUserInfo

      public String getUserInfo()
      Returns parsed user info component. The method must be called before executing this method.
      Returns:
      User info.
    • getHost

      public String getHost()
      Returns parsed host component. The method must be called before executing this method.
      Returns:
      Host.
    • getPort

      public String getPort()
      Returns parsed port component. The method must be called before executing this method.
      Returns:
      Port.
    • getQuery

      public String getQuery()
      Returns parsed query component. The method must be called before executing this method.
      Returns:
      Query.
    • getPath

      public String getPath()
      Returns parsed path component. The method must be called before executing this method.
      Returns:
      Path.
    • getFragment

      public String getFragment()
      Returns parsed fragment component. The method must be called before executing this method.
      Returns:
      Fragment.
    • getAuthority

      public String getAuthority()
      Returns parsed authority component. The method must be called before executing this method.
      Returns:
      Authority.
    • isOpaque

      public boolean isOpaque()
      Returns whether the input string URI is opaque. The method must be called before executing this method.
      Returns:
      True if the uri is opaque.