Example usage for com.google.gwt.http.client URL decodeQueryString

List of usage examples for com.google.gwt.http.client URL decodeQueryString

Introduction

In this page you can find the example usage for com.google.gwt.http.client URL decodeQueryString.

Prototype

public static String decodeQueryString(String encodedURLComponent) 

Source Link

Document

Returns a string where all URL component escape sequences have been converted back to their original character representations.

Usage

From source file:org.rest.client.ui.desktop.widget.RequestUrlWidget.java

License:Apache License

private void performDecodeParamsAction(boolean isCtrl) {
    URLParser data = new URLParser().parse(urlField.getValue());
    List<QueryParam> params = data.getParamsList();
    int paramsSize = params.size();
    for (int i = 0; i < paramsSize; i++) {
        QueryParam param = params.get(i);
        String key = param.getKey();
        if (key == null || key.trim().isEmpty()) {
            continue;
        }/* w ww .  j  av  a  2s .  c o m*/
        if (isCtrl) {
            key = URL.decodePathSegment(key);
        } else {
            key = URL.decodeQueryString(key);
        }
        String value = param.getValue();
        if (isCtrl) {
            value = URL.decodePathSegment(value);
        } else {
            value = URL.decodeQueryString(value);
        }
        QueryParam update = QueryParam.create(key, value);
        params.set(i, update);
    }
    data.setParamsList(params);
    String newUrl = data.toString();
    setText(newUrl);
}

From source file:org.rhq.coregui.client.CoreGUI.java

License:Open Source License

@Override
public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) {
    currentView = URL.decodeQueryString(stringValueChangeEvent.getValue());
    Log.debug("Handling history event for view: " + currentView);

    currentViewPath = new ViewPath(currentView);
    coreGUI.rootCanvas.renderView(currentViewPath);
}

From source file:org.rhq.enterprise.gui.coregui.client.CoreGUI.java

License:Open Source License

public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) {
    currentView = URL.decodeQueryString(stringValueChangeEvent.getValue());
    Log.debug("Handling history event for view: " + currentView);

    currentViewPath = new ViewPath(currentView);
    coreGUI.rootCanvas.renderView(currentViewPath);
}

From source file:org.roda.wui.common.client.tools.HistoryUtils.java

public static List<String> decodeList(List<String> splitted) {
    List<String> tokens = new ArrayList<>();
    for (String item : splitted) {
        tokens.add(URL.decodeQueryString(item));
    }//from   w w w.j a v a2  s  .  c  o  m
    return tokens;
}

From source file:org.rstudio.studio.client.workbench.views.help.HelpPane.java

License:Open Source License

private String getDocTitle(Document doc) {
    String docUrl = StringUtil.notNull(doc.getURL());
    String docTitle = doc.getTitle();

    String previewPrefix = new String("/help/preview?file=");
    int previewLoc = docUrl.indexOf(previewPrefix);
    if (previewLoc != -1) {
        String file = docUrl.substring(previewLoc + previewPrefix.length());
        file = URL.decodeQueryString(file);
        FileSystemItem fsi = FileSystemItem.createFile(file);
        docTitle = fsi.getName();//www.  j a v a  2  s.  com
    } else if (StringUtil.isNullOrEmpty(docTitle)) {
        String url = new String(docUrl);
        url = url.split("\\?")[0];
        url = url.split("#")[0];
        String[] chunks = url.split("/");
        docTitle = chunks[chunks.length - 1];
    }

    return docTitle;
}

From source file:org.unitime.timetable.gwt.client.solver.PageFilter.java

License:Apache License

public void setQuery(String query, boolean fireEvents) {
    if (query != null) {
        Map<String, String> params = new HashMap<String, String>();
        for (String pair : query.split("\\&")) {
            int idx = pair.indexOf('=');
            if (idx >= 0)
                params.put(pair.substring(0, idx), URL.decodeQueryString(pair.substring(idx + 1)));
        }//from   ww w .j  a va  2s . c o  m
        for (FilterParameterInterface param : iFilter.getParameters()) {
            String value = params.get(param.getName());
            if (value != null)
                setValue(param.getName(), value);
            else if (param.getValue() != null && param.getDefaultValue() != null) {
                setValue(param.getName(), param.getDefaultValue());
            }
        }
    }
}

From source file:org.waveprotocol.box.webclient.flags.UrlParameters.java

License:Apache License

UrlParameters(String query) {
    if (query.length() > 1) {
        String[] keyvalpairs = query.substring(1, query.length()).split("&");
        for (String pair : keyvalpairs) {
            String[] keyval = pair.split("=");
            // Some basic error handling for invalid query params.
            String paramUnderlineName = URL.decodeQueryString(keyval[0]);
            String paramCamelName = ValueUtils.toCamelCase(paramUnderlineName, "_", false);
            String key = FlagConstants.getShortName(paramCamelName);
            if (keyval.length == 2) {
                String value = URL.decodeQueryString(keyval[1]);
                map.put(key, value);// w w  w  . j a  v  a2  s . co  m
            } else if (keyval.length == 1) {
                map.put(key, "");
            }
        }
    }
}

From source file:org.xwiki.gwt.user.client.URLUtils.java

License:Open Source License

/**
 * Parses the given query string and decodes the parameter names and values.
 * /*from  ww  w  .  ja  v  a2s  .  c o m*/
 * @param queryString the query string to be parsed
 * @return the map of query string parameters
 */
public static Map<String, List<String>> parseQueryString(String queryString) {
    Map<String, List<String>> parameters = new HashMap<String, List<String>>();
    String[] keyValuePairs = queryString.split(QUERY_STRING_COMPONENT_SEPARATOR);
    for (int i = 0; i < keyValuePairs.length; i++) {
        if (keyValuePairs[i].length() == 0) {
            continue;
        }
        String[] pair = keyValuePairs[i].split("=", 2);
        String name = pair[0];
        String value = pair.length == 1 ? "" : pair[1];
        name = URL.decodeQueryString(name);
        value = URL.decodeQueryString(value);
        List<String> values = parameters.get(name);
        if (values == null) {
            values = new ArrayList<String>();
            parameters.put(name, values);
        }
        values.add(value);
    }
    return parameters;
}