/** Clear the cookie and redirect the user to the logout page. */ void logout() { Configuration conf = (Configuration) GWT.create(Configuration.class); String cookie = conf.authCookie(); String domain = Window.Location.getHostName(); String path = Window.Location.getPath(); Cookies.setCookie(cookie, "", null, domain, path, false); String baseUrl = GWT.getModuleBaseURL(); String homeUrl = baseUrl.substring(0, baseUrl.indexOf(path)); Window.Location.assign(homeUrl + conf.logoutUrl()); }
/** * redirect unauthorized calls to login * * <p>TODO method.getResponse() is not equal to response. unfortunately */ @Override public RequestCallback filter( final Method method, final Response response, RequestCallback callback) { if (LogConfiguration.loggingIsEnabled()) { Logger.getLogger(FilterawareRetryingCallback.class.getName()) .severe("Unauthorized: " + method.builder.getUrl()); } Window.Location.assign(target + Window.Location.getQueryString()); // useless return, anyway return callback; }
/** Redirect the user to the login page for authentication. */ protected void authenticateUser() { Configuration conf = (Configuration) GWT.create(Configuration.class); Window.Location.assign( GWT.getModuleBaseURL() + conf.loginUrl() + "?next=" + GWT.getModuleBaseURL()); }
private void download() { Window.Location.assign("/downloadDocument.html?id=" + documentId); }
@UiHandler("btnReport") void onReportClick(ClickEvent event) { String reportServiceUrl = GWT.getModuleBaseURL() + resolveReportParamString(); Window.Location.assign(reportServiceUrl); }