Refine search
&& !getSession().equals(VaadinSession.getCurrent())) { message += "Furthermore, it is already attached to another VaadinSession. "; setTheme(request.getParameter("theme")); .getAttribute(ApplicationConstants.UI_ROOT_PATH); if (uiPathInfo != null) { setUiPathInfo(uiPathInfo); if (getSession() != null && getSession().getConfiguration() != null && getSession().getConfiguration().isSendUrlsAsParameters() && getPage().getLocation() != null) { } else if (request.getPathInfo() != null) { String pathInfo = request.getPathInfo(); if (uiRootPath.endsWith(pathInfo)) { uiRootPath = uiRootPath.substring(0,
WrappedSession oldSession = request.getWrappedSession(); serviceSession.setAttribute(PRESERVE_UNBOUND_SESSION_ATTRIBUTE, Boolean.TRUE); WrappedSession newSession = request.getWrappedSession(); VaadinService service = serviceSession.getService(); serviceSession.getLockInstance());
@Override public String getStaticFileLocation(VaadinRequest request) { // /html is default for Liferay String staticFileLocation = getParameter(request, Constants.PORTAL_PARAMETER_VAADIN_RESOURCE_PATH, "/html"); if (Constants.PORTLET_CONTEXT.equals(staticFileLocation)) { return request.getContextPath(); } else { return trimTrailingSlashes(staticFileLocation); } }
public static boolean isUIInitRequest(VaadinRequest request) { return "POST".equals(request.getMethod()) && request .getParameter(UIInitHandler.BROWSER_DETAILS_PARAMETER) != null; }
/** * For internal use by VaadinServlet/VaadinPortlet only. Updates all * properties in the class according to the given information. * * @param request * the Vaadin request to read the information from */ public void updateRequestDetails(VaadinRequest request) { locale = request.getLocale(); address = request.getRemoteAddr(); secureConnection = request.isSecure(); // Headers are case insensitive according to the specification but are // case sensitive in Weblogic portal... String agent = request.getHeader("User-Agent"); if (agent != null) { browserApplication = agent; browserDetails = new VBrowserDetails(agent); } if (request.getParameter("v-sw") != null) { updateClientSideDetails(request.getParameter("v-sw"), request.getParameter("v-sh"), request.getParameter("v-tzo"), request.getParameter("v-rtzo"), request.getParameter("v-dstd"), request.getParameter("v-dston"), request.getParameter("v-tzid"), request.getParameter("v-curdate"), request.getParameter("v-td") != null); } }
/** * Finds the {@link UI} that belongs to the provided request. This is * generally only supported for UIDL requests as other request types are not * related to any particular UI or have the UI information encoded in a * non-standard way. The returned UI is also set as the current UI ( * {@link UI#setCurrent(UI)}). * * @param request * the request for which a UI is desired * @return the UI belonging to the request or null if no UI is found * */ public UI findUI(VaadinRequest request) { // getForSession asserts that the lock is held VaadinSession session = loadSession(request.getWrappedSession()); // Get UI id from the request String uiIdString = request.getParameter(UIConstants.UI_ID_PARAMETER); UI ui = null; if (uiIdString != null && session != null) { int uiId = Integer.parseInt(uiIdString); ui = session.getUIById(uiId); } UI.setCurrent(ui); return ui; }
@Override protected void init(VaadinRequest request) { initLogging(); // store the webservice URL property explicitly in the session in order to // access it from the "external" servlets getSession().getSession().setAttribute(WEBSERVICEURL_KEY, getSession().getAttribute(Helper.KEY_WEB_SERVICE_URL)); getSession().setAttribute(CONTEXT_PATH, request.getContextPath()); alreadyAddedCSS.clear(); initPlugins(); checkIfRemoteLoggedIn(request); getSession().addRequestHandler(new RemoteUserRequestHandler()); }
public static String getContext() { if (VaadinService.getCurrentRequest() != null) { return VaadinService.getCurrentRequest().getContextPath(); } else { return (String) VaadinSession.getCurrent().getAttribute( AnnisBaseUI.CONTEXT_PATH); } }
String pathInfo = request.getPathInfo(); StreamVariable streamVariable; session.lock(); try { UI uI = session.getUIById(Integer.parseInt(uiId)); UI.setCurrent(uI); session.unlock(); String contentType = request.getContentType(); if (contentType.contains("boundary")) {
context.setSessionId(currentUI.getSession().getSession().getId()); context.setUiId(currentUI.getUIId()); context.setUsername(vaadinRequest.getRemoteUser()); final String searchString = vaadinRequest.getParameter("search"); final Integer maxClusterRadius = Integer.getInteger("gwt.maxClusterRadius", 350); LOG.info("Starting search string: {}, max cluster radius: {}", searchString, maxClusterRadius);
/** * Creates and registers a new VaadinSession for this service. Assumes * proper locking has been taken care of by the caller. * * * @param request * The request which triggered session creation. * @return A new VaadinSession instance * @throws ServiceException */ private VaadinSession createAndRegisterSession(VaadinRequest request) throws ServiceException { assert ((ReentrantLock) getSessionLock(request.getWrappedSession())) .isHeldByCurrentThread() : "Session has not been locked by this thread"; VaadinSession session = createVaadinSession(request); VaadinSession.setCurrent(session); storeSession(session, request.getWrappedSession()); // Initial WebBrowser data comes from the request session.getBrowser().updateRequestDetails(request); // Initial locale comes from the request Locale locale = request.getLocale(); session.setLocale(locale); session.setConfiguration(getDeploymentConfiguration()); session.setCommunicationManager( new LegacyCommunicationManager(session)); ServletPortletHelper.initDefaultUIProvider(session, this); onVaadinSessionStarted(request, session); return session; }
String pathInfo = request.getPathInfo(); session.lock(); Class<?> context; try { context = session.getCommunicationManager().getDependencies() .get(fileName); } finally { session.unlock(); int resourceCacheTime = request.getService() .getDeploymentConfiguration().getResourceCacheTime(); if (resourceCacheTime > 0) {
private static boolean hasPathPrefix(VaadinRequest request, String prefix) { String pathInfo = request.getPathInfo(); if (pathInfo == null) { return false; } if (!prefix.startsWith("/")) { prefix = '/' + prefix; } if (pathInfo.startsWith(prefix)) { return true; } return false; }
/** * Retrieves the wrapped session for the request. * * @param request * The request for which to retrieve a session * @param requestCanCreateSession * true to create a new session if one currently does not exist * @return The retrieved (or created) wrapped session * @throws SessionExpiredException * If the request is not associated to a session and new session * creation is not allowed */ private WrappedSession getWrappedSession(VaadinRequest request, boolean requestCanCreateSession) throws SessionExpiredException { final WrappedSession session = request .getWrappedSession(requestCanCreateSession); if (session == null) { throw new SessionExpiredException(); } return session; }
@Override protected void init(VaadinRequest request) { String errorUri = request.getParameter("errorUri"); WiretapEvent<String> wiretapEvent = (WiretapEvent<String>)VaadinService.getCurrentRequest().getWrappedSession().getAttribute("wiretapEvent"); WiretapPayloadViewPanel panel = new WiretapPayloadViewPanel(wiretapEvent); this.setContent(panel); }
@SuppressWarnings("deprecation") private void prepAttach() { when(request.getParameter("v-loc")).thenReturn(baseUri + "/#home"); ui.getPage() .init(request); when(session.createConnectorId(Matchers.any(ClientConnector.class))).thenAnswer(new ConnectorIdAnswer()); when(session.getLocale()).thenReturn(Locale.FRANCE); when(session.hasLock()).thenReturn(true); ui.setSession(session); }
private UI getBrowserDetailsUI(VaadinRequest request, VaadinSession session) { VaadinService vaadinService = request.getService(); List<UIProvider> uiProviders = session.getUIProviders(); UI retainedUI = session.getUIByEmbedId(embedId); if (retainedUI != null) { if (vaadinService.preserveUIOnRefresh(provider, Integer uiId = Integer.valueOf(session.getNextUIid());
private long getContentLength(VaadinRequest request) { try { return Long.parseLong(request.getHeader("Content-Length")); } catch (NumberFormatException e) { return -1; } }
private static boolean hasParameter(VaadinRequest request, String parameterName) { return request.getParameter(parameterName) != null; }
@Override public boolean synchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { UI uI = session.getService().findUI(request); if (uI == null) { getUINotFoundErrorJSON(session.getService(), request)); return true; rpcHandler.handleRpc(uI, request.getReader(), request); getLogger().log(Level.WARNING, "Invalid security key received from {0}", request.getRemoteHost());