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:com.risevision.ui.client.common.widgets.store.StoreContentFrameWidget.java

License:Open Source License

public void show(String storePath, Command onSave, Command onCancel) {
    this.onSave = onSave;
    this.onCancel = onCancel;

    String url = ConfigurationController.getInstance().getConfiguration().getStoreURL();
    url += storePath;/*from  ww  w.jav a2  s . co m*/
    url += "?inRVA=true&cat=Content&cid=" + SelectedCompanyController.getInstance().getSelectedCompanyId();
    url += "&up_id=" + "if_divEditor";
    url += "&parent=" + URL.encodeQueryString(Window.Location.getHref());

    this.getElement().getStyle().clearBackgroundColor();

    this.getElement().addClassName("responsive-iframe");

    show(url);
}

From source file:com.risevision.ui.client.common.widgets.store.StoreTemplateFrameWidget.java

License:Open Source License

public void showStore(String storePath) {
    String url = ConfigurationController.getInstance().getConfiguration().getStoreURL();
    //      String url = "https://store-stage-1.risevision.com/";
    url += storePath;/*from  ww w.jav  a2s. c  om*/
    url += "?inRVA=true&cat=Templates&cid=" + SelectedCompanyController.getInstance().getSelectedCompanyId();
    url += "&up_id=" + "if_divEditor";
    url += "&parent=" + URL.encodeQueryString(Window.Location.getHref());

    this.getElement().getStyle().clearBackgroundColor();

    this.getElement().addClassName("responsive-iframe");

    show(url);
}

From source file:com.risevision.ui.client.gadget.GadgetCustomSettingsWidget.java

License:Open Source License

private void buildUrl() {
    //      String params = "";

    if (gadgetSettings.getGadgetSettings().size() > 0 /* || urlParams.size() > 0 */) {
        for (GadgetSetting g : gadgetSettings.getGadgetSettings()) {
            String value = "";

            if (g.getWidget() instanceof CheckBox) {
                value = ((CheckBox) g.getWidget()).getValue() ? "true" : "false";
            } else if (g.getWidget() instanceof RiseListBox) {
                value = ((RiseListBox) g.getWidget()).getSelectedValue();
            }//from  www .j  a v  a 2s .co  m
            //            else if (g.widget instanceof TextBox || g.widget instanceof ColorPickerTextBox || g.widget instanceof TextStyleWidget)
            //               value = URL.encodeQueryString(((HasText)g.widget).getText()));
            else if (g.getWidget() instanceof HasText)
                value = URL.encodeQueryString(((HasText) g.getWidget()).getText());
            //            else if (g.widget instanceof Hidden)
            //               value = URL.encodeQueryString(((Hidden)g.widget).getValue());

            //            urlParams.put("up_" + g.getName(), value);
            g.setValue(value);

        }

        //         for (Map.Entry<String, String> obj: urlParams.entrySet()) {
        //            if (obj.getValue() != null && !obj.getValue().isEmpty()) {
        //               params += "&" + obj.getKey() + "=" + obj.getValue();
        //            }
        //         }
        //   
        //         if (params.length() > 0)
        //            params = "&" + params.substring(1);

        //         gadgetUrl = (gadgetSettings.getGadgetXmlUrl() + params).trim();
        //         gadgetUrl = gadgetSettings.getGadgetUrl();
    }
}

From source file:com.risevision.ui.client.gadget.WidgetCustomUIWidget.java

License:Open Source License

public void show(Command onSave, WidgetSettingsInfo widgetSettings) {
    //      this.onSave = onSave;
    this.widgetSettings = widgetSettings;

    String url = widgetSettings.getWidgetUiUrl();
    url += url.contains("?") ? "&" : "?";
    url += "up_id=" + "if_divEditor";
    url += "&parent=" + URL.encodeQueryString(Window.Location.getHref());
    url += "&up_rsW=" + PresentationLayoutWidget.getInstance().getPlaceholderWidth();
    url += "&up_rsH=" + PresentationLayoutWidget.getInstance().getPlaceholderHeight();
    url += "&up_companyId=" + SelectedCompanyController.getInstance().getSelectedCompanyId();

    url = url.replace("'", "\\'");

    //      String params = widgetSettings.getAdditionalParams() != null ? widgetSettings.getAdditionalParams() : "";
    //      params = params.replace("\"", "\\\"");

    show(url);//from www. j  ava  2s  . com
}

From source file:com.risevision.viewer.client.controller.ViewerWidgetController.java

License:Open Source License

private String updateUrlParams(String urlParams) {
    int height, width;
    //      int top = 0, left = 0;
    //      urlParams = removeIdParameter(urlParams);
    //      urlParams = addVersionNumber(urlParams);

    if (placeholderInfo.getWidthUnits().equals("%")) {
        width = (int) ((placeholderInfo.getWidth() / 100.0) * Window.getClientWidth());
    } else {//from ww w . j  av a  2 s  . co m
        width = (int) placeholderInfo.getWidth();
    }

    if (placeholderInfo.getHeightUnits().equals("%")) {
        height = (int) ((placeholderInfo.getHeight() / 100.0) * Window.getClientHeight());
    } else {
        height = (int) placeholderInfo.getHeight();
    }

    //"&pid=test1&up_id=test1"
    //      urlParams += "&pid=" + htmlName;
    urlParams += urlParams.contains("?") ? "&" : "?";
    urlParams += "up_id=" + htmlName;
    urlParams += "&parent=" + URL.encodeQueryString(Window.Location.getHref());
    urlParams += "&up_rsW=" + width;
    urlParams += "&up_rsH=" + height;

    String displayId = ViewerEntryPoint.getDisplayId();
    if (displayId != null && !displayId.isEmpty()) {
        urlParams += "&up_displayId=" + displayId;
    }

    urlParams = urlParams.replace("'", "\\'");

    return urlParams;
}

From source file:com.risevision.viewer.client.data.DisplayRegistrationController.java

License:Open Source License

public static void registerDisplay(String claimId, String displayName) {
    // API: /v2/viewer/display/{claimId}/register?callback={callbackName}&name={displayName}
    //      callbackName is mandatory, displayName is optional.
    int viewerWidth = Window.getClientWidth();
    int viewerHeight = Window.getClientHeight();

    String url = Global.DATA_SERVER_URL.replace("{0}", "display");
    url = url.replace("{1}", claimId);
    url += "/register?width=" + viewerWidth + "&height=" + viewerHeight;
    if (displayName != null && !displayName.isEmpty()) {
        url += "&name=" + URL.encodeQueryString(displayName);
    }/*from  w  w  w .  ja va 2 s  .c  o m*/
    url += "&callback=?";
    callUrlNative(url, MODE_REGISTER);
}

From source file:com.seanchenxi.gwt.uri.template.EncodeRule.java

License:Apache License

protected String doEncode(String input, boolean passReserved) {
    return passReserved ? URL.encodeQueryString(input).replace("!", "%21") : URL.encode(input);
}

From source file:com.sencha.gxt.data.client.writer.UrlEncodingWriter.java

License:sencha.com license

@Override
public String write(M model) {
    final StringBuilder sb = new StringBuilder();

    UrlEncodingAppender a = new UrlEncodingAppender() {
        boolean first = true;

        @Override//from www  . j ava 2  s .co  m
        public UrlEncodingAppender append(String field, String value) {
            if (!first) {
                sb.append("&");
            }
            first = false;
            sb.append(URL.encodeQueryString(field)).append("=").append(URL.encodeQueryString(value));
            return this;
        }
    };

    appendModel(model, a);

    return sb.toString();
}

From source file:com.vaadin.client.extensions.BrowserWindowOpenerConnector.java

License:Apache License

private String addParametersAndFragment(String url) {
    if (url == null) {
        return null;
    }//from   www. j  a va2s  .  c  om

    if (!getState().parameters.isEmpty()) {
        StringBuilder params = new StringBuilder();
        for (Entry<String, String> entry : getState().parameters.entrySet()) {
            if (params.length() != 0) {
                params.append('&');
            }
            params.append(URL.encodeQueryString(entry.getKey()));
            params.append('=');

            String value = entry.getValue();
            if (value != null) {
                params.append(URL.encodeQueryString(value));
            }
        }

        url = SharedUtil.addGetParameters(url, params.toString());
    }

    if (getState().uriFragment != null) {
        // Replace previous fragment or just add to the end of the url
        url = url.replaceFirst("#.*|$", "#" + getState().uriFragment);
    }

    return url;
}

From source file:de.spartusch.nasfvi.client.MainWidget.java

License:Apache License

@Override
public final void setHistoryState(final String query, final int offset) {
    String q = query;//from   w  ww  .  ja v a2  s  .co  m

    if (q == null || q.isEmpty()) {
        q = suggestBox.getText();
    }

    History.newItem(URL.encodeQueryString(q) + "&" + String.valueOf(offset), true);
}