List of usage examples for com.vaadin.server Page getLocation
public URI getLocation() throws IllegalStateException
From source file:com.hack23.cia.web.impl.ui.application.CitizenIntelligenceAgencyUI.java
License:Apache License
@Override protected void init(final VaadinRequest request) { VaadinSession.getCurrent().setErrorHandler(new UiInstanceErrorHandler(this)); setSizeFull();/*from ww w . j a v a 2 s .c o m*/ final DiscoveryNavigator navigator = new DiscoveryNavigator(this, this); navigator.addView("", mainView); setNavigator(navigator); final Page currentPage = Page.getCurrent(); final String requestUrl = currentPage.getLocation().toString(); final String language = request.getLocale().getLanguage(); final UserConfiguration userConfiguration = configurationManager.getUserConfiguration(requestUrl, language); currentPage.setTitle( userConfiguration.getAgency().getAgencyName() + ":" + userConfiguration.getPortal().getPortalName() + ":" + userConfiguration.getLanguage().getLanguageName()); if (getSession().getUIs().isEmpty()) { final WebBrowser webBrowser = currentPage.getWebBrowser(); final CreateApplicationSessionRequest serviceRequest = new CreateApplicationSessionRequest(); serviceRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); final String ipInformation = WebBrowserUtil.getIpInformation(webBrowser); serviceRequest.setIpInformation(ipInformation); serviceRequest.setUserAgentInformation(webBrowser.getBrowserApplication()); serviceRequest.setLocale(webBrowser.getLocale().toString()); serviceRequest.setOperatingSystem(WebBrowserUtil.getOperatingSystem(webBrowser)); serviceRequest.setSessionType(ApplicationSessionType.ANONYMOUS); final ServiceResponse serviceResponse = applicationManager.service(serviceRequest); LOGGER.info(LOG_INFO_BROWSER_ADDRESS_APPLICATION_SESSION_ID_RESULT, requestUrl, language, ipInformation, webBrowser.getBrowserApplication(), serviceRequest.getSessionId(), serviceResponse.getResult().toString()); } }
From source file:com.hack23.cia.web.impl.ui.application.util.UserContextUtil.java
License:Apache License
/** * Gets the request url.// w ww .j a v a2s. co m * * @param current * the current * @return the request url */ public static String getRequestUrl(final Page current) { if (current != null) { return current.getLocation().toString(); } else { final HttpServletRequest httpRequest = ((ServletRequestAttributes) RequestContextHolder .currentRequestAttributes()).getRequest(); return httpRequest.getRequestURL().toString(); } }
From source file:org.jdal.vaadin.VaadinUtils.java
License:Apache License
/** * Exit application/* w w w .j a v a 2 s . c o m*/ */ public static void exit() { UI.getCurrent().close(); VaadinSession.getCurrent().close(); Page page = Page.getCurrent(); String location = StringUtils.substringBeforeLast(page.getLocation().toString(), page.getUriFragment()); location = StringUtils.substringAfterLast(location, "#"); page.setLocation(location); }