Class Resolver


  • public class Resolver
    extends java.lang.Object
    A class to provide some utility methods in support of some protocol I/O capabilities.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String gsServerIndicator  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String canonUrl​(java.lang.String sScheme, java.lang.String sHost, java.lang.String sPort, java.lang.String sPath)
      Canon(ize) an url into its constituent parts.
      static void crackUrl​(java.lang.String sUrl, StringHolder sScheme, StringHolder sUser, StringHolder sPwd, StringHolder sHost, StringHolder sPort, StringHolder sPath)
      Crack an url into its constituent parts.
      static Protocol getProtocol​(java.lang.String sScheme)
      Get the currently installed protocol handler associated with the given scheme.
      static void resetProtocols()
      Uninstall all protocol handlers.
      static void setProtocol​(Protocol oProtocol)
      Sets (adds) the given protocol to the list of protocol handlers.
      static java.lang.String urlDecode​(java.lang.String sUrl)
      Decode a URL encoded string
      static java.lang.String urlEncode​(java.lang.String sUrl)
      URL encode a string
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • gsServerIndicator

        public static final java.lang.String gsServerIndicator
        See Also:
        Constant Field Values
    • Method Detail

      • setProtocol

        public static void setProtocol​(Protocol oProtocol)
        Sets (adds) the given protocol to the list of protocol handlers.
        Parameters:
        oProtocol - a protocol handler. Subsequent to this operation, the I/O of any URL whose scheme matches the given protocol will be routed to the given protocol handler.
      • resetProtocols

        public static void resetProtocols()
        Uninstall all protocol handlers. It is normally not necessary to make this call, as protocol handlers are automatically deleted on exit. However, when a protocol handler is in a DLL that is dynamically loaded, it is possible for that DLL to be unloaded before the automatic deletion takes place, leading to a crash. In that case the DLL must call ResetProtocols just prior to unloading (for example in the destructor of a global variable).
      • getProtocol

        public static Protocol getProtocol​(java.lang.String sScheme)
        Get the currently installed protocol handler associated with the given scheme.
        Parameters:
        sScheme - a URL's scheme.
        Returns:
        the matching protocol handler.
      • crackUrl

        public static void crackUrl​(java.lang.String sUrl,
                                    StringHolder sScheme,
                                    StringHolder sUser,
                                    StringHolder sPwd,
                                    StringHolder sHost,
                                    StringHolder sPort,
                                    StringHolder sPath)
        Crack an url into its constituent parts. The URL is cracked from the following rule:
             scheme://[user[:password]@]host[:port][/path]
         
        Parameters:
        sUrl - the URL to crack.
        sScheme - the cracked URL's scheme.
        sUser - the cracked URL's user, if any.
        sPwd - the cracked URL's password, if any.
        sHost - the cracked URL's host.
        sPort - the cracked URL's port, if any.
        sPath - the cracked URL's path, if any.
      • canonUrl

        public static java.lang.String canonUrl​(java.lang.String sScheme,
                                                java.lang.String sHost,
                                                java.lang.String sPort,
                                                java.lang.String sPath)
        Canon(ize) an url into its constituent parts. The URL is canonized into the following rule:
             scheme://host[:port][/path]
         
        Parameters:
        sScheme - the URL's scheme.
        sHost - the URL's host.
        sPort - the URL's port, if any.
        sPath - the URL's path, if any.
        Returns:
        The canonized URL.
      • urlEncode

        public static java.lang.String urlEncode​(java.lang.String sUrl)
        URL encode a string
        Parameters:
        sUrl - string to be encoded
        Returns:
        URL encoded string
      • urlDecode

        public static java.lang.String urlDecode​(java.lang.String sUrl)
        Decode a URL encoded string
        Parameters:
        sUrl - string to be decoded
        Returns:
        Decoded string