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

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

Introduction

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

Prototype

public static String decodePathSegment(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:edu.caltech.ipac.firefly.core.DefaultRequestHandler.java

public void processToken(String token) {
    if (token != null) {
        Request req = parse(URL.decodePathSegment(token));
        if (req == null) {
            Application.getInstance().goHome();
        } else {//from   w  ww .j a  v  a2 s  .  c o m
            if (currentSearchRequest != null && currentSearchRequest.equals(req)) {
                Application.getInstance().getToolBar().getDropdown().close();
                currentRequest = req;
                onRequestSuccess(req, false);
            } else if (currentRequest == null || !currentRequest.equals(req)) {
                processRequest(req, false);
            }
        }
    }
}

From source file:grails.plugin.console.charts.client.application.AbstractApplicationPresenter.java

License:Apache License

@Override
public void prepareFromRequest(PlaceRequest request) {
    String query = request.getParameter(ParameterTokens.QUERY, null);
    String appearance = request.getParameter(ParameterTokens.APPEARANCE, null);
    String view = request.getParameter(ParameterTokens.VIEW, DEFAULT_VIEW);
    String connectionString = request.getParameter(ParameterTokens.CONNECTION_STRING, null);

    if (connectionString != null)
        AppUtils.CONNECTION_STRING = URL.decodePathSegment(connectionString);

    if (query != null)
        query = AppUtils.decodeBase64(URL.decodePathSegment(query));

    if (appearance != null)
        appearance = AppUtils.decodeBase64(URL.decodePathSegment(appearance));

    if (query != null && !query.equals(AppUtils.QUERY)) {
        AppUtils.QUERY = query;// w w  w  .j a va2  s . c o m
        result = null;
    }

    if (appearance != null && !appearance.equals(AppUtils.APPEARANCE)) {
        AppUtils.APPEARANCE = appearance;
        result = null;
    }

    if (view != null && !view.equals(AppUtils.VIEW)) {
        AppUtils.VIEW = view;
    }
}

From source file:java.net.URIEncoderDecoder.java

License:Apache License

/**
 * Decodes the string argument which is assumed to be encoded in the {@code
 * x-www-form-urlencoded} MIME content type using the UTF-8 encoding scheme.
 * <p>/*from  ww w .  jav a  2  s  . c  o m*/
 *'%' and two following hex digit characters are converted to the
 * equivalent byte value. All other characters are passed through
 * unmodified.
 * <p>
 * e.g. "A%20B%20C %24%25" -> "A B C $%"
 * <p>
 * Called from URI.getXYZ() methods
 * 
 * @param s
 *            java.lang.String The encoded string.
 * @return java.lang.String The decoded version.
 */
static String decode(String s) throws UnsupportedEncodingException {
    return URL.decodePathSegment(s);
}

From source file:org.obiba.opal.web.gwt.app.client.permissions.support.AclRequest.java

License:Open Source License

public boolean hasPermission(Acls acls) {
    String decodedResource = URL.decodePathSegment(resource);
    for (Acl acl : JsArrays.toIterable(acls.getAclsArray())) {
        if (acl.getResource().equals(decodedResource) && hasAction(acl))
            return true;
    }/*w w w  .  ja v  a  2 s .co  m*/
    return false;
}

From source file:org.opencms.ade.containerpage.client.CmsContentEditorHandler.java

License:Open Source License

/**
 * Opens the content editor according to the history hash.<p>
 *
 * @param historyHash the history hash/*from   w  w w. j  ava  2  s  .c om*/
 */
public void openEditorForHistory(String historyHash) {

    if (historyHash.startsWith(EDITOR_HASH_KEY)) {
        if (!m_editorOpened) {
            m_editorOpened = true;
            CmsDebugLog.getInstance().printLine("EditorHandler - Opening editor from history");
            m_handler.m_controller.setContentEditing(true);
            String id = historyHash.substring(EDITOR_HASH_KEY.length(), historyHash.indexOf(";"));
            if (id.contains(",")) {
                String[] ids = id.split(",");
                m_currentElementId = URL.decodePathSegment(ids[0]);
                m_dependingElementId = URL.decodePathSegment(ids[1]);
            } else {
                m_currentElementId = URL.decodePathSegment(id);
            }
            Command onClose = new Command() {

                public void execute() {

                    addClosedEditorHistoryItem();
                    onClose(null, new CmsUUID(getCurrentElementId()), false);
                }
            };
            String editorLocale = CmsCoreProvider.get().getLocale();

            CmsContentEditor.getInstance().openFormEditor(getEditorContext(), editorLocale, m_currentElementId,
                    null, null, null, null, m_handler.m_controller.getData().getMainLocale(), onClose);
        }
    } else {
        closeContentEditor();
    }
}

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 a  v  a2  s .  co  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.waveprotocol.wave.client.common.util.ClientPercentEncoderDecoder.java

License:Apache License

@Override
public String decode(String encodedValue) throws URIEncoderDecoder.EncodingException {
    String ret = URL.decodePathSegment(encodedValue);
    if (ret.indexOf(0xFFFD) != -1) {
        throw new URIEncoderDecoder.EncodingException(
                "Unable to decode value " + encodedValue + " it contains invalid UTF-8");
    }//from   w  w  w. ja v  a2 s  . c om
    return ret;
}