UrlBuilder builder = new UrlBuilder(); builder.setProtocol(getProtocol()); builder.setHost(getHost()); String path = getPath(); if (path != null && path.length() > 0) {
public static boolean isNetworkOnline() { String host = Location.getHost(); if (host.startsWith("127.0.0.1") || host.startsWith("localhost")) { return true; } return isNavigatorOnline(); }
private void internalInitialize() { securityTokenProvider .getSecurityToken() .then( token -> { String protocol = "https:".equals(getProtocol()) ? "wss://" : "ws://"; String host = getHost(); String context = getWebsocketContext(); String url = protocol + host + context; char separator = url.contains("?") ? '&' : '?'; String queryParams = separator + "token=" + token + appContext.getApplicationId().map(id -> "&clientId=" + id).orElse(""); Set<Runnable> initActions = appContext.getApplicationId().isPresent() ? emptySet() : singleton(WorkspaceMasterJsonRpcInitializer.this::processWsId); initializer.initialize( "ws-master", singletonMap("url", url + queryParams), initActions); }); }
String href = "http://" + Location.getHost(); String hrefEscaped = href.replace("?", "%3F"); if (hrefEscaped.endsWith("/")) {
String href = "http://" + Location.getHost(); String hrefEscaped = href.replace("?", "%3F"); if (hrefEscaped.endsWith("/")) {
UrlBuilder builder = new UrlBuilder(); builder.setProtocol(getProtocol()); builder.setHost(getHost()); String path = getPath(); if (path != null && path.length() > 0) {
UrlBuilder builder = new UrlBuilder(); builder.setProtocol(getProtocol()); builder.setHost(getHost()); String path = getPath(); if (path != null && path.length() > 0) {
public static UrlBuilder createFromLocation() { UrlBuilder builder = new UrlBuilder(); builder.setProtocol(Location.getProtocol()); builder.setHost(Location.getHost()); String path = Location.getPath(); if (path != null && path.length() > 0) { builder.setPath(path); } String hash = Location.getHash(); if (hash != null && hash.length() > 0) { builder.setHash(hash); } String port = Location.getPort(); if (port != null && port.length() > 0) { builder.setPort(Integer.parseInt(port)); } // Add query parameters. Map<String, List<String>> params = Location.getParameterMap(); 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()])); } return builder; }
public static UrlBuilder createFromLocation() { UrlBuilder builder = new UrlBuilder(); builder.setProtocol(Location.getProtocol()); builder.setHost(Location.getHost()); String path = Location.getPath(); if (path != null && path.length() > 0) { builder.setPath(path); } String hash = Location.getHash(); if (hash != null && hash.length() > 0) { builder.setHash(hash); } String port = Location.getPort(); if (port != null && port.length() > 0) { builder.setPort(Integer.parseInt(port)); } // Add query parameters. Map<String, List<String>> params = Location.getParameterMap(); 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()])); } return builder; }
public void changeLocale( String locale ) { if( currentPlace == null ) return; String token = placeTokenizer.getToken( currentPlace ); Map<String, List<String>> curParams = new HashMap<String, List<String>>( Location.getParameterMap() ); ArrayList<String> value = new ArrayList<String>(); value.add( locale ); curParams.put( "locale", value ); String queryString = "?"; boolean fAddAnd = false; for( Entry<String, List<String>> e : curParams.entrySet() ) { if( fAddAnd ) queryString += "&"; fAddAnd = true; queryString += URL.encodeQueryString( e.getKey() ) + "=" + URL.encodeQueryString( HexaTools.arrayToString( e.getValue() ) ); } String url = Location.getProtocol() + "//" + Location.getHost() + Location.getPath() + queryString + "#" + token; Window.Location.replace( url ); }
public void changeLocale( String locale ) { if( currentPlace == null ) return; String token = placeTokenizer.getToken( currentPlace ); Map<String, List<String>> curParams = new HashMap<String, List<String>>( Location.getParameterMap() ); ArrayList<String> value = new ArrayList<String>(); value.add( locale ); curParams.put( "locale", value ); String queryString = "?"; boolean fAddAnd = false; for( Entry<String, List<String>> e : curParams.entrySet() ) { if( fAddAnd ) queryString += "&"; fAddAnd = true; queryString += URL.encodeQueryString( e.getKey() ) + "=" + URL.encodeQueryString( HexaTools.arrayToString( e.getValue() ) ); } String url = Location.getProtocol() + "//" + Location.getHost() + Location.getPath() + queryString + "#" + token; Window.Location.replace( url ); }
@Override public void convertHistoryToken() { String path = Window.Location.getPath(); if (path.isEmpty() || path.equals("/")) { if (LogConfiguration.loggingIsEnabled()) { LOG.fine("Path is '" + path + "'. Nothing to do."); } return; } String newUrl = Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/"; newUrl = CodeServerParameterHelper.append(newUrl); newUrl = newUrl + "#" + path.substring(1); if (LogConfiguration.loggingIsEnabled()) { LOG.fine("Path is '" + path + "'. Redirecting to '" + newUrl + "'..."); } Window.Location.assign(newUrl); // This will cause a complete reload :( }
@Override public String getRealm() { return Window.Location.getProtocol() + "//" + Window.Location.getHost(); }
@Override public String getHost() { return Window.Location.getHost(); }
private String createClientUrl() { return Window.Location.getProtocol() + "//" + Window.Location.getHost() + //$NON-NLS-1$ "/" + clientPage + //$NON-NLS-1$ "?host=" + proxyConfig.getProxyHost() + //$NON-NLS-1$ "&port=" + proxyConfig.getProxyPort() + //$NON-NLS-1$ "&title=" + consoleTitle; //$NON-NLS-1$ }
private static String redirect() { return Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/ws/"; } }
@Override public void onClick(ClickEvent event) { String url = "http://" + Window.Location.getHost() + Window.Location.getPath() + "?view=" + AppLocations.Locations.VIEW_CLU_SET + "&docId=" + cluSetId; String features = "height=600,width=960,dependent=0,directories=1," + "fullscreen=1,location=1,menubar=1,resizable=1,scrollbars=1,status=1,toolbar=1"; Window.open(url, HTMLPanel.createUniqueId(), features); } });
public String getPlaceUrl( Place place ) { String token = placeTokenizer.getToken( place ); return Location.getProtocol() + "//" + Location.getHost() + Location.getPort() + Location.getPath() + Location.getQueryString() + "#" + token; }
public String getPlaceUrl( Place place ) { String token = placeTokenizer.getToken( place ); return Location.getProtocol() + "//" + Location.getHost() + Location.getPort() + Location.getPath() + Location.getQueryString() + "#" + token; }
/** * Retrieve an Ajax API key given the current location. */ public static String getKey() { return keys.ajaxKeys().get(Location.getHost()); }