Example usage for com.google.gwt.gadgets.client.io IoProvider get

List of usage examples for com.google.gwt.gadgets.client.io IoProvider get

Introduction

In this page you can find the example usage for com.google.gwt.gadgets.client.io IoProvider get.

Prototype

public static GadgetsIo get() 

Source Link

Document

Method providing implementation of GadgetsIo .

Usage

From source file:com.google.gwt.gadgets.sample.traveler.client.TravelerServletClient.java

License:Apache License

public TravelerServletClient(String serverUrl) {
    this.servletUrl = serverUrl + SERVLET_NAME;
    this.io = IoProvider.get();
}

From source file:org.cruxframework.crux.plugin.gadget.client.screen.GadgetURLRewriter.java

License:Apache License

@Override
public String rewrite(String url) {
    if (url == null) {
        return null;
    }/* ww w  .  j  a  v a  2  s  .  co m*/
    String urlRewrite = super.rewrite(url);
    if (!urlRewrite.toLowerCase().startsWith("http:") && !urlRewrite.toLowerCase().startsWith("https:")) {
        String urlGadget = Window.Location.getParameter("url");
        if (urlGadget == null) {
            urlGadget = Window.Location.getHost() + "/" + Window.Location.getPath();
        } else {
            int index = urlGadget.indexOf('?');
            if (index > 0) {
                urlGadget = urlGadget.substring(0, index);
            }
            index = urlGadget.lastIndexOf('/');
            if (index > 0) {
                urlGadget = urlGadget.substring(0, index);
            }
        }
        urlRewrite = urlGadget + "/" + urlRewrite;
    }

    if (isCacheable(urlRewrite)) {
        return IoProvider.get().getProxyUrl(urlRewrite, cachePeriod);
    }

    return IoProvider.get().getProxyUrl(urlRewrite);
}