/** * Escape special characters in a netcdf short name when * it is intended for use in CDL. * * @param vname the name * @return escaped version of it */ public static String makeValidCDLName(String vname) { return EscapeStrings.backslashEscape(vname, reservedCdl); }
/** * Unescape any escaped characters in a name. * * @param vname the escaped name * @return unescaped version of it */ public static String makeNameUnescaped(String vname) { return EscapeStrings.backslashUnescape(vname); }
public static void main2(String[] args) { String s = "http://thredds.ucar.edu/thredds/dodsC/fmrc/NCEP/GFS/Global_0p5deg/runs/NCEP-GFS-Global_0p5deg_RUN_2011-07-15T00:00:00Z.html.asc?Total_cloud_cover_low_cloud%5B1:1:1%5D%5B0:1:360%5D%5B0:1:719%5D"; log.debug("%s%n", s); log.debug("%s%n", unescapeURL(s)); }
public static void testB(String x) { System.out.printf("org == %s%n", x); System.out.printf("esc == %s%n", EscapeStrings.backslashEscape(x, ".\\")); System.out.printf("unesc == %s%n%n", EscapeStrings.backslashUnescape(EscapeStrings.backslashEscape(x, ".\\"))); assert x.equals(EscapeStrings.backslashUnescape(EscapeStrings.backslashEscape(x, ".\\"))); }
private void testBackslashTokens(String escapedName) { System.out.printf("%s%n", escapedName); List<String> result = EscapeStrings.tokenizeEscapedName(escapedName); for (String r : result) System.out.printf(" %s%n", r); System.out.printf("%n"); }
/** * Define the OGC Web Services escape function. * * @param s The string to encode. * @return The escaped string. */ public static String escapeOGC(String s) { return escapeString(s, _allowableInOGC); }
if(p == null) p = ""; if(i > 0) url += "/"; url += urlEncode(p); url += ("?"+escapeURLQuery(query)); if(fragment != null && fragment.length() > 0) url += ("#"+urlEncode(fragment)); return url;
/** * @param request * @return the request state */ protected ReqState getRequestState(HttpServletRequest request, HttpServletResponse response) throws DAP2Exception { ReqState rs = null; // The url and query strings will come to us in encoded form // (see HTTPmethod.newMethod()) String baseurl = request.getRequestURL().toString(); baseurl = EscapeStrings.unescapeURL(baseurl); String query = request.getQueryString(); query = EscapeStrings.unescapeURLQuery(query); rs = new ReqState(this, request, response, rootpath, baseurl, query); return rs; } //**************************************************************************
public static void main(String[] args) { String s = "https://localhost:8443/thredds/admin/log/access/"; System.out.printf("%s%n", s); System.out.printf("%s%n", escapeURL(s)); }
static public void testOGC() { for (char c : (alphaNumeric + " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~").toCharArray()) { String encoded = EscapeStrings.escapeOGC("" + c); System.err.printf("|%c|=|%s|%n", c, encoded); } }
private static ParsedSectionSpec parseVariableSelector(Object parent, String selector) throws InvalidRangeException { String varNameEsc, indexSelect = null; int pos1 = EscapeStrings.indexOf(selector, '('); if (pos1 < 0) { // no index varNameEsc = selector;
@Deprecated public static String escapeQuery(String urlString) { urlString = urlString.trim(); String[] split = urlString.split("[?]"); return (split[0] == null ? "" : split[0]) + (split[1] == null ? "" : '?' + EscapeStrings.escapeURLQuery(split[1])); }
List<String> tokes = EscapeStrings.tokenizeEscapedName(variableSection); if (tokes.size() == 0) throw new IllegalArgumentException("empty sectionSpec = " + variableSection);
/** * Define the OGC Web Services escape function. * * @param s The string to encode. * @return The escaped string. */ public static String escapeOGC(String s) { return escapeString(s, _allowableInOGC); }
if(p == null) p = ""; if(i > 0) ret.append("/"); ret.append(urlEncode(p)); ret.append(escapeURLQuery(query)); ret.append(urlEncode(fragment));
public static void main(String[] args) { String s = "https://localhost:8443/thredds/admin/log/access/"; System.out.printf("%s%n", s); System.out.printf("%s%n", escapeURL(s)); }
static public void testOGC() { for (char c : (alphaNumeric + " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~").toCharArray()) { String encoded = EscapeStrings.escapeOGC("" + c); System.err.printf("|%c|=|%s|\n", c, encoded); } }
private static ParsedSectionSpec parseVariableSelector(Object parent, String selector) throws InvalidRangeException { String varNameEsc, indexSelect = null; int pos1 = EscapeStrings.indexOf(selector, '('); if (pos1 < 0) { // no index varNameEsc = selector;