Class XURI


  • public class XURI
    extends Object
    Provide an extended form of URI parser with the following features: 1. can parse the query and fragment parts. 2. supports multiple protocols 3. supports modification of the URI path. 4. supports url -> string as controlled by flags
    • Method Detail

      • getUserInfo

        public String getUserInfo()
      • getHost

        public String getHost()
      • getPort

        public int getPort()
      • getPath

        public String getPath()
      • getRealPath

        public String getRealPath()
        Return a path that can be used to open a file
        Returns:
      • getQuery

        public String getQuery()
      • getFragment

        public String getFragment()
      • getScheme

        public String getScheme()
      • setScheme

        public void setScheme​(String xscheme)
      • setUserInfo

        public void setUserInfo​(String xuserinfo)
      • setHost

        public void setHost​(String xhost)
      • setPort

        public void setPort​(int xport)
      • setPath

        public void setPath​(String xpath)
      • setQuery

        public void setQuery​(String xquery)
      • setFragment

        public void setFragment​(String xfragment)
      • insertQueryField

        public void insertQueryField​(String key,
                                     String newval)
        Allow queryfields to be inserted
        Parameters:
        key -
        newval -
      • insertFragmentField

        public void insertFragmentField​(String key,
                                        String newval)
        Allow fragment fields to be inserted
        Parameters:
        key -
        newval -
      • removeQueryField

        public void removeQueryField​(String key)
        Allow queryfields to be removed
        Parameters:
        key -
      • rebuildQuery

        protected void rebuildQuery()
        Rebuild query from current queryfields
      • isFile

        public boolean isFile()
      • parseQuery

        protected void parseQuery()
      • parseFragment

        protected void parseFragment()
      • escapedsplit

        protected List<String> escapedsplit​(String s,
                                            char sep,
                                            char escape)
      • findunescaped

        protected int findunescaped​(String s,
                                    int start,
                                    char sep,
                                    char escape,
                                    int len)
      • assemble

        public String assemble​(EnumSet<XURI.Parts> parts)
        Reassemble the url using the specified parts
        Parameters:
        parts - to include
        Returns:
        the assembled uri
      • canonical

        public static String canonical​(String s)
        Canonicalize a part of a URL
        Parameters:
        s - part of the url
      • hasDriveLetter

        public static boolean hasDriveLetter​(String path)
        return true if this path appears to start with a windows drive letter including those hidden by leading '/'
        Parameters:
        path -
        Returns:
        true, if path has drive letter
      • hideDriveLetter

        public static String hideDriveLetter​(String path)
        Return a path with possible windows drive letter hidden by '/'. Repair => convert "x:/" to "/x:/" where x is a drive letter
        Returns:
        repaired path
      • allSchemes

        public static String[] allSchemes​(String xu)
        Extract all schemes at front of a url.
        Returns:
        vector of schemes
      • truePath

        public static String truePath​(String path)
        return repaired path; if this path appears to start with a windows drive letter hidden by leading '/', then the leading '/' is removed
        Parameters:
        path -
        Returns:
        repaired path