|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.util.URIArg
public class URIArg
URI argument wrapper
Nested Class Summary | |
---|---|
protected class |
URIArg.KeyVal
A URI argument key/value pair |
Constructor Summary | |
---|---|
URIArg(java.lang.String uri)
Constructor |
|
URIArg(java.lang.String uri,
boolean unique)
Constructor |
|
URIArg(java.lang.StringBuffer reqURL,
java.lang.String query)
Constructor |
|
URIArg(URIArg uriArg)
Copy Constructor |
Method Summary | |
---|---|
protected URIArg |
_addArg(java.lang.String key,
java.lang.String value,
boolean encode,
boolean obfuscate)
Adds an argument to the URI |
static java.lang.String |
_des64(java.lang.String e)
Descrambles String |
static java.lang.String |
_ens64(java.lang.String d)
Scrambles String |
protected void |
_setURI(java.lang.String uri)
|
URIArg |
addArg(java.lang.String key,
double value)
Adds an argument to the URI |
URIArg |
addArg(java.lang.String key,
int value)
Adds an argument to the URI |
URIArg |
addArg(java.lang.String key,
long value)
Adds an argument to the URI |
URIArg |
addArg(java.lang.String key,
RTProperties rtp)
Adds an argument to the URI |
URIArg |
addArg(java.lang.String key,
java.lang.String value)
Adds an argument to the URI |
URIArg |
addArg(java.lang.String key,
java.lang.String value,
boolean obfuscate)
Adds an argument to the URI |
protected URIArg |
addArg(URIArg.KeyVal keyVal)
Adds an argument to the URI |
void |
addExtension(java.lang.String ext)
Adds a file extension to the end of this URI, ".xml" etc. |
static java.lang.StringBuffer |
decodeArg(java.lang.StringBuffer sb,
java.lang.String s)
Decodes the specified hex-encoded argument (not yet fully tested) |
static java.lang.String |
encodeArg(java.lang.String s)
Hex-encodes a URL argument (if required) |
static java.lang.StringBuffer |
encodeArg(java.lang.StringBuffer sb,
java.lang.String s)
Hex-encodes a URL argument (if required) |
static java.lang.StringBuffer |
encodeArg(java.lang.StringBuffer sb,
java.lang.String s,
boolean obfuscateAll)
Hex-encodes a URL argument |
static java.lang.String |
encodeRTP(RTProperties rtp)
RTP encodes an argument |
java.util.List<java.lang.String> |
getArgNames()
Gets a list of all the argument key names |
RTProperties |
getArgProperties()
Gets args as RTProperties instance |
java.lang.String |
getArgString()
Returns a String representation of all key/values |
java.lang.StringBuffer |
getArgString(java.lang.StringBuffer sbuff)
Returns a String representation of all key/values |
java.lang.StringBuffer |
getArgString(java.lang.StringBuffer sbuff,
boolean includeBlankValues)
Returns a String representation of all key/values |
java.lang.String |
getArgValue(java.lang.String key)
Gets the first occuring value of the specified key |
java.lang.String |
getArgValue(java.lang.String[] keys)
Gets the first occuring value of the specified key |
java.lang.String |
getFile()
Gets the 'file' specification in the URI |
java.lang.String |
getHost()
Gets the 'host' specification in the URI |
protected URIArg.KeyVal |
getKeyVal(java.lang.String key)
Gets the first occuring KeyVal of the specified key |
protected URIArg.KeyVal |
getKeyVal(java.lang.String[] keys)
Gets the first occuring KeyVal of the specified key |
protected java.util.Collection<URIArg.KeyVal> |
getKeyValList()
Gets all the argument key/value pairs as a list of KeyVal> s |
protected OrderedMap<java.lang.String,URIArg.KeyVal> |
getKeyValMap()
Gets an OrderedMap of the argument key/value pairs indexed
by their keys |
int |
getPort()
Gets the 'port' specification in the URI |
java.lang.String |
getProtocol()
Gets the 'protocol' specification in the URI |
java.lang.String |
getURI()
Gets the URI (without arguments) |
boolean |
hasArg(java.lang.String key)
Return true if this URI contains the specified key |
boolean |
hasArg(java.lang.String[] key)
Return true if this URI contains one of the specified keys |
boolean |
hasUniqueKeys()
Gets the 'Unique Arg' attribute |
static boolean |
isAbsoluteURL(java.lang.String url)
Returns true if the URL starts with a protocol definition (ie. |
static void |
main(java.lang.String[] argv)
Main entry point for testing/debugging |
static java.lang.String |
obfuscateArg(java.lang.String s)
Obfuscates (hex-encodes) all characters in the String |
static RTProperties |
parseRTP(java.lang.String rtpArg)
Decodes an RTP encoded argument |
URIArg |
removeArg(java.lang.String key)
Removes all occurances of the specified key from the URI |
URIArg |
removeArg(java.lang.String[] keys)
Removes all occurances of the specified keys from the URI |
URIArg |
removeBlankValues()
Removes all arguments which have blank values |
URIArg |
rtpDecode(java.lang.String rtpKey)
Returns a new URIArg with this URIArg's arguments decoded from a single RTProperties added a specified key [CHECK] |
URIArg |
rtpEncode(java.lang.String rtpKey,
java.lang.String... exclKeys)
Returns a new URIArg with this URIArg's arguments encoded into a single RTProperties added with a specified key [CHECK] |
boolean |
setArgValue(java.lang.String[] key,
int value)
Sets the specified argument key to the specified int value. |
boolean |
setArgValue(java.lang.String[] key,
java.lang.String value)
Sets the specified argument key to the specified String value. |
boolean |
setArgValue(java.lang.String[] key,
java.lang.String value,
boolean obfuscate)
Sets the specified argument key to the specified String value. |
boolean |
setArgValue(java.lang.String key,
int value)
Sets the specified argument key to the specified int value. |
boolean |
setArgValue(java.lang.String key,
java.lang.String value)
Sets the specified argument key to the specified String value. |
boolean |
setArgValue(java.lang.String key,
java.lang.String value,
boolean obfuscate)
Sets the specified argument key to the specified String value. |
boolean |
setHost(java.lang.String _host)
Sets the 'host' |
protected void |
setKeys(java.util.Collection<URIArg.KeyVal> k)
Sets the argument keys in this URI |
boolean |
setPort(int _port)
Sets the 'port' |
boolean |
setProtocol(java.lang.String _proto)
Sets the 'protocol' |
void |
setUniqueKeys(boolean unique)
Sets the 'Unique Arg' attribute |
void |
setURI(java.lang.String uri)
Sets the URI from a string |
java.lang.String |
toString()
A String reperesentation of this URI (with arguments) |
java.lang.String |
toString(boolean includeBlankValues)
A String reperesentation of this URI (with arguments) |
java.net.URL |
toURL()
Returns this URI as a new URL |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public URIArg(URIArg uriArg)
public URIArg(java.lang.String uri, boolean unique)
uri
- The URIpublic URIArg(java.lang.String uri)
uri
- The URIpublic URIArg(java.lang.StringBuffer reqURL, java.lang.String query)
reqURL
- The URL (typically from "request.getRequestURL()")query
- The request query string (typically from "request.getQueryString()")Method Detail |
---|
public static java.lang.String _des64(java.lang.String e)
public static java.lang.String _ens64(java.lang.String d)
public static RTProperties parseRTP(java.lang.String rtpArg)
public static java.lang.String encodeRTP(RTProperties rtp)
public static java.lang.String encodeArg(java.lang.String s)
s
- The URL argument to encode (if required)
public static java.lang.StringBuffer encodeArg(java.lang.StringBuffer sb, java.lang.String s)
sb
- The StringBuffer where the hex encoded String argument will be placeds
- The URL argument to encode (if required)
public static java.lang.StringBuffer encodeArg(java.lang.StringBuffer sb, java.lang.String s, boolean obfuscateAll)
sb
- The StringBuffer where the hex encoded String argument will be placeds
- The URL argument to encodeobfuscateAll
- True to force hex-encoding on all argument characters
public static java.lang.String obfuscateArg(java.lang.String s)
s
- The String to hex-encode
public static java.lang.StringBuffer decodeArg(java.lang.StringBuffer sb, java.lang.String s)
sb
- The StringBuffer where the decoded String argument will be placeds
- The String to decode
public static boolean isAbsoluteURL(java.lang.String url)
url
- The URL to test
public void setUniqueKeys(boolean unique)
unique
- True to set unique argspublic boolean hasUniqueKeys()
public void setURI(java.lang.String uri)
protected void _setURI(java.lang.String uri)
public java.lang.String getURI()
public void addExtension(java.lang.String ext)
ext
- The extension to addprotected void setKeys(java.util.Collection<URIArg.KeyVal> k)
k
- The argument keysprotected java.util.Collection<URIArg.KeyVal> getKeyValList()
KeyVal>
s
protected OrderedMap<java.lang.String,URIArg.KeyVal> getKeyValMap()
OrderedMap
of the argument key/value pairs indexed
by their keys
OrderedMap
of the argument key/value pairspublic java.util.List<java.lang.String> getArgNames()
public URIArg addArg(java.lang.String key, double value)
key
- The key name of the argument to addvalue
- The value of the new key
public URIArg addArg(java.lang.String key, int value)
key
- The key name of the argument to addvalue
- The value of the new key
public URIArg addArg(java.lang.String key, long value)
key
- The key name of the argument to addvalue
- The value of the new key
public URIArg addArg(java.lang.String key, RTProperties rtp)
key
- The key name of the argument to addrtp
- The RTP encoded values of the new key
public URIArg addArg(java.lang.String key, java.lang.String value)
key
- The key name of the argument to addvalue
- The value of the new key
public URIArg addArg(java.lang.String key, java.lang.String value, boolean obfuscate)
key
- The key name of the argument to addvalue
- The value of the new keyobfuscate
- True if value
should be obfuscated
protected URIArg _addArg(java.lang.String key, java.lang.String value, boolean encode, boolean obfuscate)
key
- The key name of the argument to addvalue
- The value of the new keyencode
- True if value
shoudl be hex encodedobfuscate
- True if value
should be obfuscated
protected URIArg addArg(URIArg.KeyVal keyVal)
keyVal
- The key/value pair to add
public URIArg removeArg(java.lang.String key)
key
- The key to remove
public URIArg removeArg(java.lang.String[] keys)
keys
- The key list to remove
public URIArg removeBlankValues()
public boolean hasArg(java.lang.String key)
public boolean hasArg(java.lang.String[] key)
public boolean setArgValue(java.lang.String key, int value)
key
- The agrument keyvalue
- The value to set
public boolean setArgValue(java.lang.String key, java.lang.String value)
key
- The key of the agrumentvalue
- The value to set
public boolean setArgValue(java.lang.String key, java.lang.String value, boolean obfuscate)
key
- The key of the agrumentvalue
- The value to setobfuscate
- True if the value should be obfuscated
public boolean setArgValue(java.lang.String[] key, int value)
key
- The agrument keyvalue
- The value to set
public boolean setArgValue(java.lang.String[] key, java.lang.String value)
key
- The key of the agrumentvalue
- The value to set
public boolean setArgValue(java.lang.String[] key, java.lang.String value, boolean obfuscate)
key
- The key of the agrumentvalue
- The value to setobfuscate
- True if the value should be obfuscated
protected URIArg.KeyVal getKeyVal(java.lang.String key)
key
- The key to get
key
, if anyprotected URIArg.KeyVal getKeyVal(java.lang.String[] keys)
keys
- The key to get
key
, if anypublic java.lang.String getArgValue(java.lang.String key)
key
- The key to get
key
, if anypublic java.lang.String getArgValue(java.lang.String[] keys)
keys
- The key list used to check for the returned value
key
, if anypublic java.lang.String getArgString()
public java.lang.StringBuffer getArgString(java.lang.StringBuffer sbuff)
sbuff
- The StringBuffer to write the key/values to, or null
for a new one
public java.lang.StringBuffer getArgString(java.lang.StringBuffer sbuff, boolean includeBlankValues)
sbuff
- The StringBuffer to write the key/values to, or null for a new oneincludeBlankValues
- True to include keys for blank values.
public RTProperties getArgProperties()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean includeBlankValues)
includeBlankValues
- True to include keys for blank values.
public URIArg rtpEncode(java.lang.String rtpKey, java.lang.String... exclKeys)
rtpKey
- The key to add the encoded args atexclKeys
- keys to exclude from encoding
public URIArg rtpDecode(java.lang.String rtpKey)
rtpKey
- The key of the RTProperties to decode the encoded args from
public java.net.URL toURL() throws java.net.MalformedURLException
java.net.MalformedURLException
public java.lang.String getProtocol()
public boolean setProtocol(java.lang.String _proto)
public java.lang.String getHost()
public boolean setHost(java.lang.String _host)
public int getPort()
public boolean setPort(int _port)
public java.lang.String getFile()
public static void main(java.lang.String[] argv)
argv
- Comand-line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |