Package edu.ucsb.nceas.metacat
Class MetacatURL
java.lang.Object
edu.ucsb.nceas.metacat.MetacatURL
-
Constructor Summary
ConstructorDescriptionMetacatURL
(String url) This constructor takes a string url and parses it according to the following rules. -
Method Summary
Modifier and TypeMethodDescriptiongetHashParam
(String paramname) returns a single parameter from the hash by nameReturns the parameters in a hashtable.String[]
getParam
(int index) Returns a single parameter and value as a 1D string array.String[][]
Returns the parameters as a 2D string array.Returns the type of the url.static void
Test method for this class.void
void
Prints the parameters neatly to system.outtoString()
returns a string representation of this metacatURL
-
Constructor Details
-
MetacatURL
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
Returns the type of the url. This is defined by the text before the "://" symbol in the url. -
getParams
Returns the parameters as a 2D string array. -
getHashParams
Returns the parameters in a hashtable. -
getHashParam
returns a single parameter from the hash by name- Parameters:
paramname
- the name of the parameter to return.
-
toString
returns a string representation of this metacatURL -
printHashParams
public void printHashParams() -
printParams
public void printParams()Prints the parameters neatly to system.out -
getParam
Returns a single parameter and value as a 1D string array.- Parameters:
index
- the index of the parameter, value array that you want.
-
main
Test method for this class.
-