private void redirectToModule(String module) { String path = Window.Location.getPath(); if (!path.endsWith("/")) { if (path.endsWith(".html") || path.endsWith(".htm")) { int index = path.lastIndexOf('/'); path = path.substring(0, index + 1); } else { path += "/"; } } String target = path + module + "/"; Window.Location.assign(Window.Location.createUrlBuilder().setPath(target).buildString()); }
/** * Redirect to module. * * @param module the module name. */ public static void redirectToModule(String module) { String path = Window.Location.getPath(); if (!path.endsWith("/")) { if (path.endsWith(".html") || path.endsWith(".htm")) { int index = path.lastIndexOf('/'); path = path.substring(0, index + 1); } else { path += "/"; } } String target = path + module + "/"; Window.Location.assign(Window.Location.createUrlBuilder().setPath(target).buildString()); }
builder.setProtocol(getProtocol()); builder.setHost(getHost()); String path = getPath(); if (path != null && path.length() > 0) { builder.setPath(path);
/** * Updates browser's address along with tab title in accordance to current running workspace. * * @param namespace namespace of workspace * @param workspaceName name of the current running workspace. Can be null or empty if workspace * was stopped. */ public void setAddress(String namespace, String workspaceName) { String browserUrl = Window.Location.getPath(); int currentSlashIndex = 0; int currentSlashNumber = 0; while (currentSlashNumber < NAMESPACE_START_SEGMENT) { currentSlashIndex = browserUrl.indexOf('/', currentSlashIndex); currentSlashNumber++; } String baseUrl = browserUrl.substring(0, currentSlashIndex) + "/" + namespace + "/" + workspaceName; String title; if (workspaceName == null || workspaceName.isEmpty()) { title = productInfoDataProvider.getDocumentTitle(); } else { title = productInfoDataProvider.getDocumentTitle(workspaceName); } doSetAddress(baseUrl, title); }
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 :( }
/** Returns workspace key from current address or empty string when it is undefined. */ public String getWorkspaceKey() { String browserUrl = Window.Location.getPath(); // TODO temporary to make it work with not "path obliged" URL String wsParam = Window.Location.getParameter("ws"); if (wsParam != null) return wsParam; // String[] urlParts = browserUrl.split("/", NAMESPACE_START_SEGMENT + 1); if (urlParts.length < NAMESPACE_START_SEGMENT) { return ""; } else { return SimpleHtmlSanitizer.sanitizeHtml(urlParts[NAMESPACE_START_SEGMENT]).asString(); } }
@Override public String getPath() { return Window.Location.getPath(); }
@Override public boolean init() { // initialize HistoryImpl with the current path updateHistoryToken(Window.Location.getPath() + Window.Location.getQueryString()); // initialize the empty state with the current history token nativeUpdate(getToken()); // initialize the popState handler initPopStateHandler(); return true; }
public String getPlaceUrl( Place place ) { String token = placeTokenizer.getToken( place ); return Location.getProtocol() + "//" + Location.getHost() + Location.getPort() + Location.getPath() + Location.getQueryString() + "#" + token; }
private void updateStateAndNotify(final String historyToken) { recordAnalyticsPath( Window.Location.getPath() + "#" + historyToken ); updateState( historyToken ); notifyRequest(); }
public boolean init() { // initialize HistoryImpl with the current path updateHistoryToken(Window.Location.getPath() + Window.Location.getQueryString()); // initialize the empty state with the current history token nativeUpdate(token, true); // initialize the popState handler initPopStateHandler(); return true; }
private void maybeConvertHistoryToken(String token) { if (PushStateUtil.isPushStateActivated()) { if (token == null || token.isEmpty()) { return; } if (token.startsWith("#")) { token = token.substring(1); } HistoryWrapper.newItem(Window.Location.getPath() + token, false); } }
@Override public void onStartActivity(StartActivityEvent event) { String placeToken = MvpController.get().getToken(event.getPlace()); this.trackPage(Window.Location.getPath() + "#" + placeToken); }
private void maybeConvertHistoryToken(String token) { if (PushStateUtil.isPushStateActivated()) { if (token == null || token.isEmpty()) { return; } if (token.startsWith("#")) { token = token.substring(1); } HistoryWrapper.newItem(Window.Location.getPath() + token, false); } }
@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 boolean init() { // initialize HistoryImpl with the current path updateHistoryToken(Window.Location.getPath() + Window.Location.getQueryString()); // initialize the empty state with the current history token nativeUpdate(token, true); // initialize the popState handler initPopStateHandler(); return true; }
@Override public void onLogin() { Window.open(Window.Location.getPath(), "_blank", ""); }