JavaXT
|
|||||
URL ClassUsed to parse urls, extract querystring parameters, etc. Partial implementation of the java.net.URL class. Provides a querystring parser that is not part of the java.net.URL class. Can be used to parse non-http URLs, including JDBC connection strings.
ConstructorsPublic Methodsexists( ) returns boolean Used to test whether the url endpoint exists. Currently only supports HTTP URLs. setParameter( String key, String value, boolean append ) returns void Used to set or update a value for a given parameter in the query string. If append is true, the value will be added to other values for this key. setParameter( String key, String value ) returns void Used to set or update a value for a given parameter. getParameter( String key ) returns String Returns the value of a specific variable supplied in the query string.
getParameter( String[] keys ) returns String Returns the value of a specific variable supplied in the query string.
getParameters( ) returns LinkedHashMap<String, List<String>> Returns a list of parameters found in query string. getExtendedParameters( ) returns LinkedHashMap<String, List<String>> Returns a list of extended parameters (e.g. jdbc params) that are not part of a standard url removeParameter( String key ) returns String Used to remove a parameter from the query string setHost( String host ) returns void Used to update the host name or IP address found in the URL. getQueryString( ) returns String Returns the query string in the URL, or an empty string if none exists. getKeys( ) returns HashSet<String> Returns a list of parameter names found in the query string. getPath( ) returns String Return the path portion of the URL, starting with a "/" character. The path does not include the query string. If no path is found, returns a null. setPath( String path ) returns void Used to update the path portion of the URL. If the supplied path starts with "./" or "../", only part of the path will be replaced. Otherwise, the entire path will be replaced. When supplying a relative path (path starting with "./" or "../"), the url parser assumes that directories in the original path are terminated with a "/". For example: http://www.example.com/path/If a path is not terminated with a "/", the parser assumes that the last "/" separates a path from a file. Example: http://www.example.com/path/file.htmlFor example, if the original url looks like this: http://www.example.com/path/If you provide a relative path like "../index.html", will yield this: http://www.example.com/index.htmlNote that if the supplied path contains a query string, the original query string will be replaced with the new one. Static MethodsparseQueryString( String query ) returns LinkedHashMap<String, List<String>> Used to parse a url query string and create a list of name/value pairs. parseJDBCParams( String params ) returns LinkedHashMap<String, List<String>> Used to parse a JDBC parameter strings and return a list of name/value pairs. getParameter( String key, HashMap<String, List<String>> parameters ) returns List<String> setParameter( String key, List<String> values, HashMap<String, List<String>> parameters ) returns void removeParameter( String key, HashMap<String, List<String>> parameters ) returns List<String> |