ucar.unidata.util
Class EscapeStrings

java.lang.Object
  extended by ucar.unidata.util.EscapeStrings

public class EscapeStrings
extends Object

User: ndp Date: Jul 7, 2006 Time: 10:23:19 AM


Field Summary
static String _allowableInOGC
           
static String _allowableInUrl
           
static String _allowableInUrlQuery
           
static String asciiAlphaNumeric
           
static String asciiNonAlphaNumeric
           
static String opendap_identifier_characters
           
static String opendap_identifier_special_characters
           
 
Constructor Summary
EscapeStrings()
           
 
Method Summary
static String backslashEscape(String x, String reservedChars)
          backslash escape a string
static String backslashUnescape(String x)
          backslash unescape a string
static String escapeDAPIdentifier(String id)
          Define the DEFINITIVE opendap identifier escape function.
static String escapeOGC(String s)
          Define the OGC Web Services escape function.
static String escapeURL(String url)
          Decompose a url and piecemeal encode all of its parts, including query and fragment
static String escapeURLQuery(String ce)
          Define the DEFINITIVE URL constraint expression escape function.
static int indexOf(String escapedName, char c)
          Find first occurence of char c in escapedName, excluding escaped c.
static void main(String[] args)
           
static void mainOld(String[] args)
           
static String normalizeToXML(String s)
          This method is used to normalize strings prior to their inclusion in XML documents.
static String[] splitURL(String url)
          Split a url into the base plus the query
static List<String> tokenizeEscapedName(String escapedName)
          Tokenize an escaped name using "." as delimiter, skipping "\."
static String unEscapeDAPIdentifier(String id)
          Define the DEFINITIVE opendap identifier unescape function.
static String unescapeOGC(String s)
          Define the OGC unescape function.
static String unescapeURL(String url)
          Decode all of the parts of the url including query and fragment
static String unescapeURLQuery(String ce)
          Define the DEFINITIVE URL constraint expression unescape function.
static String urlDecode(String s)
          Define the DEFINITIVE URL unescape function.
static String urlEncode(String s)
          Define the DEFINITIVE URL escape function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

asciiAlphaNumeric

public static String asciiAlphaNumeric

asciiNonAlphaNumeric

public static String asciiNonAlphaNumeric

_allowableInUrlQuery

public static String _allowableInUrlQuery

_allowableInUrl

public static String _allowableInUrl

_allowableInOGC

public static String _allowableInOGC

opendap_identifier_special_characters

public static String opendap_identifier_special_characters

opendap_identifier_characters

public static String opendap_identifier_characters
Constructor Detail

EscapeStrings

public EscapeStrings()
Method Detail

normalizeToXML

public static String normalizeToXML(String s)
This method is used to normalize strings prior to their inclusion in XML documents. XML has certain parsing requirements around reserved characters. These reserved characters must be replaced with symbols recognized by the XML parser as place holder for the actual symbol.

The rule for this normalization is as follows:

Parameters:
s - The String to be normalized.
Returns:
The normalized String.

splitURL

public static String[] splitURL(String url)
Split a url into the base plus the query

Parameters:
url - The expression to unescape.
Returns:
The base and url as a 2 element string array.

escapeDAPIdentifier

public static String escapeDAPIdentifier(String id)
Define the DEFINITIVE opendap identifier escape function.

Parameters:
id - The identifier to modify.
Returns:
The escaped identifier.

unEscapeDAPIdentifier

public static String unEscapeDAPIdentifier(String id)
Define the DEFINITIVE opendap identifier unescape function.

Parameters:
id - The identifier to unescape.
Returns:
The unescaped identifier.

escapeURLQuery

public static String escapeURLQuery(String ce)
Define the DEFINITIVE URL constraint expression escape function.

Parameters:
ce - The expression to modify.
Returns:
The escaped expression.

unescapeURLQuery

public static String unescapeURLQuery(String ce)
Define the DEFINITIVE URL constraint expression unescape function.

Parameters:
ce - The expression to unescape.
Returns:
The unescaped expression.

urlEncode

public static String urlEncode(String s)
Define the DEFINITIVE URL escape function. Note that the whole string is escaped, so be careful what you pass into this procedure.

Parameters:
s - The string to modify.
Returns:
The escaped expression.

urlDecode

public static String urlDecode(String s)
Define the DEFINITIVE URL unescape function.

Parameters:
s - The string to unescape.
Returns:
The unescaped expression.

escapeURL

public static String escapeURL(String url)
Decompose a url and piecemeal encode all of its parts, including query and fragment

Parameters:
url - the url to encode

unescapeURL

public static String unescapeURL(String url)
Decode all of the parts of the url including query and fragment

Parameters:
url - the url to encode

escapeOGC

public static String escapeOGC(String s)
Define the OGC Web Services escape function.

Parameters:
s - The string to encode.
Returns:
The escaped string.

unescapeOGC

public static String unescapeOGC(String s)
Define the OGC unescape function.

Parameters:
s - The string to unescape. b
Returns:
The unescaped string.

backslashEscape

public static String backslashEscape(String x,
                                     String reservedChars)
backslash escape a string

Parameters:
x - escape this
reservedChars - these chars get a backslash in front of them
Returns:
escaped string

backslashUnescape

public static String backslashUnescape(String x)
backslash unescape a string

Parameters:
x - unescape this
Returns:
string with \c -> c

tokenizeEscapedName

public static List<String> tokenizeEscapedName(String escapedName)
Tokenize an escaped name using "." as delimiter, skipping "\."

Parameters:
escapedName - an escaped name
Returns:
list of tokens

indexOf

public static int indexOf(String escapedName,
                          char c)
Find first occurence of char c in escapedName, excluding escaped c.

Parameters:
escapedName - search in this string
c - for this char but not \\char
Returns:
pos in string, or -1

main

public static void main(String[] args)

mainOld

public static void mainOld(String[] args)
                    throws Exception
Throws:
Exception


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.