Class MetacatURL

java.lang.Object
edu.ucsb.nceas.metacat.MetacatURL

public class MetacatURL extends Object
  • Constructor Details

    • MetacatURL

      public MetacatURL(String url) throws MalformedURLException
      This constructor takes a string url and parses it according to the following rules. 1) The protocol of the url is the text before the "://" symbol. 2) Parameter names are written first and are terminated with the = symbol 3) Parameter values come 2nd and are terminated with an & except for the last value The form of the url looks like: protocol://server.domain.com/servlet/?name1=val1&name2=val2&nameN=valN notice there is no & after the last param. If one is there it is ignored.
      Parameters:
      url - the string to parse
      Throws:
      MalformedURLException
  • Method Details

    • getProtocol

      public String getProtocol()
      Returns the type of the url. This is defined by the text before the "://" symbol in the url.
    • getParams

      public String[][] getParams()
      Returns the parameters as a 2D string array.
    • getHashParams

      public Hashtable getHashParams()
      Returns the parameters in a hashtable.
    • getHashParam

      public Object getHashParam(String paramname)
      returns a single parameter from the hash by name
      Parameters:
      paramname - the name of the parameter to return.
    • toString

      public String toString()
      returns a string representation of this metacatURL
      Overrides:
      toString in class Object
    • printHashParams

      public void printHashParams()
    • printParams

      public void printParams()
      Prints the parameters neatly to system.out
    • getParam

      public String[] getParam(int index)
      Returns a single parameter and value as a 1D string array.
      Parameters:
      index - the index of the parameter, value array that you want.
    • main

      public static void main(String[] args)
      Test method for this class.