net.sourceforge.sillyview
Class URLParser

java.lang.Object
  extended by net.sourceforge.sillyview.URLParser

public class URLParser
extends java.lang.Object

Provides some static methods for dealing with URLs passed from a View.

Version:
1.0
Author:
T.J. Willis

Field Summary
private static Category cat
           
(package private) static java.lang.String postToken
           
(package private) static java.lang.String preToken
           
 
Constructor Summary
URLParser()
           
 
Method Summary
static java.lang.String getFilenameWithoutPath(java.lang.String x)
          Given, for example, the string "http://foo.bar.com/some/dir/lala.jpg?foo=bar" will return "lala.jpg".
static java.lang.String getFilenameWithoutPath(java.net.URL u)
          Strips the last element of the URL's path and returns it.
static java.util.Hashtable<java.lang.String,java.lang.String> parseVariables(java.lang.String x)
          Parses a set of name/value pairs in the form of "name=value&foo=bar" into a Hashtable and returns it.
static java.util.Hashtable parseVariables(java.net.URL u)
          Takes the name/value pairs of the URL's query and returns them as a Hashtable.
static void setPostToken(java.lang.String s)
           
static void setPreToken(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preToken

static java.lang.String preToken

postToken

static java.lang.String postToken

cat

private static Category cat
Constructor Detail

URLParser

public URLParser()
Method Detail

setPreToken

public static void setPreToken(java.lang.String s)

setPostToken

public static void setPostToken(java.lang.String s)

parseVariables

public static java.util.Hashtable parseVariables(java.net.URL u)
Takes the name/value pairs of the URL's query and returns them as a Hashtable.

Parameters:
u - an URL value
Returns:
a Hashtable value

parseVariables

public static java.util.Hashtable<java.lang.String,java.lang.String> parseVariables(java.lang.String x)
Parses a set of name/value pairs in the form of "name=value&foo=bar" into a Hashtable and returns it.

Parameters:
u - an String value
Returns:
a Hashtable value

getFilenameWithoutPath

public static java.lang.String getFilenameWithoutPath(java.net.URL u)
Strips the last element of the URL's path and returns it. Given, for example, the URL: "http://foo.bar.com/some/dir/lala.jpg?foo=bar" will return "lala.jpg".

Parameters:
u - an URL value
Returns:
a String value

getFilenameWithoutPath

public static java.lang.String getFilenameWithoutPath(java.lang.String x)
Given, for example, the string "http://foo.bar.com/some/dir/lala.jpg?foo=bar" will return "lala.jpg".

Parameters:
x - a String value
Returns:
a String value