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

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

Introduction

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

Prototype

public static String encodeQueryString(String decodedURLComponent) 

Source Link

Document

Returns a string where all characters that are not valid for a URL component have been escaped.

Usage

From source file:br.com.pegasus.solutions.smartgwt.lib.client.view.impl.advanced.bar.infra.ExporterData.java

License:Apache License

private static void export(String fileName, ListGrid listGrid, String exportAs, boolean showInWindow) {
    String params = "exportServletType=LGD&fileName=" + URL.encodeQueryString(fileName) + "&showInWindow="
            + URL.encodeQueryString(new StringBuilder().append(showInWindow).toString()) + "&exportAs="
            + exportAs;//from w  w  w. j a  v a2  s .c om

    if ("json".equals(exportAs)) {
        params = params + buildContent(ExportUtil.getDataAsJson(listGrid));
    } else if (("csv".equals(exportAs)) || ("xls".equals(exportAs))) {
        params = params + buildContent(ExportUtil.buildCsvContent(listGrid));
    } else if ("ooxml".equals(exportAs)) {
        params = params + "&headers=" + URL.encodeQueryString(ExportUtil.getExcelHeaders(listGrid)) + "&lines="
                + URL.encodeQueryString(ExportUtil.getExcelLines(listGrid));
    } else if ("xml".equals(exportAs)) {
        params = params + buildContent(ExportUtil.getDataAsXml(listGrid));
    }

    processRequest(params);
}

From source file:br.com.pegasus.solutions.smartgwt.lib.client.view.impl.advanced.bar.infra.ExporterData.java

License:Apache License

private static String buildContent(String content) {
    return "&content=" + URL.encodeQueryString(content);
}

From source file:cc.alcina.framework.gwt.client.provider.ClientURLComponentEncoder.java

License:Apache License

public String encode(String text) {
    return URL.encodeQueryString(text);
}

From source file:cc.kune.core.client.auth.WaveClientSimpleAuthenticator.java

License:GNU Affero Public License

/**
 * Do login./*  ww  w.j a  v a2 s.  c  om*/
 * 
 * @param userWithoutDomain
 *          the user without domain
 * @param passwd
 *          the passwd
 * @param callback
 *          the callback
 */
public void doLogin(final String userWithoutDomain, final String passwd, final AsyncCallback<Void> callback) {
    final RequestBuilder request = new RequestBuilder(RequestBuilder.POST, "/auth/signin");
    final StringBuffer params = new StringBuffer();
    params.append("address=");
    params.append(URL.encodeQueryString(userWithoutDomain));
    params.append("&password=");
    params.append(URL.encodeQueryString(passwd));
    params.append("&signIn=");
    params.append(URL.encodeQueryString("Sign in"));
    try {
        request.setHeader("Content-Type", "application/x-www-form-urlencoded");
        request.sendRequest(params.toString(), new RequestCallback() {
            @Override
            public void onError(final Request request, final Throwable exception) {
                StackErrorEvent.fire(eventBus, exception);
                callback.onFailure(exception);
            }

            @Override
            public void onResponseReceived(final Request request, final Response response) {
                callback.onSuccess(null);
            }
        });
    } catch (final RequestException e) {
        StackErrorEvent.fire(eventBus, e);
    }
}

From source file:cc.kune.embed.client.panels.EmbedPresenter.java

License:GNU Affero Public License

private void getContentFromHistoryHash(final String stateTokenS) {
    Log.info("Opening statetoken: " + stateTokenS);
    final boolean isGroupToken = TokenMatcher.isGroupToken(stateTokenS);
    final boolean isWaveToken = TokenMatcher.isWaveToken(stateTokenS);
    final String suffix = isGroupToken ? "" : isWaveToken ? "ByWaveRef" : "";

    if (isGroupToken || isWaveToken) {
        // Ok is a token like group.tool.number
        final String getContentUrl = EmbedHelper.getServerWithPath() + "cors/ContentCORSService/getContent"
                + suffix + "?" + new UrlParam(JSONConstants.TOKEN_PARAM, URL.encodeQueryString(stateTokenS));

        // FIXME Exception if is not public?

        EmbedHelper.processRequest(getContentUrl, new Callback<Response, Void>() {

            @Override// ww w  .  j a  v  a 2s .co  m
            public void onFailure(final Void reason) {
                notFound();
            }

            @Override
            public void onSuccess(final Response response) {
                // final StateToken currentToken = new StateToken(currentHash);
                NotifyUser.hideProgress();
                final StateAbstractDTOJs state = JsonUtils.safeEval(response.getText());
                final StateTokenJs stateTokenJs = (StateTokenJs) state.getStateToken();

                // getContent returns the default content if doesn't finds the content
                if ((isGroupToken && stateTokenS.equals(stateTokenJs.getEncoded()))
                        || (isWaveToken && stateTokenS.equals(state.getWaveRef()))) {
                    onGetContentSuccessful(session, EmbedHelper.parse(state));
                } else {
                    // getContent returns def content if content not found
                    notFound();
                }
            }
        });

    } else {
        // Do something
        notFound();
    }
}

From source file:cc.kune.gspace.client.actions.share.ShareInHelper.java

License:GNU Affero Public License

public static String getCommonText() {
    return URL.encodeQueryString(getTitle(SessionInstance.get()) + " " + I18n.tWithNT("via [%s]",
            "used in references 'something via @someone'", I18n.getSiteCommonName()));
}

From source file:cc.kune.gspace.client.actions.share.ShareInHelper.java

License:GNU Affero Public License

public static String getCommonUrl() {
    return URL.encodeQueryString(getCurrentUrl(SessionInstance.get()));
}

From source file:cc.kune.gspace.client.actions.share.ShareInIdenticaMenuItem.java

License:GNU Affero Public License

/**
 * Instantiates a new share in identica menu item.
 * //  ww w.  j  a  v  a  2s  .  com
 * @param action
 *          the action
 * @param iconic
 *          the iconic
 * @param session
 *          the session
 * @param menu
 *          the menu
 * @param i18n
 *          the i18n
 */
@Inject
public ShareInIdenticaMenuItem(final AbstractShareInSocialNetAction action, final IconicResources iconic,
        final Session session, final ShareMenu menu, final I18nTranslationService i18n) {
    super(action, session, menu, i18n.t("Share this in identi.ca"), iconic.identica(),
            ClientFormattedString.build(false, URL_TEMPLATE,
                    URL.encodeQueryString("#" + ShareInHelper.getTitle(session) + " "
                            + ShareInHelper.getCurrentUrl(session) + " " + i18n.tWithNT("via [%s]",
                                    "used in references 'something via @someone'", i18n.getSiteCommonName()))));
}

From source file:cc.kune.gspace.client.actions.share.ShareInTwitterMenuItem.java

License:GNU Affero Public License

/**
 * Instantiates a new share in twitter menu item.
 * // ww  w  .  j  a va 2  s. com
 * @param action
 *          the action
 * @param iconic
 *          the iconic
 * @param session
 *          the session
 * @param menu
 *          the menu
 * @param i18n
 *          the i18n
 */
@Inject
public ShareInTwitterMenuItem(final AbstractShareInSocialNetAction action, final IconicResources iconic,
        final Session session, final ShareMenu menu, final I18nTranslationService i18n) {
    super(action, session, menu, i18n.t("Share this in twitter"), iconic.twitter(),
            ClientFormattedString.build(false, URL_TEMPLATE,
                    URL.encodeQueryString("#" + ShareInHelper.getTitle(session) + " "
                            + ShareInHelper.getCurrentUrl(session) + " " + i18n.tWithNT("via [%s]",
                                    "used in references 'something via @someone'", i18n.getSiteCommonName()))));
}

From source file:com.agnie.common.gwt.serverclient.client.helper.URLInfoImpl.java

License:Open Source License

@Override
public String getUTF8EncodedURL(String url) {
    return URL.encodeQueryString(url);
}