/** * Closes those UIs in the given session for which {@link #isUIActive} * yields false. * * @since 7.0.0 */ private void closeInactiveUIs(VaadinSession session) { final String sessionId = session.getSession().getId(); for (final UI ui : session.getUIs()) { if (!isUIActive(ui) && !ui.isClosing()) { ui.accessSynchronously(() -> { getLogger().log(Level.FINE, "Closing inactive UI #{0} in session {1}", new Object[] { ui.getUIId(), sessionId }); ui.close(); }); } } }
if (session.getSession() != null) { getLogger().log(Level.FINE, "Closing inactive session {0}", session.getSession().getId());
@Override public String getSessionId() { return instance.getWrappedSession().getId(); }
@Override public String getRequestedSessionId() { return instance.getWrappedSession().getId(); }
@Override public String getConversationId() { return getVaadinSession().getSession().getId(); } }
@Override public String getSessionId() { return VaadinService.getCurrentRequest().getWrappedSession().getId(); }
/** * Create a VaadinSession * @param locale Client locale * @return VaadinSession instance * @throws Exception Failed to create session */ protected VaadinSession createVaadinSession(Locale locale) throws Exception { WrappedSession wrappedSession = mock(WrappedSession.class); VaadinServletService vaadinService = mock(VaadinServletService.class); when(vaadinService.getDeploymentConfiguration()) .thenReturn(new DefaultDeploymentConfiguration(VaadinServletService.class, getDeploymentProperties())); VaadinSession session = mock(VaadinSession.class); when(session.getState()).thenReturn(VaadinSession.State.OPEN); when(session.getSession()).thenReturn(wrappedSession); when(session.getService()).thenReturn(vaadinService); when(session.getSession().getId()).thenReturn(TEST_SESSION_ID); when(session.hasLock()).thenReturn(true); when(session.getLocale()).thenReturn(locale != null ? locale : Locale.US); return session; }
/** * Create a VaadinSession * @param locale Client locale * @return VaadinSession instance * @throws Exception Failed to create session */ protected VaadinSession createVaadinSession(Locale locale) throws Exception { WrappedSession wrappedSession = mock(WrappedSession.class); VaadinServletService vaadinService = mock(VaadinServletService.class); when(vaadinService.getDeploymentConfiguration()) .thenReturn(new DefaultDeploymentConfiguration(VaadinServletService.class, getDeploymentProperties())); VaadinSession session = mock(VaadinSession.class); when(session.getState()).thenReturn(VaadinSession.State.OPEN); when(session.getSession()).thenReturn(wrappedSession); when(session.getService()).thenReturn(vaadinService); when(session.getSession().getId()).thenReturn(TEST_SESSION_ID); when(session.hasLock()).thenReturn(true); when(session.getLocale()).thenReturn(locale != null ? locale : Locale.US); return session; }
@Override public String getConversationId() { return getVaadinSession().getSession().getId() + getUIID(); } }
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { vaadinSessionIdMap.put(event.getSession(), event.getSession().getSession().getId()); for (SessionListener eachListener : getSessionListeners()) { eachListener.sessionInitialized(vaadinSessionIdMap.get(event.getSession())); } }
@Override public String getConversationId() { if (VaadinSession.getCurrent() == null || !VaadinSession.getCurrent().hasLock()) { throw new IllegalStateException("Unable to use VaadinSessionScope from non-Vaadin thread"); } return VaadinSession.getCurrent().getSession().getId(); } }
@Override public void sessionInit(SessionInitEvent event) throws ServiceException { vaadinSessionIdMap.put(event.getSession(), event.getSession().getSession().getId()); for (SessionListener eachListener : getSessionListeners()) { eachListener.sessionInitialized(vaadinSessionIdMap.get(event.getSession())); } }
SessionAwareBeanStore(VaadinSession session) { super("Session:" + session.getSession().getId()); this.session = session; this.session.getService().addSessionDestroyListener(this); this.session.getService().addServiceDestroyListener(this); this.session.setAttribute(BeanStore.class, this); }
UIStore(VaadinSession session) { this.sessionId = session.getSession().getId(); this.session = session; this.session.getService().addSessionDestroyListener(this); this.session.getService().addServiceDestroyListener(this); this.session.setAttribute(UIStore.class, this); }
@Override public VaadinApplicationContext create(OnmsServiceManager manager) { VaadinApplicationContextImpl context = new VaadinApplicationContextImpl(); context.setSessionId(request.getWrappedSession().getId()); context.setUiId(getUIId()); context.setUsername(request.getRemoteUser()); return context; } });
/** * Closes those UIs in the given session for which {@link #isUIActive} * yields false. * * @since 7.0.0 */ private void closeInactiveUIs(VaadinSession session) { final String sessionId = session.getSession().getId(); for (final UI ui : session.getUIs()) { if (!isUIActive(ui) && !ui.isClosing()) { ui.accessSynchronously(new Command() { @Override public void execute() { getLogger().log(Level.FINE, "Closing inactive UI #{0} in session {1}", new Object[] { ui.getUIId(), sessionId }); ui.close(); } }); } } }
@Override public VaadinApplicationContext create(OnmsServiceManager manager) { VaadinApplicationContextImpl context = new VaadinApplicationContextImpl(); context.setSessionId(request.getWrappedSession().getId()); context.setUiId(getUIId()); context.setUsername(request.getRemoteUser()); return context; } });
context.setSessionId(currentUI.getSession().getSession().getId()); context.setUiId(currentUI.getUIId()); context.setUsername(vaadinRequest.getRemoteUser());
if (session.getSession() != null) { getLogger().log(Level.FINE, "Closing inactive session {0}", session.getSession().getId());