diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-09-27 16:14:07 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-09-28 14:14:33 +0300 |
commit | af8fb8ddd2ab54c08a8ac2c120a8d357c98057ec (patch) | |
tree | c32c0abdadecc7d2af43abdb03cf907feb043af2 /server/src/com | |
parent | 01ff5a924b8fdeeda8cbd21973fc1ecd206ef043 (diff) | |
download | vaadin-framework-af8fb8ddd2ab54c08a8ac2c120a8d357c98057ec.tar.gz vaadin-framework-af8fb8ddd2ab54c08a8ac2c120a8d357c98057ec.zip |
Rename VaadinSession -> VaadinServiceSession (#9733)
Change-Id: I4472cebf2f9f4cf3e0dea31a0dda8dc892323c5c
Diffstat (limited to 'server/src/com')
43 files changed, 230 insertions, 217 deletions
diff --git a/server/src/com/vaadin/LegacyApplication.java b/server/src/com/vaadin/LegacyApplication.java index 3925c0b077..a7f29bf4b1 100644 --- a/server/src/com/vaadin/LegacyApplication.java +++ b/server/src/com/vaadin/LegacyApplication.java @@ -26,7 +26,7 @@ import java.util.Map.Entry; import com.vaadin.server.DefaultErrorListener; import com.vaadin.server.Terminal.ErrorEvent; import com.vaadin.server.Terminal.ErrorListener; -import com.vaadin.server.VaadinSession; +import com.vaadin.server.VaadinServiceSession; import com.vaadin.ui.UI; import com.vaadin.ui.UI.LegacyWindow; @@ -81,7 +81,7 @@ public abstract class LegacyApplication implements ErrorListener { } public void doInit() { - VaadinSession.getCurrent().setErrorHandler(this); + VaadinServiceSession.getCurrent().setErrorHandler(this); init(); } @@ -108,7 +108,7 @@ public abstract class LegacyApplication implements ErrorListener { * Sets the application's theme. * <p> * Note that this theme can be overridden for a specific UI with - * {@link VaadinSession#getThemeForUI(UI)}. Setting theme to be + * {@link VaadinServiceSession#getThemeForUI(UI)}. Setting theme to be * <code>null</code> selects the default theme. For the available theme * names, see the contents of the VAADIN/themes directory. * </p> @@ -172,7 +172,7 @@ public abstract class LegacyApplication implements ErrorListener { uI.setApplication(this); legacyUINames.put(uI.getName(), uI); - uI.setSession(VaadinSession.getCurrent()); + uI.setSession(VaadinServiceSession.getCurrent()); } /** @@ -214,8 +214,8 @@ public abstract class LegacyApplication implements ErrorListener { DefaultErrorListener.doDefault(event); } - public VaadinSession getContext() { - return VaadinSession.getCurrent(); + public VaadinServiceSession getContext() { + return VaadinServiceSession.getCurrent(); } public void close() { @@ -241,7 +241,7 @@ public abstract class LegacyApplication implements ErrorListener { } public URL getURL() { - return VaadinSession.getCurrent().getURL(); + return VaadinServiceSession.getCurrent().getURL(); } /** diff --git a/server/src/com/vaadin/data/util/converter/ConverterUtil.java b/server/src/com/vaadin/data/util/converter/ConverterUtil.java index 5944b505ab..6f2fecb9a2 100644 --- a/server/src/com/vaadin/data/util/converter/ConverterUtil.java +++ b/server/src/com/vaadin/data/util/converter/ConverterUtil.java @@ -18,7 +18,7 @@ package com.vaadin.data.util.converter; import java.io.Serializable; import java.util.Locale; -import com.vaadin.server.VaadinSession; +import com.vaadin.server.VaadinServiceSession; public class ConverterUtil implements Serializable { @@ -26,7 +26,7 @@ public class ConverterUtil implements Serializable { * Finds a converter that can convert from the given presentation type to * the given model type and back. Uses the given application to find a * {@link ConverterFactory} or, if application is null, uses the - * {@link VaadinSession#getCurrent()}. + * {@link VaadinServiceSession#getCurrent()}. * * @param <PRESENTATIONTYPE> * The presentation type @@ -44,10 +44,10 @@ public class ConverterUtil implements Serializable { */ public static <PRESENTATIONTYPE, MODELTYPE> Converter<PRESENTATIONTYPE, MODELTYPE> getConverter( Class<PRESENTATIONTYPE> presentationType, - Class<MODELTYPE> modelType, VaadinSession session) { + Class<MODELTYPE> modelType, VaadinServiceSession session) { Converter<PRESENTATIONTYPE, MODELTYPE> converter = null; if (session == null) { - session = VaadinSession.getCurrent(); + session = VaadinServiceSession.getCurrent(); } if (session != null) { diff --git a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java index 17b89ccb20..55d78c21b1 100644 --- a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java +++ b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java @@ -19,14 +19,14 @@ package com.vaadin.data.util.converter; import java.util.Date; import java.util.logging.Logger; -import com.vaadin.server.VaadinSession; +import com.vaadin.server.VaadinServiceSession; /** * Default implementation of {@link ConverterFactory}. Provides converters for * standard types like {@link String}, {@link Double} and {@link Date}. </p> * <p> * Custom converters can be provided by extending this class and using - * {@link VaadinSession#setConverterFactory(ConverterFactory)}. + * {@link VaadinServiceSession#setConverterFactory(ConverterFactory)}. * </p> * * @author Vaadin Ltd diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index 278d726451..eb59cbe5fc 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -355,12 +355,12 @@ public abstract class AbstractClientConnector implements ClientConnector { } /** - * Finds the {@link VaadinSession} to which this connector belongs. If the - * connector has not been attached, <code>null</code> is returned. + * Finds the {@link VaadinServiceSession} to which this connector belongs. + * If the connector has not been attached, <code>null</code> is returned. * * @return The connector's session, or <code>null</code> if not attached */ - protected VaadinSession getSession() { + protected VaadinServiceSession getSession() { UI uI = getUI(); if (uI == null) { return null; diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java index 69b664339c..8ea0b88b74 100644 --- a/server/src/com/vaadin/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java @@ -150,7 +150,7 @@ public abstract class AbstractCommunicationManager implements Serializable { /** * The session this communication manager is used for */ - private final VaadinSession session; + private final VaadinServiceSession session; private List<String> locales; @@ -177,7 +177,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * * @param session */ - public AbstractCommunicationManager(VaadinSession session) { + public AbstractCommunicationManager(VaadinServiceSession session) { this.session = session; session.addRequestHandler(getBootstrapHandler()); session.addRequestHandler(UNSUPPORTED_BROWSER_HANDLER); @@ -185,7 +185,7 @@ public abstract class AbstractCommunicationManager implements Serializable { requireLocale(session.getLocale().toString()); } - protected VaadinSession getSession() { + protected VaadinServiceSession getSession() { return session; } @@ -379,7 +379,7 @@ public abstract class AbstractCommunicationManager implements Serializable { "StreamVariable for the post not found"); } - final VaadinSession session = getSession(); + final VaadinServiceSession session = getSession(); OutputStream out = null; int totalBytes = 0; @@ -517,7 +517,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * Internally process a UIDL request from the client. * * This method calls - * {@link #handleVariables(VaadinRequest, VaadinResponse, Callback, VaadinSession, UI)} + * {@link #handleVariables(VaadinRequest, VaadinResponse, Callback, VaadinServiceSession, UI)} * to process any changes to variables by the client and then repaints * affected components using {@link #paintAfterVariableChanges()}. * @@ -709,7 +709,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } sb.append("\nComponent hierarchy:\n"); - VaadinSession session2 = component.getUI().getSession(); + VaadinServiceSession session2 = component.getUI().getSession(); sb.append(session2.getClass().getName()); sb.append("."); sb.append(session2.getClass().getSimpleName()); @@ -815,7 +815,7 @@ public abstract class AbstractCommunicationManager implements Serializable { final PrintWriter outWriter, UI ui, boolean analyzeLayouts) throws PaintException, JSONException { ArrayList<ClientConnector> dirtyVisibleConnectors = new ArrayList<ClientConnector>(); - VaadinSession session = ui.getSession(); + VaadinServiceSession session = ui.getSession(); // Paints components ConnectorTracker uiConnectorTracker = ui.getConnectorTracker(); getLogger().log(Level.FINE, "* Creating response to client"); @@ -1544,7 +1544,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @param session * @return false if the XSRF is turned off, true otherwise */ - public boolean isXSRFEnabled(VaadinSession session) { + public boolean isXSRFEnabled(VaadinServiceSession session) { return session.getConfiguration().isXsrfProtectionEnabled(); } @@ -1558,9 +1558,9 @@ public abstract class AbstractCommunicationManager implements Serializable { * @return true if successful, false if there was an inconsistency */ private boolean handleVariables(VaadinRequest request, - VaadinResponse response, Callback callback, VaadinSession session, - UI uI) throws IOException, InvalidUIDLSecurityKeyException, - JSONException { + VaadinResponse response, Callback callback, + VaadinServiceSession session, UI uI) throws IOException, + InvalidUIDLSecurityKeyException, JSONException { boolean success = true; String changes = getRequestPayload(request); @@ -1966,7 +1966,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @param m * map from variable names to values */ - private void handleChangeVariablesError(VaadinSession session, + private void handleChangeVariablesError(VaadinServiceSession session, Component owner, Throwable t, Map<String, Object> m) { boolean handled = false; ChangeVariablesErrorEvent errorEvent = new ChangeVariablesErrorEvent( @@ -2401,7 +2401,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @throws IOException * if a handler throws an exception * - * @see VaadinSession#addRequestHandler(RequestHandler) + * @see VaadinServiceSession#addRequestHandler(RequestHandler) * @see RequestHandler * * @since 7.0 @@ -2420,7 +2420,8 @@ public abstract class AbstractCommunicationManager implements Serializable { } public void handleBrowserDetailsRequest(VaadinRequest request, - VaadinResponse response, VaadinSession session) throws IOException { + VaadinResponse response, VaadinServiceSession session) + throws IOException { session.getLock().lock(); @@ -2460,8 +2461,8 @@ public abstract class AbstractCommunicationManager implements Serializable { private UI getBrowserDetailsUI(VaadinRequest request) { VaadinService vaadinService = request.getService(); - VaadinSession session = VaadinSession.getForSession(vaadinService, - request.getWrappedSession()); + VaadinServiceSession session = VaadinServiceSession.getForSession( + vaadinService, request.getWrappedSession()); List<UIProvider> uiProviders = session.getUIProviders(); @@ -2700,8 +2701,8 @@ public abstract class AbstractCommunicationManager implements Serializable { * @throws IOException * @throws InvalidUIDLSecurityKeyException */ - public void handleFileUpload(VaadinSession session, VaadinRequest request, - VaadinResponse response) throws IOException, + public void handleFileUpload(VaadinServiceSession session, + VaadinRequest request, VaadinResponse response) throws IOException, InvalidUIDLSecurityKeyException { /* @@ -2762,7 +2763,8 @@ public abstract class AbstractCommunicationManager implements Serializable { * @throws IOException */ public void handleHeartbeatRequest(VaadinRequest request, - VaadinResponse response, VaadinSession session) throws IOException { + VaadinResponse response, VaadinServiceSession session) + throws IOException { UI ui = null; try { int uiId = Integer.parseInt(request diff --git a/server/src/com/vaadin/server/AddonContext.java b/server/src/com/vaadin/server/AddonContext.java index 4773b4cebe..3465e16960 100644 --- a/server/src/com/vaadin/server/AddonContext.java +++ b/server/src/com/vaadin/server/AddonContext.java @@ -109,9 +109,9 @@ public class AddonContext implements Serializable { /** * Shorthand for adding a bootstrap listener that will be added to every new - * Vaadin session. + * service session. * - * @see VaadinSession#addBootstrapListener(BootstrapListener) + * @see VaadinServiceSession#addBootstrapListener(BootstrapListener) * * @param listener * the bootstrap listener that should be added to all new diff --git a/server/src/com/vaadin/server/BootstrapFragmentResponse.java b/server/src/com/vaadin/server/BootstrapFragmentResponse.java index 8fc3183a7c..0df99e04e2 100644 --- a/server/src/com/vaadin/server/BootstrapFragmentResponse.java +++ b/server/src/com/vaadin/server/BootstrapFragmentResponse.java @@ -37,7 +37,7 @@ public class BootstrapFragmentResponse extends BootstrapResponse { * Crate a new bootstrap fragment response. * * @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest, - * VaadinSession, Class) + * VaadinServiceSession, Class) * * @param handler * the bootstrap handler that is firing the event @@ -45,7 +45,7 @@ public class BootstrapFragmentResponse extends BootstrapResponse { * the Vaadin request for which the bootstrap page should be * generated * @param session - * the vaadin session for which the bootstrap page should be + * the service session for which the bootstrap page should be * generated * @param uiClass * the class of the UI that will be displayed on the page @@ -56,7 +56,7 @@ public class BootstrapFragmentResponse extends BootstrapResponse { * the UI provider for the bootstrap */ public BootstrapFragmentResponse(BootstrapHandler handler, - VaadinRequest request, VaadinSession session, + VaadinRequest request, VaadinServiceSession session, Class<? extends UI> uiClass, List<Node> fragmentNodes, UIProvider uiProvider) { super(handler, request, session, uiClass, uiProvider); diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index 25d0f9ed52..0886507caf 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -76,7 +76,7 @@ public abstract class BootstrapHandler implements RequestHandler { return bootstrapResponse.getRequest(); } - public VaadinSession getSession() { + public VaadinServiceSession getSession() { return bootstrapResponse.getSession(); } @@ -112,8 +112,8 @@ public abstract class BootstrapHandler implements RequestHandler { } @Override - public boolean handleRequest(VaadinSession session, VaadinRequest request, - VaadinResponse response) throws IOException { + public boolean handleRequest(VaadinServiceSession session, + VaadinRequest request, VaadinResponse response) throws IOException { try { List<UIProvider> uiProviders = session.getUIProviders(); @@ -439,7 +439,7 @@ public abstract class BootstrapHandler implements RequestHandler { JSONObject defaults = new JSONObject(); VaadinRequest request = context.getRequest(); - VaadinSession session = context.getSession(); + VaadinServiceSession session = context.getSession(); VaadinService vaadinService = request.getService(); // Get system messages diff --git a/server/src/com/vaadin/server/BootstrapPageResponse.java b/server/src/com/vaadin/server/BootstrapPageResponse.java index 8a85765e97..3c368764cc 100644 --- a/server/src/com/vaadin/server/BootstrapPageResponse.java +++ b/server/src/com/vaadin/server/BootstrapPageResponse.java @@ -39,7 +39,7 @@ public class BootstrapPageResponse extends BootstrapResponse { * Crate a new bootstrap page response. * * @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest, - * VaadinSession, Class) + * VaadinServiceSession, Class) * * @param handler * the bootstrap handler that is firing the event @@ -47,7 +47,7 @@ public class BootstrapPageResponse extends BootstrapResponse { * the Vaadin request for which the bootstrap page should be * generated * @param session - * the vaadin session for which the bootstrap page should be + * the service session for which the bootstrap page should be * generated * @param uiClass * the class of the UI that will be displayed on the page @@ -59,7 +59,7 @@ public class BootstrapPageResponse extends BootstrapResponse { * the UI provider for the bootstrap */ public BootstrapPageResponse(BootstrapHandler handler, - VaadinRequest request, VaadinSession session, + VaadinRequest request, VaadinServiceSession session, Class<? extends UI> uiClass, Document document, Map<String, Object> headers, UIProvider uiProvider) { super(handler, request, session, uiClass, uiProvider); diff --git a/server/src/com/vaadin/server/BootstrapResponse.java b/server/src/com/vaadin/server/BootstrapResponse.java index 7b12085a7b..e8ddd19569 100644 --- a/server/src/com/vaadin/server/BootstrapResponse.java +++ b/server/src/com/vaadin/server/BootstrapResponse.java @@ -29,7 +29,7 @@ import com.vaadin.ui.UI; */ public abstract class BootstrapResponse extends EventObject { private final VaadinRequest request; - private final VaadinSession session; + private final VaadinServiceSession session; private final Class<? extends UI> uiClass; private final UIProvider uiProvider; @@ -49,7 +49,7 @@ public abstract class BootstrapResponse extends EventObject { * the UI provider for the bootstrap */ public BootstrapResponse(BootstrapHandler handler, VaadinRequest request, - VaadinSession session, Class<? extends UI> uiClass, + VaadinServiceSession session, Class<? extends UI> uiClass, UIProvider uiProvider) { super(handler); this.request = request; @@ -82,11 +82,11 @@ public abstract class BootstrapResponse extends EventObject { } /** - * Gets the vaadin session to which the rendered view belongs. + * Gets the service session to which the rendered view belongs. * - * @return the vaadin session + * @return the Vaadin service session */ - public VaadinSession getSession() { + public VaadinServiceSession getSession() { return session; } diff --git a/server/src/com/vaadin/server/CombinedRequest.java b/server/src/com/vaadin/server/CombinedRequest.java index 589596136b..2487957e24 100644 --- a/server/src/com/vaadin/server/CombinedRequest.java +++ b/server/src/com/vaadin/server/CombinedRequest.java @@ -147,7 +147,7 @@ public class CombinedRequest implements VaadinRequest { @Override public WebBrowser getWebBrowser() { - return VaadinSession.getCurrent().getBrowser(); + return VaadinServiceSession.getCurrent().getBrowser(); } }; } diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java index 8dc490c36a..f876e748f8 100644 --- a/server/src/com/vaadin/server/CommunicationManager.java +++ b/server/src/com/vaadin/server/CommunicationManager.java @@ -46,7 +46,7 @@ public class CommunicationManager extends AbstractCommunicationManager { * * @param session */ - public CommunicationManager(VaadinSession session) { + public CommunicationManager(VaadinServiceSession session) { super(session); } diff --git a/server/src/com/vaadin/server/ConnectorResourceHandler.java b/server/src/com/vaadin/server/ConnectorResourceHandler.java index cf002f8fe0..6d375aaa50 100644 --- a/server/src/com/vaadin/server/ConnectorResourceHandler.java +++ b/server/src/com/vaadin/server/ConnectorResourceHandler.java @@ -24,8 +24,8 @@ public class ConnectorResourceHandler implements RequestHandler { } @Override - public boolean handleRequest(VaadinSession session, VaadinRequest request, - VaadinResponse response) throws IOException { + public boolean handleRequest(VaadinServiceSession session, + VaadinRequest request, VaadinResponse response) throws IOException { String requestPath = request.getRequestPathInfo(); if (requestPath == null) { return false; @@ -43,7 +43,7 @@ public class ConnectorResourceHandler implements RequestHandler { } UI.setCurrent(ui); - VaadinSession.setCurrent(ui.getSession()); + VaadinServiceSession.setCurrent(ui.getSession()); ClientConnector connector = ui.getConnectorTracker().getConnector( cid); diff --git a/server/src/com/vaadin/server/DefaultUIProvider.java b/server/src/com/vaadin/server/DefaultUIProvider.java index 7efb6dea64..1652d39c3a 100644 --- a/server/src/com/vaadin/server/DefaultUIProvider.java +++ b/server/src/com/vaadin/server/DefaultUIProvider.java @@ -26,7 +26,7 @@ public class DefaultUIProvider extends UIProvider { Object uiClassNameObj = request.getService() .getDeploymentConfiguration().getInitParameters() - .getProperty(VaadinSession.UI_PARAMETER); + .getProperty(VaadinServiceSession.UI_PARAMETER); if (uiClassNameObj instanceof String) { String uiClassName = uiClassNameObj.toString(); diff --git a/server/src/com/vaadin/server/FileResource.java b/server/src/com/vaadin/server/FileResource.java index 2dd5b7f589..baeac39441 100644 --- a/server/src/com/vaadin/server/FileResource.java +++ b/server/src/com/vaadin/server/FileResource.java @@ -73,7 +73,7 @@ public class FileResource implements ConnectorResource { return ds; } catch (final FileNotFoundException e) { // Log the exception using the application error handler - VaadinSession.getCurrent().getErrorHandler() + VaadinServiceSession.getCurrent().getErrorHandler() .terminalError(new ErrorEvent() { @Override diff --git a/server/src/com/vaadin/server/GAEVaadinServlet.java b/server/src/com/vaadin/server/GAEVaadinServlet.java index 6c46b0d70b..6c9c1882ea 100644 --- a/server/src/com/vaadin/server/GAEVaadinServlet.java +++ b/server/src/com/vaadin/server/GAEVaadinServlet.java @@ -240,7 +240,7 @@ public class GAEVaadinServlet extends VaadinServlet { } // de-serialize or create application context, store in session - VaadinSession ctx = getApplicationContext(request, memcache); + VaadinServiceSession ctx = getApplicationContext(request, memcache); super.service(request, response); @@ -290,8 +290,9 @@ public class GAEVaadinServlet extends VaadinServlet { } } - protected VaadinSession getApplicationContext(HttpServletRequest request, - MemcacheService memcache) throws ServletException { + protected VaadinServiceSession getApplicationContext( + HttpServletRequest request, MemcacheService memcache) + throws ServletException { HttpSession session = request.getSession(); String id = AC_BASE + session.getId(); byte[] serializedAC = (byte[]) memcache.get(id); @@ -319,7 +320,7 @@ public class GAEVaadinServlet extends VaadinServlet { ObjectInputStream ois; try { ois = new ObjectInputStream(bais); - VaadinSession applicationContext = (VaadinSession) ois + VaadinServiceSession applicationContext = (VaadinServiceSession) ois .readObject(); applicationContext.storeInSession(getService(), new WrappedHttpSession(session)); diff --git a/server/src/com/vaadin/server/GlobalResourceHandler.java b/server/src/com/vaadin/server/GlobalResourceHandler.java index 5b2082cd5a..c968dba066 100644 --- a/server/src/com/vaadin/server/GlobalResourceHandler.java +++ b/server/src/com/vaadin/server/GlobalResourceHandler.java @@ -65,8 +65,8 @@ public class GlobalResourceHandler implements RequestHandler { ""); @Override - public boolean handleRequest(VaadinSession session, VaadinRequest request, - VaadinResponse response) throws IOException { + public boolean handleRequest(VaadinServiceSession session, + VaadinRequest request, VaadinResponse response) throws IOException { String pathInfo = request.getRequestPathInfo(); if (pathInfo == null) { return false; diff --git a/server/src/com/vaadin/server/LegacyApplicationUIProvider.java b/server/src/com/vaadin/server/LegacyApplicationUIProvider.java index 1b7161e33f..c3e450fd7a 100644 --- a/server/src/com/vaadin/server/LegacyApplicationUIProvider.java +++ b/server/src/com/vaadin/server/LegacyApplicationUIProvider.java @@ -115,21 +115,21 @@ public abstract class LegacyApplicationUIProvider extends UIProvider { } private LegacyApplication getApplication() { - LegacyApplication application = VaadinSession.getCurrent() + LegacyApplication application = VaadinServiceSession.getCurrent() .getAttribute(LegacyApplication.class); if (application == null) { application = createApplication(); if (application == null) { return null; } - VaadinSession.getCurrent().setAttribute(LegacyApplication.class, - application); + VaadinServiceSession.getCurrent().setAttribute( + LegacyApplication.class, application); application.doInit(); } if (application != null && !application.isRunning()) { - VaadinSession.getCurrent().setAttribute(LegacyApplication.class, - null); + VaadinServiceSession.getCurrent().setAttribute( + LegacyApplication.class, null); // Run again without a current application return getApplication(); } diff --git a/server/src/com/vaadin/server/LegacyVaadinServlet.java b/server/src/com/vaadin/server/LegacyVaadinServlet.java index bb71889f51..d2f55211e5 100644 --- a/server/src/com/vaadin/server/LegacyVaadinServlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinServlet.java @@ -88,7 +88,7 @@ public class LegacyVaadinServlet extends VaadinServlet { } private void onVaadinSessionStarted(VaadinRequest request, - VaadinSession session) throws ServletException { + VaadinServiceSession session) throws ServletException { session.addUIProvider(provider); } diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index 8636c7e6e1..c77c195197 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -44,7 +44,7 @@ import com.vaadin.ui.UI; @SuppressWarnings("serial") public class PortletCommunicationManager extends AbstractCommunicationManager { - public PortletCommunicationManager(VaadinSession session) { + public PortletCommunicationManager(VaadinServiceSession session) { super(session); } @@ -52,7 +52,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { protected BootstrapHandler createBootstrapHandler() { return new BootstrapHandler() { @Override - public boolean handleRequest(VaadinSession session, + public boolean handleRequest(VaadinServiceSession session, VaadinRequest request, VaadinResponse response) throws IOException { PortletRequest portletRequest = VaadinPortletRequest.cast( diff --git a/server/src/com/vaadin/server/RequestHandler.java b/server/src/com/vaadin/server/RequestHandler.java index 8eb2d6d746..ea5c25c9ea 100644 --- a/server/src/com/vaadin/server/RequestHandler.java +++ b/server/src/com/vaadin/server/RequestHandler.java @@ -21,8 +21,8 @@ import java.io.Serializable; /** * Handler for producing a response to non-UIDL requests. Handlers can be added - * to vaadin sessions using - * {@link VaadinSession#addRequestHandler(RequestHandler)} + * to service sessions using + * {@link VaadinServiceSession#addRequestHandler(RequestHandler)} */ public interface RequestHandler extends Serializable { @@ -41,7 +41,7 @@ public interface RequestHandler extends Serializable { * handlers should be called, otherwise false * @throws IOException */ - boolean handleRequest(VaadinSession session, VaadinRequest request, + boolean handleRequest(VaadinServiceSession session, VaadinRequest request, VaadinResponse response) throws IOException; } diff --git a/server/src/com/vaadin/server/RequestTimer.java b/server/src/com/vaadin/server/RequestTimer.java index 26a5689665..4ab855a0cb 100644 --- a/server/src/com/vaadin/server/RequestTimer.java +++ b/server/src/com/vaadin/server/RequestTimer.java @@ -43,7 +43,7 @@ public class RequestTimer implements Serializable { * * @param context */ - public void stop(VaadinSession context) { + public void stop(VaadinServiceSession context) { // Measure and store the total handling time. This data can be // used in TestBench 3 tests. long time = (System.nanoTime() - requestStartTime) / 1000000; diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index 91748080ff..2611183b23 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -54,7 +54,7 @@ class ServletPortletHelper implements Serializable { private static void verifyUIClass(String className, ClassLoader classLoader) throws ServiceException { if (className == null) { - throw new ServiceException(VaadinSession.UI_PARAMETER + throw new ServiceException(VaadinServiceSession.UI_PARAMETER + " init parameter not defined"); } @@ -117,11 +117,11 @@ class ServletPortletHelper implements Serializable { ApplicationConstants.HEARTBEAT_REQUEST_PATH); } - public static void initDefaultUIProvider(VaadinSession session, + public static void initDefaultUIProvider(VaadinServiceSession session, VaadinService vaadinService) throws ServiceException { String uiProperty = vaadinService.getDeploymentConfiguration() - .getApplicationOrSystemProperty(VaadinSession.UI_PARAMETER, - null); + .getApplicationOrSystemProperty( + VaadinServiceSession.UI_PARAMETER, null); // Add provider for UI parameter first to give it lower priority // (providers are FILO) @@ -163,12 +163,13 @@ class ServletPortletHelper implements Serializable { } } - public static void checkUiProviders(VaadinSession session, + public static void checkUiProviders(VaadinServiceSession session, VaadinService vaadinService) throws ServiceException { if (session.getUIProviders().isEmpty()) { throw new ServiceException( "No UIProvider has been added and there is no \"" - + VaadinSession.UI_PARAMETER + "\" init parameter."); + + VaadinServiceSession.UI_PARAMETER + + "\" init parameter."); } } diff --git a/server/src/com/vaadin/server/SessionDestroyEvent.java b/server/src/com/vaadin/server/SessionDestroyEvent.java index a482a6d7b0..c502ade7cb 100644 --- a/server/src/com/vaadin/server/SessionDestroyEvent.java +++ b/server/src/com/vaadin/server/SessionDestroyEvent.java @@ -19,7 +19,7 @@ package com.vaadin.server; import java.util.EventObject; /** - * Event fired when a Vaadin session is no longer in use. + * Event fired when a Vaadin service session is no longer in use. * * @see SessionDestroyListener#sessionDestroy(SessionDestroyEvent) * @@ -28,7 +28,7 @@ import java.util.EventObject; */ public class SessionDestroyEvent extends EventObject { - private final VaadinSession session; + private final VaadinServiceSession session; /** * Creates a new event. @@ -36,9 +36,10 @@ public class SessionDestroyEvent extends EventObject { * @param service * the Vaadin service from which the even originates * @param session - * the Vaadin session that is no longer used + * the Vaadin service session that is no longer used */ - public SessionDestroyEvent(VaadinService service, VaadinSession session) { + public SessionDestroyEvent(VaadinService service, + VaadinServiceSession session) { super(service); this.session = session; } @@ -58,11 +59,11 @@ public class SessionDestroyEvent extends EventObject { } /** - * Gets the Vaadin session that is no longer used. + * Gets the Vaadin service session that is no longer used. * - * @return the Vaadin session + * @return the Vaadin service session */ - public VaadinSession getSession() { + public VaadinServiceSession getSession() { return session; } diff --git a/server/src/com/vaadin/server/SessionDestroyListener.java b/server/src/com/vaadin/server/SessionDestroyListener.java index a174f3718a..dee45da3d5 100644 --- a/server/src/com/vaadin/server/SessionDestroyListener.java +++ b/server/src/com/vaadin/server/SessionDestroyListener.java @@ -17,7 +17,8 @@ package com.vaadin.server; /** - * A listener that gets notified when a Vaadin session is no longer used. + * A listener that gets notified when a Vaadin service session is no longer + * used. * * @see VaadinService#addSessionDestroyListener(SessionDestroyListener) * @@ -26,7 +27,7 @@ package com.vaadin.server; */ public interface SessionDestroyListener { /** - * Called when a Vaadin session is no longer used. + * Called when a Vaadin service session is no longer used. * * @param event * the event with details about the destroyed session diff --git a/server/src/com/vaadin/server/SessionInitEvent.java b/server/src/com/vaadin/server/SessionInitEvent.java index 34272d06ad..a33e5fa8dd 100644 --- a/server/src/com/vaadin/server/SessionInitEvent.java +++ b/server/src/com/vaadin/server/SessionInitEvent.java @@ -19,8 +19,8 @@ package com.vaadin.server; import java.util.EventObject; /** - * Event gets fired when a new Vaadin session is initialized for a Vaadin - * service. + * Event gets fired when a new Vaadin service session is initialized for a + * Vaadin service. * <p> * Because of the way different service instances share the same session, the * event is not necessarily fired immediately when the session is created but @@ -34,7 +34,7 @@ import java.util.EventObject; */ public class SessionInitEvent extends EventObject { - private final VaadinSession session; + private final VaadinServiceSession session; private final VaadinRequest request; /** @@ -43,12 +43,12 @@ public class SessionInitEvent extends EventObject { * @param service * the Vaadin service from which the event originates * @param session - * the Vaadin session that has been initialized + * the Vaadin service session that has been initialized * @param request * the request that triggered the initialization */ - public SessionInitEvent(VaadinService service, VaadinSession session, - VaadinRequest request) { + public SessionInitEvent(VaadinService service, + VaadinServiceSession session, VaadinRequest request) { super(service); this.session = session; this.request = request; @@ -69,11 +69,11 @@ public class SessionInitEvent extends EventObject { } /** - * Gets the Vaadin session that has been initialized. + * Gets the Vaadin service session that has been initialized. * - * @return the Vaadin session + * @return the Vaadin service session */ - public VaadinSession getSession() { + public VaadinServiceSession getSession() { return session; } diff --git a/server/src/com/vaadin/server/SessionInitListener.java b/server/src/com/vaadin/server/SessionInitListener.java index be86f80a05..3766eab77a 100644 --- a/server/src/com/vaadin/server/SessionInitListener.java +++ b/server/src/com/vaadin/server/SessionInitListener.java @@ -20,7 +20,7 @@ import java.io.Serializable; /** * Event listener that can be registered to a {@link VaadinService} to get an - * event when a new Vaadin session is initialized for that service. + * event when a new Vaadin service session is initialized for that service. * <p> * Because of the way different service instances share the same session, the * listener is not necessarily notified immediately when the session is created @@ -34,7 +34,8 @@ import java.io.Serializable; */ public interface SessionInitListener extends Serializable { /** - * Invoked when a new Vaadin session is initialized for that service. + * Invoked when a new Vaadin service session is initialized for that + * service. * <p> * Because of the way different service instances share the same session, * the listener is not necessarily notified immediately when the session is diff --git a/server/src/com/vaadin/server/StreamVariable.java b/server/src/com/vaadin/server/StreamVariable.java index a75cc2f0d7..3c20315b04 100644 --- a/server/src/com/vaadin/server/StreamVariable.java +++ b/server/src/com/vaadin/server/StreamVariable.java @@ -151,7 +151,7 @@ public interface StreamVariable extends Serializable { * the streaming ended before the end of the input. The streaming may fail * due an interruption by {@link } or due an other unknown exception in * communication. In the latter case the exception is also passed to - * {@link VaadinSession#terminalError(com.vaadin.server.Terminal.ErrorEvent)} + * {@link VaadinServiceSession#terminalError(com.vaadin.server.Terminal.ErrorEvent)} * . */ public interface StreamingErrorEvent extends StreamingEvent { diff --git a/server/src/com/vaadin/server/SystemMessages.java b/server/src/com/vaadin/server/SystemMessages.java index 647266d8e3..59cee3831e 100644 --- a/server/src/com/vaadin/server/SystemMessages.java +++ b/server/src/com/vaadin/server/SystemMessages.java @@ -22,8 +22,9 @@ import java.io.Serializable; * Contains the system messages used to notify the user about various critical * situations that can occur. * <p> - * Customize by overriding the static {@link VaadinSession#getSystemMessages()} - * and returning {@link CustomizedSystemMessages}. + * Customize by overriding the static + * {@link VaadinServiceSession#getSystemMessages()} and returning + * {@link CustomizedSystemMessages}. * </p> * <p> * The defaults defined in this class are: diff --git a/server/src/com/vaadin/server/UnsupportedBrowserHandler.java b/server/src/com/vaadin/server/UnsupportedBrowserHandler.java index 5c93eabf67..e9c081387a 100644 --- a/server/src/com/vaadin/server/UnsupportedBrowserHandler.java +++ b/server/src/com/vaadin/server/UnsupportedBrowserHandler.java @@ -34,8 +34,8 @@ public class UnsupportedBrowserHandler implements RequestHandler { public static final String FORCE_LOAD_COOKIE = "vaadinforceload=1"; @Override - public boolean handleRequest(VaadinSession session, VaadinRequest request, - VaadinResponse response) throws IOException { + public boolean handleRequest(VaadinServiceSession session, + VaadinRequest request, VaadinResponse response) throws IOException { if (request.getBrowserDetails() != null) { // Check if the browser is supported diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 4ca88fb71c..43d94a420f 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -542,7 +542,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { */ private void handleOtherRequest(VaadinPortletRequest request, VaadinResponse response, RequestType requestType, - VaadinSession vaadinSession, + VaadinServiceSession vaadinSession, PortletCommunicationManager communicationManager) throws PortletException, IOException, MalformedURLException { if (requestType == RequestType.APP || requestType == RequestType.RENDER) { @@ -627,7 +627,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } private void handleServiceException(VaadinPortletRequest request, - VaadinPortletResponse response, VaadinSession vaadinSession, + VaadinPortletResponse response, VaadinServiceSession vaadinSession, Throwable e) throws IOException, PortletException { // TODO Check that this error handler is working when running inside a // portlet diff --git a/server/src/com/vaadin/server/VaadinPortletRequest.java b/server/src/com/vaadin/server/VaadinPortletRequest.java index 63d5d1f467..cb55262b06 100644 --- a/server/src/com/vaadin/server/VaadinPortletRequest.java +++ b/server/src/com/vaadin/server/VaadinPortletRequest.java @@ -162,7 +162,7 @@ public class VaadinPortletRequest implements VaadinRequest { @Override public WebBrowser getWebBrowser() { - VaadinPortletSession context = (VaadinPortletSession) VaadinSession + VaadinPortletSession context = (VaadinPortletSession) VaadinServiceSession .getCurrent(); return context.getBrowser(); } diff --git a/server/src/com/vaadin/server/VaadinPortletService.java b/server/src/com/vaadin/server/VaadinPortletService.java index 8025fa7713..298b875a55 100644 --- a/server/src/com/vaadin/server/VaadinPortletService.java +++ b/server/src/com/vaadin/server/VaadinPortletService.java @@ -182,7 +182,7 @@ public class VaadinPortletService extends VaadinService { @Override protected AbstractCommunicationManager createCommunicationManager( - VaadinSession session) { + VaadinServiceSession session) { return new PortletCommunicationManager(session); } @@ -206,7 +206,7 @@ public class VaadinPortletService extends VaadinService { } @Override - protected VaadinSession createVaadinSession(VaadinRequest request) + protected VaadinServiceSession createVaadinSession(VaadinRequest request) throws ServiceException { return new VaadinPortletSession(); } diff --git a/server/src/com/vaadin/server/VaadinPortletSession.java b/server/src/com/vaadin/server/VaadinPortletSession.java index 4a2cf04dc3..427314975e 100644 --- a/server/src/com/vaadin/server/VaadinPortletSession.java +++ b/server/src/com/vaadin/server/VaadinPortletSession.java @@ -56,7 +56,7 @@ import com.vaadin.util.CurrentInstance; */ @Deprecated @SuppressWarnings("serial") -public class VaadinPortletSession extends VaadinSession { +public class VaadinPortletSession extends VaadinServiceSession { private final Set<PortletListener> portletListeners = new LinkedHashSet<PortletListener>(); diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index b960409030..77a3018bb6 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -34,7 +34,7 @@ import javax.servlet.ServletException; import com.vaadin.LegacyApplication; import com.vaadin.annotations.PreserveOnRefresh; import com.vaadin.event.EventRouter; -import com.vaadin.server.VaadinSession.SessionStartEvent; +import com.vaadin.server.VaadinServiceSession.SessionStartEvent; import com.vaadin.shared.ui.ui.UIConstants; import com.vaadin.ui.UI; import com.vaadin.util.CurrentInstance; @@ -223,7 +223,7 @@ public abstract class VaadinService implements Serializable { public abstract File getBaseDirectory(); /** - * Adds a listener that gets notified when a new Vaadin session is + * Adds a listener that gets notified when a new Vaadin service session is * initialized for this service. * <p> * Because of the way different service instances share the same session, @@ -235,7 +235,7 @@ public abstract class VaadinService implements Serializable { * @see SessionInitListener * * @param listener - * the vaadin session initialization listener + * the Vaadin service session initialization listener */ public void addSessionInitListener(SessionInitListener listener) { eventRouter.addListener(SessionInitEvent.class, listener, @@ -243,12 +243,13 @@ public abstract class VaadinService implements Serializable { } /** - * Removes a Vaadin session initialization listener from this service. + * Removes a Vaadin service session initialization listener from this + * service. * * @see #addSessionInitListener(SessionInitListener) * * @param listener - * the Vaadin session initialization listener to remove. + * the Vaadin service session initialization listener to remove. */ public void removeSessionInitListener(SessionInitListener listener) { eventRouter.removeListener(SessionInitEvent.class, listener, @@ -256,20 +257,20 @@ public abstract class VaadinService implements Serializable { } /** - * Adds a listener that gets notified when a Vaadin session that has been - * initialized for this service is destroyed. + * Adds a listener that gets notified when a Vaadin service session that has + * been initialized for this service is destroyed. * * @see #addSessionInitListener(SessionInitListener) * * @param listener - * the vaadin session destroy listener + * the vaadin service session destroy listener */ public void addSessionDestroyListener(SessionDestroyListener listener) { eventRouter.addListener(SessionDestroyEvent.class, listener, SESSION_DESTROY_METHOD); } - public void fireSessionDestroy(VaadinSession vaadinSession) { + public void fireSessionDestroy(VaadinServiceSession vaadinSession) { for (UI ui : new ArrayList<UI>(vaadinSession.getUIs())) { vaadinSession.cleanupUI(ui); } @@ -278,12 +279,12 @@ public abstract class VaadinService implements Serializable { } /** - * Removes a Vaadin session destroy listener from this service. + * Removes a Vaadin service session destroy listener from this service. * * @see #addSessionDestroyListener(SessionDestroyListener) * * @param listener - * the vaadin session destroy listener + * the vaadin service session destroy listener */ public void removeSessionDestroyListener(SessionDestroyListener listener) { eventRouter.removeListener(SessionDestroyEvent.class, listener, @@ -291,36 +292,37 @@ public abstract class VaadinService implements Serializable { } /** - * Attempts to find a Vaadin session associated with this request. + * Attempts to find a Vaadin service session associated with this request. * * @param request - * the request to get a vaadin session for. + * the request to get a vaadin service session for. * - * @see VaadinSession + * @see VaadinServiceSession * - * @return the vaadin session for the request, or <code>null</code> if no - * session is found and this is a request for which a new session - * shouldn't be created. + * @return the vaadin service session for the request, or <code>null</code> + * if no session is found and this is a request for which a new + * session shouldn't be created. */ - public VaadinSession findVaadinSession(VaadinRequest request) + public VaadinServiceSession findVaadinSession(VaadinRequest request) throws ServiceException, SessionExpiredException { - VaadinSession vaadinSession = findOrCreateVaadinSession(request); + VaadinServiceSession vaadinSession = findOrCreateVaadinSession(request); if (vaadinSession == null) { return null; } - VaadinSession.setCurrent(vaadinSession); - request.setAttribute(VaadinSession.class.getName(), vaadinSession); + VaadinServiceSession.setCurrent(vaadinSession); + request.setAttribute(VaadinServiceSession.class.getName(), + vaadinSession); return vaadinSession; } - private VaadinSession findOrCreateVaadinSession(VaadinRequest request) + private VaadinServiceSession findOrCreateVaadinSession(VaadinRequest request) throws SessionExpiredException, ServiceException { boolean requestCanCreateSession = requestCanCreateSession(request); /* Find an existing session for this request. */ - VaadinSession session = getExistingSession(request, + VaadinServiceSession session = getExistingSession(request, requestCanCreateSession); if (session != null) { @@ -363,9 +365,9 @@ public abstract class VaadinService implements Serializable { } - private VaadinSession createAndRegisterSession(VaadinRequest request) + private VaadinServiceSession createAndRegisterSession(VaadinRequest request) throws ServiceException { - VaadinSession session = createVaadinSession(request); + VaadinServiceSession session = createVaadinSession(request); session.storeInSession(this, request.getWrappedSession()); @@ -408,35 +410,35 @@ public abstract class VaadinService implements Serializable { } /** - * Create a communication manager to use for the given Vaadin session. + * Create a communication manager to use for the given service session. * * @param session - * the vaadin session for which a new communication manager is + * the service session for which a new communication manager is * needed * @return a new communication manager */ protected abstract AbstractCommunicationManager createCommunicationManager( - VaadinSession session); + VaadinServiceSession session); /** - * Creates a new vaadin session. + * Creates a new Vaadin service session. * * @param request * @return * @throws ServletException * @throws MalformedURLException */ - protected abstract VaadinSession createVaadinSession(VaadinRequest request) - throws ServiceException; + protected abstract VaadinServiceSession createVaadinSession( + VaadinRequest request) throws ServiceException; private void onVaadinSessionStarted(VaadinRequest request, - VaadinSession session) throws ServiceException { + VaadinServiceSession session) throws ServiceException { eventRouter.fireEvent(new SessionInitEvent(this, session, request)); ServletPortletHelper.checkUiProviders(session, this); } - private void closeSession(VaadinSession vaadinSession, + private void closeSession(VaadinServiceSession vaadinSession, WrappedSession session) { if (vaadinSession == null) { return; @@ -447,7 +449,7 @@ public abstract class VaadinService implements Serializable { } } - protected VaadinSession getExistingSession(VaadinRequest request, + protected VaadinServiceSession getExistingSession(VaadinRequest request, boolean allowSessionCreation) throws SessionExpiredException { // Ensures that the session is still valid @@ -457,7 +459,7 @@ public abstract class VaadinService implements Serializable { throw new SessionExpiredException(); } - VaadinSession vaadinSession = VaadinSession + VaadinServiceSession vaadinSession = VaadinServiceSession .getForSession(this, session); if (vaadinSession == null) { @@ -468,12 +470,12 @@ public abstract class VaadinService implements Serializable { } /** - * Checks whether it's valid to create a new Vaadin session as a result of + * Checks whether it's valid to create a new service session as a result of * the given request. * * @param request * the request - * @return <code>true</code> if it's valid to create a new Vaadin session + * @return <code>true</code> if it's valid to create a new service session * for the request; else <code>false</code> */ protected abstract boolean requestCanCreateSession(VaadinRequest request); @@ -578,7 +580,7 @@ public abstract class VaadinService implements Serializable { * */ public UI findUI(VaadinRequest request) { - VaadinSession session = VaadinSession.getForSession(this, + VaadinServiceSession session = VaadinServiceSession.getForSession(this, request.getWrappedSession()); // Get UI id from the request diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinServiceSession.java index 7c23e6474f..2b6b651404 100644 --- a/server/src/com/vaadin/server/VaadinSession.java +++ b/server/src/com/vaadin/server/VaadinServiceSession.java @@ -55,15 +55,16 @@ import com.vaadin.util.ReflectTools; * typically stored in a {@link HttpSession} or {@link PortletSession}, but * others storage mechanisms might also be used. * <p> - * Everything inside a {@link VaadinSession} should be serializable to ensure - * compatibility with schemes using serialization for persisting the session - * data. + * Everything inside a {@link VaadinServiceSession} should be serializable to + * ensure compatibility with schemes using serialization for persisting the + * session data. * * @author Vaadin Ltd * @since 7.0.0 */ @SuppressWarnings("serial") -public class VaadinSession implements HttpSessionBindingListener, Serializable { +public class VaadinServiceSession implements HttpSessionBindingListener, + Serializable { /** * The name of the parameter that is by default used in e.g. web.xml to @@ -116,7 +117,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * @return the URL the application should respond to or * <code>null</code> if the URL is not defined. * - * @see VaadinSession#getURL() + * @see VaadinServiceSession#getURL() */ public URL getApplicationUrl() { return applicationUrl; @@ -136,7 +137,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * * @return the communication manager for this application. * - * @see VaadinSession#getCommunicationManager + * @see VaadinServiceSession#getCommunicationManager */ public AbstractCommunicationManager getCommunicationManager() { return communicationManager; @@ -254,7 +255,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { } /** - * Gets the underlying session to which this vaadin session is currently + * Gets the underlying session to which this service session is currently * associated. * * @return the wrapped session for this context @@ -302,12 +303,13 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * @deprecated might be refactored or removed before 7.0.0 */ @Deprecated - public static VaadinSession getForSession(VaadinService service, + public static VaadinServiceSession getForSession(VaadinService service, WrappedSession underlyingSession) { - Object attribute = underlyingSession.getAttribute(VaadinSession.class - .getName() + "." + service.getServiceName()); - if (attribute instanceof VaadinSession) { - VaadinSession vaadinSession = (VaadinSession) attribute; + Object attribute = underlyingSession + .getAttribute(VaadinServiceSession.class.getName() + "." + + service.getServiceName()); + if (attribute instanceof VaadinServiceSession) { + VaadinServiceSession vaadinSession = (VaadinServiceSession) attribute; vaadinSession.session = underlyingSession; return vaadinSession; } @@ -325,9 +327,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { public void removeFromSession(VaadinService service) { assert (getForSession(service, session) == this); - session.setAttribute( - VaadinSession.class.getName() + "." + service.getServiceName(), - null); + session.setAttribute(VaadinServiceSession.class.getName() + "." + + service.getServiceName(), null); } /** @@ -337,9 +338,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { */ @Deprecated public void storeInSession(VaadinService service, WrappedSession session) { - session.setAttribute( - VaadinSession.class.getName() + "." + service.getServiceName(), - this); + session.setAttribute(VaadinServiceSession.class.getName() + "." + + service.getServiceName(), this); this.session = session; } @@ -415,7 +415,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * Window detach event. * * This event is sent each time a window is removed from the application - * with {@link com.vaadin.server.VaadinSession#removeWindow(Window)}. + * with {@link com.vaadin.server.VaadinServiceSession#removeWindow(Window)}. * * @deprecated might be refactored or removed before 7.0.0 */ @@ -432,7 +432,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * @param window * the Detached window. */ - public WindowDetachEvent(VaadinSession application, Window window) { + public WindowDetachEvent(VaadinServiceSession application, Window window) { super(application); this.window = window; } @@ -451,8 +451,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * * @return the Application. */ - public VaadinSession getApplication() { - return (VaadinSession) getSource(); + public VaadinServiceSession getApplication() { + return (VaadinServiceSession) getSource(); } } @@ -460,7 +460,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * Window attach event. * * This event is sent each time a window is attached tothe application with - * {@link com.vaadin.server.VaadinSession#addWindow(Window)}. + * {@link com.vaadin.server.VaadinServiceSession#addWindow(Window)}. * * @deprecated might be refactored or removed before 7.0.0 */ @@ -477,7 +477,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * @param window * the Attached window. */ - public WindowAttachEvent(VaadinSession application, Window window) { + public WindowAttachEvent(VaadinServiceSession application, Window window) { super(application); this.window = window; } @@ -496,8 +496,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * * @return the Application. */ - public VaadinSession getApplication() { - return (VaadinSession) getSource(); + public VaadinServiceSession getApplication() { + return (VaadinServiceSession) getSource(); } } @@ -665,12 +665,12 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * @return the current session instance if available, otherwise * <code>null</code> * - * @see #setCurrent(VaadinSession) + * @see #setCurrent(VaadinServiceSession) * * @since 7.0 */ - public static VaadinSession getCurrent() { - return CurrentInstance.get(VaadinSession.class); + public static VaadinServiceSession getCurrent() { + return CurrentInstance.get(VaadinServiceSession.class); } /** @@ -690,8 +690,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * * @since 7.0 */ - public static void setCurrent(VaadinSession session) { - CurrentInstance.setInheritable(VaadinSession.class, session); + public static void setCurrent(VaadinServiceSession session) { + CurrentInstance.setInheritable(VaadinServiceSession.class, session); } /** @@ -725,7 +725,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { } private static final Logger getLogger() { - return Logger.getLogger(VaadinSession.class.getName()); + return Logger.getLogger(VaadinServiceSession.class.getName()); } /** @@ -947,9 +947,9 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { } /** - * Stores a value in this vaadin session. This can be used to associate data - * with the current user so that it can be retrieved at a later point from - * some other part of the application. Setting the value to + * Stores a value in this service session. This can be used to associate + * data with the current user so that it can be retrieved at a later point + * from some other part of the application. Setting the value to * <code>null</code> clears the stored value. * * @see #getAttribute(String) @@ -973,9 +973,9 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { } /** - * Stores a value in this vaadin session. This can be used to associate data - * with the current user so that it can be retrieved at a later point from - * some other part of the application. Setting the value to + * Stores a value in this service session. This can be used to associate + * data with the current user so that it can be retrieved at a later point + * from some other part of the application. Setting the value to * <code>null</code> clears the stored value. * <p> * The fully qualified name of the type is used as the name when storing the diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index b8b7bb936d..d289cd6f07 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -254,7 +254,7 @@ public class VaadinServlet extends HttpServlet implements Constants { return; } - // Find out the Vaadin session this request is related to + // Find out the service session this request is related to vaadinSession = (VaadinServletSession) getService() .findVaadinSession(request); if (vaadinSession == null) { @@ -531,7 +531,7 @@ public class VaadinServlet extends HttpServlet implements Constants { } private void handleServiceException(VaadinServletRequest request, - VaadinServletResponse response, VaadinSession vaadinSession, + VaadinServletResponse response, VaadinServiceSession vaadinSession, Throwable e) throws IOException, ServletException { // if this was an UIDL request, response UIDL back to client if (getRequestType(request) == RequestType.UIDL) { diff --git a/server/src/com/vaadin/server/VaadinServletRequest.java b/server/src/com/vaadin/server/VaadinServletRequest.java index 10627a1338..d1fd87f9c4 100644 --- a/server/src/com/vaadin/server/VaadinServletRequest.java +++ b/server/src/com/vaadin/server/VaadinServletRequest.java @@ -97,7 +97,7 @@ public class VaadinServletRequest extends HttpServletRequestWrapper implements @Override public WebBrowser getWebBrowser() { - return VaadinSession.getCurrent().getBrowser(); + return VaadinServiceSession.getCurrent().getBrowser(); } }; } diff --git a/server/src/com/vaadin/server/VaadinServletService.java b/server/src/com/vaadin/server/VaadinServletService.java index 6c9e3eddaa..5d01c84948 100644 --- a/server/src/com/vaadin/server/VaadinServletService.java +++ b/server/src/com/vaadin/server/VaadinServletService.java @@ -162,7 +162,7 @@ public class VaadinServletService extends VaadinService { @Override protected AbstractCommunicationManager createCommunicationManager( - VaadinSession session) { + VaadinServiceSession session) { return new CommunicationManager(session); } @@ -186,7 +186,7 @@ public class VaadinServletService extends VaadinService { } @Override - protected VaadinSession createVaadinSession(VaadinRequest request) + protected VaadinServiceSession createVaadinSession(VaadinRequest request) throws ServiceException { return new VaadinServletSession(); } diff --git a/server/src/com/vaadin/server/VaadinServletSession.java b/server/src/com/vaadin/server/VaadinServletSession.java index 365b1bc46d..fa048194c3 100644 --- a/server/src/com/vaadin/server/VaadinServletSession.java +++ b/server/src/com/vaadin/server/VaadinServletSession.java @@ -37,7 +37,7 @@ import javax.servlet.http.HttpSessionBindingListener; */ @Deprecated @SuppressWarnings("serial") -public class VaadinServletSession extends VaadinSession { +public class VaadinServletSession extends VaadinServiceSession { private transient boolean reinitializingSession = false; diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index c49d6237b8..57416e3a06 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -37,7 +37,7 @@ import com.vaadin.server.ComponentSizeValidator; import com.vaadin.server.ErrorMessage; import com.vaadin.server.Resource; import com.vaadin.server.Terminal; -import com.vaadin.server.VaadinSession; +import com.vaadin.server.VaadinServiceSession; import com.vaadin.shared.ComponentConstants; import com.vaadin.shared.ComponentState; import com.vaadin.shared.ui.ComponentStateUtil; @@ -265,7 +265,7 @@ public abstract class AbstractComponent extends AbstractClientConnector if (parent != null) { return parent.getLocale(); } - final VaadinSession session = getSession(); + final VaadinServiceSession session = getSession(); if (session != null) { return session.getLocale(); } @@ -623,7 +623,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ protected void focus() { if (this instanceof Focusable) { - final VaadinSession session = getSession(); + final VaadinServiceSession session = getSession(); if (session != null) { getUI().setFocusedComponent((Focusable) this); delayedFocus = false; diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java index a748d8d4c5..76cec66f27 100644 --- a/server/src/com/vaadin/ui/LoginForm.java +++ b/server/src/com/vaadin/ui/LoginForm.java @@ -29,7 +29,7 @@ import com.vaadin.server.DownloadStream; import com.vaadin.server.RequestHandler; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinResponse; -import com.vaadin.server.VaadinSession; +import com.vaadin.server.VaadinServiceSession; import com.vaadin.shared.ApplicationConstants; /** @@ -87,7 +87,7 @@ public class LoginForm extends CustomComponent { private final RequestHandler requestHandler = new RequestHandler() { @Override - public boolean handleRequest(VaadinSession session, + public boolean handleRequest(VaadinServiceSession session, VaadinRequest request, VaadinResponse response) throws IOException { String requestPathInfo = request.getRequestPathInfo(); diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 0d9fcd2c0a..ba87eb1424 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -45,8 +45,8 @@ import com.vaadin.server.UIProvider; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinRequest.BrowserDetails; import com.vaadin.server.VaadinService; +import com.vaadin.server.VaadinServiceSession; import com.vaadin.server.VaadinServlet; -import com.vaadin.server.VaadinSession; import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.BorderStyle; @@ -69,9 +69,10 @@ import com.vaadin.util.ReflectTools; * <p> * When a new UI instance is needed, typically because the user opens a URL in a * browser window which points to e.g. {@link VaadinServlet}, all - * {@link UIProvider}s registered to the current {@link VaadinSession} are - * queried for the UI class that should be used. The selection is by defaylt - * based on the {@value VaadinSession#UI_PARAMETER} parameter from web.xml. + * {@link UIProvider}s registered to the current {@link VaadinServiceSession} + * are queried for the UI class that should be used. The selection is by defaylt + * based on the {@value VaadinServiceSession#UI_PARAMETER} parameter from + * web.xml. * </p> * <p> * After a UI has been created by the application, it is initialized using @@ -147,8 +148,9 @@ public abstract class UI extends AbstractComponentContainer implements * The name also determines the URL that can be used for direct access * to a window. All windows can be accessed through * {@code http://host:port/app/win} where {@code http://host:port/app} - * is the application URL (as returned by {@link VaadinSession#getURL()} - * and {@code win} is the window name. + * is the application URL (as returned by + * {@link VaadinServiceSession#getURL()} and {@code win} is the window + * name. * </p> * <p> * Note! Portlets do not support direct window access through URLs. @@ -167,8 +169,9 @@ public abstract class UI extends AbstractComponentContainer implements * The name also determines the URL that can be used for direct access * to a window. All windows can be accessed through * {@code http://host:port/app/win} where {@code http://host:port/app} - * is the application URL (as returned by {@link VaadinSession#getURL()} - * and {@code win} is the window name. + * is the application URL (as returned by + * {@link VaadinServiceSession#getURL()} and {@code win} is the window + * name. * </p> * <p> * This method can only be called before the window is added to an @@ -205,7 +208,7 @@ public abstract class UI extends AbstractComponentContainer implements * to an application */ public URL getURL() { - VaadinSession session = getSession(); + VaadinServiceSession session = getSession(); if (session == null) { return null; } @@ -450,7 +453,7 @@ public abstract class UI extends AbstractComponentContainer implements /** * The application to which this UI belongs */ - private VaadinSession session; + private VaadinServiceSession session; /** * List of windows in this UI. @@ -468,7 +471,7 @@ public abstract class UI extends AbstractComponentContainer implements * which a request originates. A negative value indicates that the UI id has * not yet been assigned by the Application. * - * @see VaadinSession#getNextUIid() + * @see VaadinServiceSession#getNextUIid() */ private int uiId = -1; @@ -600,8 +603,8 @@ public abstract class UI extends AbstractComponentContainer implements * <p> * Getting a null value is often a problem in constructors of regular * components and in the initializers of custom composite components. A - * standard workaround is to use {@link VaadinSession#getCurrent()} to - * retrieve the application instance that the current request relates to. + * standard workaround is to use {@link VaadinServiceSession#getCurrent()} + * to retrieve the application instance that the current request relates to. * Another way is to move the problematic initialization to * {@link #attach()}, as described in the documentation of the method. * </p> @@ -610,7 +613,7 @@ public abstract class UI extends AbstractComponentContainer implements * @see #attach() */ @Override - public VaadinSession getSession() { + public VaadinServiceSession getSession() { return session; } @@ -730,7 +733,7 @@ public abstract class UI extends AbstractComponentContainer implements * * @see #getSession() */ - public void setSession(VaadinSession session) { + public void setSession(VaadinServiceSession session) { if ((session == null) == (this.session == null)) { throw new IllegalStateException( "VaadinSession has already been set"); @@ -1384,7 +1387,7 @@ public abstract class UI extends AbstractComponentContainer implements * heartbeat for this UI. * * @see #heartbeat() - * @see VaadinSession#cleanupInactiveUIs() + * @see VaadinServiceSession#cleanupInactiveUIs() * * @return The time the last heartbeat request occurred. */ |