/** * Get request params from URL string and put them in map. * * @param paramsMap the params map */ public static void updateParamsFromUrl(Map<String, String> paramsMap, String paramsUrl) { if (paramsUrl != null && paramsUrl.trim().length() > 0) { String[] params = paramsUrl.split(PARAMS_SEPARATOR); for (String param : params) { String[] keyVal = param.split("="); if (keyVal != null && keyVal.length == 2) { paramsMap.put(keyVal[0], URL.decodeQueryString(keyVal[1])); } } } }
/** * Params from token. * * @param token the token */ public static void paramsFromToken(String token) { paramsMap.clear(); if (token != null && token.trim().length() > 0) { String[] params = token.split(PARAMS_SEPARATOR); for (String param : params) { String[] keyVal = param.split("="); if (keyVal != null && keyVal.length == 2) { paramsMap.put(keyVal[0], URL.decodeQueryString(keyVal[1])); } } } }
/** * Returns a string where all URL component escape sequences have been * converted back to their original character representations. * <p> * Note: this method will convert the space character escape short form, '+', * into a space. It should therefore only be used for query-string parts. * * @param encodedURLComponent string containing encoded URL component * sequences * @return string with no encoded URL component encoded sequences * * @throws NullPointerException if encodedURLComponent is <code>null</code> * * @deprecated Use {@link #decodeQueryString(String)} */ @Deprecated public static String decodeComponent(String encodedURLComponent) { return decodeQueryString(encodedURLComponent); }
val = URL.decodeQueryString(val); } catch (JavaScriptException e) { GWT.log("Cannot decode a URL query string parameter=" + key +
if (hash != null && hash.length() > 0) { builder.setHash(URL.decodeQueryString(hash));
@Override public String decodeQueryString(String encodedUrlComponent) { return URL.decodeQueryString(encodedUrlComponent); }
@Override public String decodeQueryString(String encodedUrlComponent) { return URL.decodeQueryString(encodedUrlComponent); }
@Override public String decodeQueryString(String encodedURLComponent) { return URL.decodeQueryString(encodedURLComponent); }
/** * URLDecode a string * @param s * @return */ public static String urlDecode(String s) { if (s == null || s.isEmpty()) { return s; } return URL.decodeQueryString(s); }
/** * Returns a string where all URL component escape sequences have been * converted back to their original character representations. * <p> * Note: this method will convert the space character escape short form, '+', * into a space. It should therefore only be used for query-string parts. * * @param encodedURLComponent string containing encoded URL component * sequences * @return string with no encoded URL component encoded sequences * * @throws NullPointerException if encodedURLComponent is <code>null</code> * * @deprecated Use {@link #decodeQueryString(String)} */ @Deprecated public static String decodeComponent(String encodedURLComponent) { return decodeQueryString(encodedURLComponent); }
/** * Returns a string where all URL component escape sequences have been * converted back to their original character representations. * <p> * Note: this method will convert the space character escape short form, '+', * into a space. It should therefore only be used for query-string parts. * * @param encodedURLComponent string containing encoded URL component * sequences * @return string with no encoded URL component encoded sequences * * @throws NullPointerException if encodedURLComponent is <code>null</code> * * @deprecated Use {@link #decodeQueryString(String)} */ @Deprecated public static String decodeComponent(String encodedURLComponent) { return decodeQueryString(encodedURLComponent); }
private void parseQuery(String query) { // throw out the funky business - "?"[name"="value"&"]+ query = query.replaceAll("/&+/g", "&").replaceAll("/^\\?*&*|&+$/g", ""); if (query.isEmpty()) return; queryParams = GWT.create(Buckets.class); String[] p, pairs = query.split("&"); String name, value; for (final String pair : pairs) { p = pair.split("="); name = URL.decodeQueryString(p[0]); // no "=" is null according to http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#collect-url-parameters value = p.length > 1 && !p[1].isEmpty() ? URL.decodeQueryString(p[1]) : null; queryParams.add(name, value); } }
private Message decodeMessage(Element e) { Message message = new Message(); String content = e.getInnerText(); String[] parts = content.split(","); message.setContent(URL.decodeQueryString(parts[0])); for (int i = 1; i < parts.length; i++) { String[] keyValuePair = parts[i].split("="); message.getAttributes().put(URL.decodeQueryString(keyValuePair[0]), URL.decodeQueryString(keyValuePair[1])); } message.setSerialNumber(Integer.parseInt(e.getAttribute("id"))); return message; }
val = URL.decodeQueryString(val); } catch (JavaScriptException e) { GWT.log("Cannot decode a URL query string parameter=" + key +
val = URL.decodeQueryString(val); } catch (JavaScriptException e) { GWT.log("Cannot decode a URL query string parameter=" + key +
/** * Parses the diagnosis. Support for older version of stemcell search. Prior version * used a pipe to separate diagnosis & age in one field. Older version was in the format * of: disease=http://purl.bioontology.org/ontology/MSH/D003920|0-10& * @param value * @return true if value contains the old delimiter */ private boolean parseDiagnosis(final String value) { String age = ""; EIURI disease = EIURI.NULL_EIURI; if ( value.contains( OLD_VALUE_DELIMITER ) ) { String[] parts = value.split( "\\" + OLD_VALUE_DELIMITER ); if ( parts.length > 1 ) { age = urlEncodeDecodeParamLabels ? URL.decodeQueryString( parts[1] ) : parts[1]; disease = EIURI.create( parts[0] ); } else { disease = EIURI.create( parts[0] ); age = ""; } addDiagnosisInfo( disease, age ); return false; } return true; } /**
/** * Parses the genetic alteration. Support for older version of stemcell search. Prior version * used a pipe to the label and the URI for the genetic alteration. Older version was in the format * of: ga=GRN(SER116XAA)|http://shared.eagle-i.net/i/00000144-7b5c-77f7-5797-c9ee80000000& * @param value */ private boolean parseGA(final String value) { String gaLabel = ""; EIURI gaURI = EIURI.NULL_EIURI; if ( value.contains( OLD_VALUE_DELIMITER ) ) { String[] parts = value.split( "\\" + OLD_VALUE_DELIMITER ); if ( parts.length > 1 ) { gaLabel = urlEncodeDecodeParamLabels ? URL.decodeQueryString( parts[0] ) : parts[0]; gaURI = EIURI.create( parts[1] ); } else { gaURI = EIURI.create( parts[1] ); gaLabel = ""; } processAsObjectProperty(humanSubject, geneticAlterationProperty.getEntity(), gaLabel, gaURI); return false; } return true; }
if (hash != null && hash.length() > 0) { builder.setHash(URL.decodeQueryString(hash));
if (hash != null && hash.length() > 0) { builder.setHash(URL.decodeQueryString(hash));
public static PlacePropertyValueList parse(String token) { final String globalFlag = "g"; RegExp regExp = RegExp.compile("([^" + PROPERTY_VALUE_SEPARATOR + "]+)" + PROPERTY_VALUE_SEPARATOR + "([^" + PROPERTY_VALUE_ITEM_SEPARATOR + "]+)" + PROPERTY_VALUE_ITEM_SEPARATOR, globalFlag); MatchResult matchResult = regExp.exec(token); Builder resultBuilder = builder(); while(matchResult != null) { String name = URL.decodeQueryString(matchResult.getGroup(1)); String value = URL.decodeQueryString(matchResult.getGroup(2)); resultBuilder.set(name, value); final int matchLength = matchResult.getGroup(0).length(); final int matchStart = matchResult.getIndex(); final int nextIndex = matchStart + matchLength; regExp.setLastIndex(nextIndex); matchResult = regExp.exec(token); } return resultBuilder.build(); }