private static String getDecodedHash() { String hashToken = Window.Location.getHash(); if (hashToken == null || hashToken.isEmpty()) { return ""; } return tokenEncoder.decode(hashToken.substring(1)); }
builder.setPath(path); String hash = getHash(); if (hash != null && hash.length() > 0) {
private static String getDecodedHash() { String hashToken = Window.Location.getHash(); if (hashToken == null || hashToken.isEmpty()) { return ""; } return impl.decodeHistoryToken(hashToken.substring(1)); }
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; }
@Override public void convertHistoryToken() { String hash = Window.Location.getHash(); if (hash == null || hash.isEmpty()) { if (LogConfiguration.loggingIsEnabled()) { LOG.fine("Hash is '" + hash + "'. Nothing to do."); } return; } // remove the '#' character if (hash.startsWith("#")) { hash = hash.substring(1); } // navigate to the token using pushState if (LogConfiguration.loggingIsEnabled()) { LOG.fine("Hash is '" + hash + "'. Navigating to '" + hash + "'."); } History.newItem(hash, false); }
public static void showStandalone(ResourceLocator resourceLocator) { // Expect #import/{formId} String hash = Window.Location.getHash(); String[] parts = hash.split("/"); if(parts.length != 2) { Window.alert("Invalid URL"); return; } ResourceId formId = ResourceId.valueOf(parts[1]); showPresenter(formId, resourceLocator).then(new Function<ImportPresenter, Void>() { @Override public Void apply(ImportPresenter presenter) { ActivityInfoEntryPoint.hideLoadingIndicator(); presenter.show(Mode.STANDALONE); return null; } }); } }
private void logAtomicOperation(ModelNode operation){ if(operation.get(OP).asString().equals(COMPOSITE)) // nested composite ops? { Log.error("Failed to to log resources access", operation.toString()); } else if(operation.hasDefined(CHILD_TYPE)) { //ModelNode address = operation.get(ADDRESS).clone(); //address.add(operation.get(CHILD_TYPE).toString(), "*"); resourceLog.log(Window.Location.getHash(), operation.get(ADDRESS).toString()+" : "+operation.get(OP).asString()+"(child-type="+operation.get(CHILD_TYPE)+")"); } else { resourceLog.log(Window.Location.getHash(), operation.get(ADDRESS).toString()+" : "+operation.get(OP).asString()); } }
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 void forceLogin() { Window.Location.assign("/login" + 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 String getHash() { return Window.Location.getHash(); }
public static ApplicationState getInstance() { if ( applicationState == null ) { if ( !Window.Location.getHash().equals( "" ) ) { log.debug( "making app state with hash" ); applicationState = new ApplicationState( Window.Location.getHash() ); } else { log.debug( "making app state without hash" ); applicationState = new ApplicationState(); } } return applicationState; }
private boolean isAppInFocusGroovyConsole() { String hash = Window.Location.getHash(); return GROOVY_CONSOLE_URL_FRAGMENT_REGEX.test(hash); }
@PatchMethod static boolean init(@ParamType(HISTORY_IMPL) Object historyImpl) { String hash = Window.Location.getHash(); int index = hash.indexOf("#"); if (index > -1) { String token = hash.substring(index + 1); GwtReflectionUtils.callPrivateMethod(historyImpl, "setToken", token); nativeUpdate(historyImpl, token); } return true; }
private static String getDecodedHash() { String hashToken = Window.Location.getHash(); if (hashToken == null || hashToken.isEmpty()) { return ""; } return tokenEncoder.decode(hashToken.substring(1)); }
private static URL getURLToUse() { if (urlHolder.url == null) { try { urlHolder.url = new URL(GWT.getHostPageBaseURL() + computePath() + Location.getHash()); } catch (MalformedURLException e) { throw new GwtTestConfigurationException( "GWT.getHostPageBaseURL() has failed to be parsed in a " + URL.class.getName() + " instance", e); } } return urlHolder.url; }
private static URL getURLToUse() { if (urlHolder.url == null) { try { urlHolder.url = new URL(GWT.getHostPageBaseURL() + computePath() + Location.getHash()); } catch (MalformedURLException e) { throw new GwtTestConfigurationException( "GWT.getHostPageBaseURL() has failed to be parsed in a " + URL.class.getName() + " instance", e); } } return urlHolder.url; }
public static void initializeStemCellSearchApp(final SearchUIConfig uiConfig) { log.info( "making new application state" ); if ( !Window.Location.getHash().equals( "" ) ) { log.info( "making app state with hash" ); INSTANCE = new StemCellSearchApplicationState( Window.Location.getHash(), uiConfig ); } else { log.info( "making app state without hash" ); INSTANCE = new StemCellSearchApplicationState(uiConfig); } ModelCache.getInstance().setModelURL( uiConfig.getModelUrl()); }
@PatchMethod static boolean init(@ParamType(HISTORY_IMPL) Object historyImpl) { String hash = Window.Location.getHash(); int index = hash.indexOf("#"); if (index > -1) { String token = hash.substring(index + 1); GwtReflectionUtils.callPrivateMethod(historyImpl, "setToken", token); nativeUpdate(historyImpl, token); } return true; }