for (Map.Entry<String, List<String>> entry : params.entrySet()) { List<String> values = new ArrayList<String>(entry.getValue()); builder.setParameter(entry.getKey(), values.toArray(new String[values.size()]));
@Override public IsUrlBuilder setParameter(String key, String... values) { b.setParameter(key, values); return this; }
@Override public void addGraphToReport(final RequestCallback callback, final int kscReportId, final String graphTitle, final String graphName, final String resourceId, final String timeSpan) { UrlBuilder builder = new UrlBuilder(); builder.setPath(BASE_URL + "/" + kscReportId); builder.setParameter("title", graphTitle); builder.setParameter("reportName", graphName); builder.setParameter("resourceId", resourceId); builder.setParameter("timespan", timeSpan); // we just want a relative URL, so we render it and strip the beginning :) final String url = builder.buildString().replace("http:///", ""); GWT.log("making request: " + url); sendRequest(callback, RequestBuilder.PUT, url); }
UrlBuilder u = new UrlBuilder(); u.setProtocol("https"); u.setHost("www.mysite.com:8080"); u.setPath("/myServletPath"); u.setParameter("username", nameField.getValue()); u.setParameter("someAttribute", "itsValue"); u.buildString();
for (Map.Entry<String, List<String>> entry : params.entrySet()) { List<String> values = new ArrayList<String>(entry.getValue()); builder.setParameter(entry.getKey(), values.toArray(new String[values.size()]));
for (Map.Entry<String, List<String>> entry : params.entrySet()) { List<String> values = new ArrayList<String>(entry.getValue()); builder.setParameter(entry.getKey(), values.toArray(new String[values.size()]));
public static void showSampleInNewTab(ShowcaseSampleDefinition sample) { UrlBuilder urlBuilder = Window.Location.createUrlBuilder(); urlBuilder.setParameter("sample", sample.getKey()); String url = urlBuilder.buildString(); Window.open(url, sample.getTitle(), ""); }
private void setCurrentLanguage( final String languageName, final UserWorkbenchPreferences response ) { String isRefresh = Window.Location.getParameter( "isRefresh" ); if ( response != null && ( isRefresh == null || isRefresh.equals( "" ) ) ) { Window.Location.assign( Window.Location.createUrlBuilder() .removeParameter( getLocaleQueryParam() ) .setParameter( getCurrentLocaleQueryParam(), languageName ) .setParameter( "isRefresh", "false" ) .buildString() ); } else if ( response == null ) { Window.Location.assign( Window.Location.createUrlBuilder() .removeParameter( getLocaleQueryParam() ) .setParameter( getCurrentLocaleQueryParam(), languageName ) .buildString() ); } }
public static String localeUrl(ApplicationLocale applicationLocale) { // We use the sub-delim '+' extensively in fragment identifiers, // for example: // #data-entry/Activity+53432 // UrlBuilder will decode and re-encode this resulting in // #data-entry/Activity%2053432 // Which will break navigation // So we will first construct the url without the hash, // and then append the already-encoded fragment identifier directly String url = Window.Location.createUrlBuilder() .setParameter("locale", applicationLocale.getCode()) .setHash(null) .buildString(); return url + Window.Location.getHash(); }
public static String localeUrl(ApplicationLocale applicationLocale) { // We use the sub-delim '+' extensively in fragment identifiers, // for example: // #data-entry/Activity+53432 // UrlBuilder will decode and re-encode this resulting in // #data-entry/Activity%2053432 // Which will break navigation // So we will first construct the url without the hash, // and then append the already-encoded fragment identifier directly String url = Window.Location.createUrlBuilder() .setParameter("locale", applicationLocale.getCode()) .setHash(null) .buildString(); return url + Window.Location.getHash(); }
@Override public void configurationSetting(final boolean isInit) { String languageName = languageItem.getSelectedItem().getK2(); String isRefresh = Window.Location.getParameter("isRefresh"); if ((isRefresh == null || isRefresh.equals("")) && isInit) { Window.Location.assign(Window.Location.createUrlBuilder() .removeParameter(LocaleInfo.getLocaleQueryParam()) .setParameter(LocaleInfo.getCurrentLocale().getLocaleQueryParam(), languageName) .setParameter("isRefresh", "false") .buildString()); } else if (!isInit) { Window.Location.assign(Window.Location.createUrlBuilder() .removeParameter(LocaleInfo.getLocaleQueryParam()) .setParameter(LocaleInfo.getCurrentLocale().getLocaleQueryParam(), languageName) .buildString()); } }
String param = Window.Location.createUrlBuilder().setParameter("locale", language.getValue()).buildString(); Window.Location.replace(param);