com.dfki.peregrin.servlet
Class ParsedURI
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--com.dfki.peregrin.aux.StringKeyTable
|
+--com.dfki.peregrin.servlet.ParsedURI
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class ParsedURI
- extends StringKeyTable
Abstract Representation for URI.
The following data is stored:
- URI Path
-
Part of the URI which essentially represents a path
within the servlet's XML tree.
- URI Query
-
Query part of the URI. The current syntax is:
querystring ::= q_exp { '&' q_exp }* { '&' }
q_exp ::= empty | String '=' String
String -----> cf. rfc2396
The Path is stored as string and the q_exp
pairs as
Vector
of attribute-value pairs (AttrValPair
).
- Version:
- early
- Author:
- Markus Perling
- See Also:
Path
,
AttrValPair
,
HttpServletRequest
, Serialized Form
Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
Constructor Summary |
ParsedURI()
Initialization with empty URI and empty (but non-zero) attributes list. |
ParsedURI(javax.servlet.http.HttpServletRequest request)
Initialization with respect to a given HttpServletRequest . |
Method Summary |
void |
parseQuery(java.lang.String querystring)
Parses a query string according to the above grammar and stores the resulting
attribute-value pairs. |
java.lang.String |
path()
URI path. |
java.lang.String |
printPairs()
Debugging routine which returns a string of attribute-value pairs of the last query. |
java.lang.String |
query()
Complete query. |
java.util.Vector |
queryAttributes()
Returns list of q_exp pairs (see above). |
java.lang.String |
request()
Original URI request. |
java.lang.String |
stripParameter(java.lang.String query,
java.lang.String attr)
Extracts from a well-formed query string a substring belonging to a given attribute. |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
ParsedURI
public ParsedURI()
- Initialization with empty URI and empty (but non-zero) attributes list.
ParsedURI
public ParsedURI(javax.servlet.http.HttpServletRequest request)
- Initialization with respect to a given
HttpServletRequest
.
request
public java.lang.String request()
- Original URI request.
- Returns:
String
path
public java.lang.String path()
- URI path.
- Returns:
String
query
public java.lang.String query()
- Complete query.
- Returns:
String
of which
queryAttributes
public java.util.Vector queryAttributes()
- Returns list of
q_exp
pairs (see above).
- Returns:
Vector
containing AttrValPair
elements
parseQuery
public void parseQuery(java.lang.String querystring)
- Parses a query string according to the above grammar and stores the resulting
attribute-value pairs.
By default the list of attribute-value pairs is set to be empty before parsing.
If the query string is not well-formed, no error will reported, but the result
may be vacuous.
- Parameters:
querystring
- string containing the query
printPairs
public java.lang.String printPairs()
- Debugging routine which returns a string of attribute-value pairs of the last query.
- Returns:
String
of a list of the form attribute=value
stripParameter
public java.lang.String stripParameter(java.lang.String query,
java.lang.String attr)
- Extracts from a well-formed query string a substring belonging to a given attribute.
- Parameters:
query
- query stringattr
- desired attribute- Returns:
- if succesfull, a
String
of the form attr=value
, else query