edu.ucsb.nceas.metacat
Class MetacatURL

java.lang.Object
  extended byedu.ucsb.nceas.metacat.MetacatURL

public class MetacatURL
extends java.lang.Object


Constructor Summary
MetacatURL(java.lang.String url)
          This constructor takes a string url and parses it according to the following rules.
 
Method Summary
 java.lang.Object getHashParam(java.lang.String paramname)
          returns a single parameter from the hash by name
 java.util.Hashtable getHashParams()
          Returns the parameters in a hashtable.
 java.lang.String[] getParam(int index)
          Returns a single parameter and value as a 1D string array.
 java.lang.String[][] getParams()
          Returns the parameters as a 2D string array.
 java.lang.String getProtocol()
          Returns the type of the url.
static void main(java.lang.String[] args)
          Test method for this class.
 void printHashParams()
           
 void printParams()
          Prints the parameters neatly to system.out
 java.lang.String toString()
          returns a string representation of this metacatURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetacatURL

public MetacatURL(java.lang.String url)
           throws java.net.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
Method Detail

getProtocol

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


getParams

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


getHashParams

public java.util.Hashtable getHashParams()
Returns the parameters in a hashtable.


getHashParam

public java.lang.Object getHashParam(java.lang.String paramname)
returns a single parameter from the hash by name

Parameters:
paramname - the name of the parameter to return.

toString

public java.lang.String toString()
returns a string representation of this metacatURL


printHashParams

public void printHashParams()

printParams

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


getParam

public java.lang.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(java.lang.String[] args)
Test method for this class.



Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.