/** * Replace characters that are not allowed in DAP2 identifiers. * The set of characters that are allowed in a URI are: * "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+_/.\*"; * All other characters will replaced with their hexidecimal value preceeded by * the "%" character. Thus a space, " ", character will be represented in the * returned string as "%20". * * @param in The string in which to replace characters. * @return The modified identifier. */ public static String id2www(String in) { String s; try { s = escapeString(in, _allowableInURI, _URIEscape); } catch (Exception e) { s = null; } return s; }
/** * Constructs a new <code>DAPNode</code> with name <code>n</code>. * * @param n the name of the variable. * @param decodeName true if the name is www encoded */ public DAPNode(String n, boolean decodeName) { _myParent = null; if (decodeName) _name = EscapeStrings.www2id(n); else _name = n; _nameEncoded = EscapeStrings.id2www(_name); }
/** * Given a string that contains WWW escape sequences, translate those escape * sequences back into ASCII characters. Escape sequences are indicted by a * leading "%" character followed by 2 characters indicating the hexidecimal * value of the character that was escaped. * * @param in The string to modify. * @return The modified string. */ public static String www2id(String in) { return unescapeString(in, _URIEscape, ""); }
/** * Returns the name of the attribute aliased to. * * @return the name of the attribute aliased to. */ public String getAliasedToAttributeField() { return EscapeStrings.id2www(aliasedToAttributeNamed); }
/** * Sets the name of the class instance. * * @param n the name of the class instance. */ public final void setName(String n) { _nameEncoded = n; setClearName(EscapeStrings.www2id(n)); }
this.CE = (query == null) ? "" : EscapeStrings.www2ce(query);
/** * Sets the unencoded name of the class instance. * * @param n the unencoded name of the class instance. */ public void setClearName(String n) { _name = n; _nameEncoded = EscapeStrings.id2www(n); if(_attr != null) _attr.setClearName(n); if(_attrTbl != null) _attrTbl.setClearName(n); }
public static void main(String[] args) throws Exception { if (args.length > 0) { for (String s : args) { System.out.println("id2www - Input: \"" + s + "\" Output: \"" + id2www(s) + "\" recaptured: " + www2id(id2www(s))); } for (String s : args) { String out = id2www(s); System.out.println("www2id - Input: \"" + out + "\" Output: \"" + www2id(out) + "\" recaptured: " + id2www(www2id(out))); } } else { char[] allBytes = new char[256]; for (int b = 0; b < 256; b++) allBytes[b] = (char) b; String allChars = new String(allBytes); System.out.println("id2www All Characters"); System.out.println("Input String: \"" + allChars + "\""); System.out.println("Output String: \"" + id2www(allChars) + "\""); System.out.println("Recaptured String: \"" + www2id(id2www(allChars)) + "\" "); } }
/** * Given a string that contains WWW escape sequences, translate those escape * sequences back into ASCII characters, with the exception of the escaped * space (0x20) character which appears as "%20". THe Constraint Expression * Parser will break if there are spaces in the CE. Escape sequences are * indicted by a leading "%" character followed by 2 characters indicating * the hexidecimal value of the character that was escaped. * * @param in The string to modify. * @return The modified string. */ public static String www2ce(String in) { return unescapeString(in, _URIEscape, "%20"); }
/** * Replace characters that are not allowed in WWW URLs using rules specific * to Constraint Expressions. This has canged over time and now the only * differences are: * <ui> * <li>'*' is escaped by this function while it is not * escaped by id2www().</li> * <li> ',' is not escaped by this function and it is by id2www</li> * </ui> * The set of characters that are allowed in a CE are: * "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+_/.\"; * All other characters will replaced with their hexidecimal value preceeded by * the "%" character. Thus a space, " ", character will be represented in the * returned string as "%20". * * @param in The string in which to replace characters. * @return The modified identifier. */ public static String id2www_ce(String in) { String s; try { s = escapeString(in, _allowableInURI_CE, _URIEscape); } catch (Exception e) { s = null; } return s; }