org.sapia.ubik.net
Class QueryStringParser

java.lang.Object
  extended by org.sapia.ubik.net.QueryStringParser
All Implemented Interfaces:
javax.naming.NameParser

public class QueryStringParser
extends java.lang.Object
implements javax.naming.NameParser

Parses query strings to object representations. It can be used to create QueryString or Name instances.

From this class' point of view, a query string/name is made of paths delimited by '/'; it can optionally be followed by a list of name-value pairs. The following is a valid query string:

some/object?prop1=value1&prop2=value2...

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site
See Also:
QueryString

Constructor Summary
QueryStringParser()
          Constructor for QueryStringParser.
 
Method Summary
 java.lang.String nameToString(javax.naming.Name n)
          Returns the string form of a Name.
 javax.naming.Name parse(java.lang.String queryString)
          Parses the given query string into a javax.naming.Name instance.
 java.util.Enumeration parseNameTokens(java.lang.String queryString)
          Parses the given string into an enumeration of paths.
 QueryString parseQueryString(java.lang.String string)
          Parses the given name string into a QueryString instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryStringParser

public QueryStringParser()
Constructor for QueryStringParser.

Method Detail

parseQueryString

public QueryString parseQueryString(java.lang.String string)
Parses the given name string into a QueryString instance.

Returns:
a QueryString.

parseNameTokens

public java.util.Enumeration parseNameTokens(java.lang.String queryString)
Parses the given string into an enumeration of paths.

Parameters:
queryString - a query string.
Returns:
an Enumeration containing the separate paths that make the given query string; if the given name has trailing name-value pairs has attributes, the latter are concatenated to the last path. Thus, the following string: some/object?prop1=value1&prop2=value2 would have object?prop1=value1&prop2=value2 as its last path string.

parse

public javax.naming.Name parse(java.lang.String queryString)
                        throws javax.naming.NamingException
Parses the given query string into a javax.naming.Name instance. The query string's parameters are part of the last element in the returned name object.

Specified by:
parse in interface javax.naming.NameParser
Returns:
a Name.
Throws:
javax.naming.NamingException
See Also:
parseNameTokens(String), NameParser.parse(String)

nameToString

public java.lang.String nameToString(javax.naming.Name n)
Returns the string form of a Name.

Returns:
a name - as a string.


Copyright © 2010 Sapia OSS. All Rights Reserved.