Class OpaqueStringParser


  • public class OpaqueStringParser
    extends java.lang.Object
    According to the xrootd specification, an opaque string has the following format opaque (Xrdv296 SPEC Section 3.13.1): "Opaque information is passed by suffixing the path with a question mark (?) and then coding the opaque information as a series of ampersand prefixed (&) variable names immediately followed by an equal sign (=) prefix value." token (follows the SPEC in Feichtinger, Peters: "Authorization of Data Access in Distributed Systems", Section IIIA., page 3): "The authorization envelope which is obtained from the catalogue service is appended to an URL as opaque information following the syntax: URL : root : // < host -ip >:< port > // < file - path >?authz = < access - envelope > & vo = < vo -name > In summary, this yields the following format for opaque information and token: ?&opaqueKey1=value1&opaqueKey2=value2&opaqueKey3=value3?authz=sectoken&vo= voname Experience shows that the first value after the question mark is not always ampersand-prefixed, despite the protocol specification. We have reported the following bug to the root developers: https://savannah.cern.ch/bugs/?75478
    Author:
    tzangerl
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String buildOpaqueString​(java.lang.String key, java.lang.String value)
      Build an opaque string containing a single key and a single value
      static java.lang.String buildOpaqueString​(java.util.Map<java.lang.String,​java.lang.String> map)
      Reconstitute the opaque string from the map.
      static java.util.Map<java.lang.String,​java.lang.String> getOpaqueMap​(java.lang.String opaque)
      The opaque information is included in the path in a format similar to URL-encoding (&key1=val1&key2=val2...).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OpaqueStringParser

        public OpaqueStringParser()
    • Method Detail

      • getOpaqueMap

        public static java.util.Map<java.lang.String,​java.lang.String> getOpaqueMap​(java.lang.String opaque)
                                                                                   throws ParseException
        The opaque information is included in the path in a format similar to URL-encoding (&key1=val1&key2=val2...). This method translates that encoding to a map, mapping from the keys found in the opaque string to the values found in the opaque string. Due to ambiguity regarding specification of the opaque token and its use, the method will parse opaque strings in the forms ?firstKey=firstValue&secondKey=secondValue ?&firstKey=firstValue&secondKey=secondValue firstKey=firstValue?&secondKey=secondValue firstKey=firstValue?secondkey=secondValue
        Parameters:
        opaque - The opaque string, as usually attached to the path
        Returns:
        Map from keys to values in the opaque string
        Throws:
        ParseException - if value is missing for a key in the string
      • buildOpaqueString

        public static java.lang.String buildOpaqueString​(java.lang.String key,
                                                         java.lang.String value)
        Build an opaque string containing a single key and a single value
        Parameters:
        key - The key contained in the opaque string
        value - The value contained in the opaque string
        Returns:
        string with correct opaque prefix and correct separator
      • buildOpaqueString

        public static java.lang.String buildOpaqueString​(java.util.Map<java.lang.String,​java.lang.String> map)
        Reconstitute the opaque string from the map.
        Parameters:
        map - of key - value pairs
        Returns:
        string with correct opaque prefix and correct separator