builder.setProtocol(getProtocol()); builder.setHost(getHost()); String path = getPath();
private static String getProtocol() { if (Window.Location.getProtocol().equals("https:")) { return "https:"; } return "http:"; }
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); }); }
isSecure = Window.Location.getProtocol().toLowerCase().startsWith("https"); if (BLANK_IMAGE_URL == null) { if (isIE8 || (isGecko && !isSecure)) {
builder.setProtocol(getProtocol()); builder.setHost(getHost()); String path = getPath();
builder.setProtocol(getProtocol()); builder.setHost(getHost()); String path = getPath();
/** * Adds a script element to the DOM that loads the API Loader main script "jsapi". * * @param apiKey * Optional API key value (pass null to omit the key). See * http://code.google.com/apis/ajaxsearch/signup.html * @returns <code>true</code> if the API has already been loaded. Otherwise, * returns <code>false</code>, meaning that the application should * wait for a callback. */ private boolean injectJsApi(String apiKey) { if (alreadyInjected) { return true; } boolean alreadyLoaded = createCallback(this); alreadyInjected = true; if (alreadyLoaded) { return true; } Document doc = Document.get(); String key = (apiKey == null) ? "" : ("key=" + apiKey + "&"); String protocol = (Window.Location.getProtocol().equals("https:")) ? "https:" : "http:"; String src = protocol + "//" + HOSTNAME + "/jsapi?" + key + "callback=__gwt_charts_AjaxLoader_onLoad"; ScriptElement script = doc.createScriptElement(); script.setSrc(src); script.setType("text/javascript"); doc.getBody().appendChild(script); return false; }
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 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 ); }
@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 getProtocol() { return Window.Location.getProtocol(); }
@Override public String getRealm() { return Window.Location.getProtocol() + "//" + Window.Location.getHost(); }
@Override protected String getServerUrl() { String protocol = Window.Location.getProtocol(); String hostName = Window.Location.getHostName(); return protocol + "//" + hostName + ":9876/"; }
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/"; } }
public String getPlaceUrl( Place place ) { String token = placeTokenizer.getToken( place ); return Location.getProtocol() + "//" + Location.getHost() + Location.getPort() + Location.getPath() + Location.getQueryString() + "#" + token; }
@Override protected String getServerUrl() { String protocol = Window.Location.getProtocol(); String hostName = Window.Location.getHostName(); return protocol + "//" + hostName + ":9876/"; }
public String getPlaceUrl( Place place ) { String token = placeTokenizer.getToken( place ); return Location.getProtocol() + "//" + Location.getHost() + Location.getPort() + Location.getPath() + Location.getQueryString() + "#" + token; }