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

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

Introduction

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

Prototype

@Deprecated
public static String encodeComponent(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:ccc.client.gwt.core.GWTTemplateEncoder.java

License:Open Source License

/** {@inheritDoc} */
@Override
public String encode(final String string) {
    return URL.encodeComponent(string);
}

From source file:com.audata.client.json.URLEncoder.java

License:Open Source License

public static String buildQueryString(Entry[] queryEntries) {
    StringBuffer sb = new StringBuffer();

    for (int i = 0, n = queryEntries.length; i < n; ++i) {
        Entry queryEntry = queryEntries[i];

        if (i > 0) {
            sb.append("&");
        }//from w  w  w  .  j  a  va2s  .  c  o  m

        // encode the characters in the name
        String encodedName = URL.encodeComponent(queryEntry.getName());
        sb.append(encodedName);

        sb.append("=");

        // encode the characters in the value
        String encodedValue = URL.encodeComponent(queryEntry.getValue());
        sb.append(encodedValue);
    }

    return sb.toString();
}

From source file:com.edgenius.wiki.gwt.client.page.widgets.RSSFeedButton.java

License:Open Source License

/**
 * @return/*  w w w. j  av  a2  s. co m*/
 */
private String getRSSURL() {
    if (GwtUtils.isSupportInURL(spaceUname))
        return GwtClientUtils.getBaseUrl() + "feed/" + URL.encodeComponent(spaceUname);
    else
        //if spaceUname include "/", and put it into URL rather than parameters, I found any web filter won't get it, and it cause weird problem
        //even after encode.
        return GwtClientUtils.getBaseUrl() + "feed.do?s=" + URL.encodeComponent(spaceUname);
}

From source file:com.google.gerrit.common.data.GitwebLink.java

License:Apache License

public String toRevision(final Project.NameKey project, final PatchSet ps) {
    ParamertizedString pattern = new ParamertizedString(type.getRevision());

    final Map<String, String> p = new HashMap<String, String>();
    p.put("project", URL.encodeComponent(project.get()));
    p.put("commit", URL.encodeComponent(ps.getRevision().get()));
    return baseUrl + pattern.replace(p);
}

From source file:com.google.gerrit.common.data.GitwebLink.java

License:Apache License

public String toProject(final Project.NameKey project) {
    ParamertizedString pattern = new ParamertizedString(type.getProject());

    final Map<String, String> p = new HashMap<String, String>();
    p.put("project", URL.encodeComponent(project.get()));
    return baseUrl + pattern.replace(p);
}

From source file:com.google.gerrit.common.data.GitwebLink.java

License:Apache License

public String toBranch(final Branch.NameKey branch) {
    ParamertizedString pattern = new ParamertizedString(type.getBranch());

    final Map<String, String> p = new HashMap<String, String>();
    p.put("project", URL.encodeComponent(branch.getParentKey().get()));
    p.put("branch", URL.encodeComponent(branch.get()));
    return baseUrl + pattern.replace(p);
}

From source file:com.google.gwt.sample.feedreader.client.ConfigurationPanel.java

License:Apache License

public ConfigurationPanel(final Configuration configuration, final ManifestPanel parent) {
    super("Configuration", parent);
    this.configuration = configuration;
    this.parent = parent;
    final List feeds = configuration.getFeeds();

    setEditCommand("Reset", "Delete all application settings", new Command() {
        public void execute() {
            if (!Window.confirm("Do you wish to reset the application?")) {
                return;
            }/*  w  ww .  ja  v a2  s . c  o  m*/
            configuration.reset();
            parent.setDirty();
            exit();
        }
    });

    add(new PanelLabel("About...", new Command() {
        public void execute() {
            History.newItem("about");
        }
    }));

    // Create the search option
    {
        UnsunkLabel title = new UnsunkLabel("Search for new feeds...");
        title.addStyleName("title");
        UnsunkLabel info = new UnsunkLabel("Add feeds by searching.");
        info.addStyleName("snippit");

        FlowPanel vp = new FlowPanel();
        vp.add(title);
        vp.add(info);

        add(new PanelLabel(vp, new Command() {
            public void execute() {
                final String query = Window.prompt("Search query", "");
                if ((query != null) && (query.length() > 0)) {
                    History.newItem("search||" + URL.encodeComponent(query));
                }
            }
        }));
    }

    // Add all of the feeds to the panel.
    for (Iterator i = feeds.iterator(); i.hasNext();) {
        final Configuration.Feed feed = (Configuration.Feed) i.next();
        addFeed(feed);
    }
}

From source file:com.gwt.conn.client.Communicate.java

public static String buildQueryString(String[] keys, String[] values) {
    StringBuffer sb = new StringBuffer();
    if (keys.length != values.length) {
        return "ERROR";
    }// w w w .j a va  2s .  co m
    for (int i = 0, n = keys.length; i < n; ++i) {

        if (i > 0) {
            sb.append("&");
        }

        // encode the characters in the name
        String encodedName = URL.encodeComponent(keys[i]);
        sb.append(encodedName);

        sb.append("=");

        // encode the characters in the value
        String encodedValue = URL.encodeComponent(values[i]);
        sb.append(encodedValue);
    }

    return sb.toString();
}

From source file:com.hazelcast.monitor.client.InstanceChartPanel.java

License:Open Source License

public void handle(ChangeEvent e) {
    InstanceStatistics event = (InstanceStatistics) e;
    if (super.name == null || !super.name.equals(event.getName())) {
        return;/*from w  w  w.j a  v  a 2  s. c  o m*/
    }
    VerticalPanel vPanel = (VerticalPanel) disclosurePanel.getContent();
    Label label = (Label) vPanel.getWidget(0);
    label.setText("Size: " + event.getSize() + " | Total Throughput: " + event.getTotalOPS());
    if (vPanel.getWidgetCount() < 2) {
        HorizontalPanel horizontalPanel = new HorizontalPanel();
        horizontalPanel.add(createAbsPanelWithImage());
        horizontalPanel.add(createAbsPanelWithImage());
        horizontalPanel.setBorderWidth(0);
        vPanel.add(horizontalPanel);
    }
    HorizontalPanel horizontalPanel = (HorizontalPanel) vPanel.getWidget(1);
    Image sizeChart = (Image) ((AbsolutePanel) horizontalPanel.getWidget(0)).getWidget(0);
    String encodeName = URL.encodeComponent(name);
    sizeChart.setUrl(getServletName() + "?name=" + encodeName + "&type=size&random=" + Math.random() * 10);
    Image opsChart = (Image) ((AbsolutePanel) horizontalPanel.getWidget(1)).getWidget(0);
    opsChart.setUrl(getServletName() + "?name=" + encodeName + "&type=ops&random=" + Math.random() * 10);
}

From source file:com.hiramchirino.restygwt.client.Resource.java

License:Apache License

public Resource addQueryParam(String key, String value) {
    key = URL.encodeComponent(key);
    value = URL.encodeComponent(value);
    String q = query == null ? "" : query + "&";
    return new Resource(path, q + key + "=" + value);
}