public AddonContext(VaadinService vaadinService) {
this.vaadinService = vaadinService;
vaadinService
- .addVaadinSessionInitializationListener(new VaadinSessionInitializationListener() {
+ .addSessionInitListener(new SessionInitListener() {
@Override
- public void vaadinSessionInitialized(
- VaadinSessionInitializeEvent event)
+ public void sessionInit(
+ SessionInitEvent event)
throws ServiceException {
for (BootstrapListener l : bootstrapListeners) {
event.getSession().addBootstrapListener(l);
public void init(PortletConfig portletConfig) throws PortletException {
super.init(portletConfig);
- getService().addVaadinSessionInitializationListener(
- new VaadinSessionInitializationListener() {
+ getService().addSessionInitListener(
+ new SessionInitListener() {
@Override
- public void vaadinSessionInitialized(
- VaadinSessionInitializeEvent event)
+ public void sessionInit(
+ SessionInitEvent event)
throws ServiceException {
try {
onVaadinSessionStarted(VaadinPortletRequest
public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
- getService().addVaadinSessionInitializationListener(
- new VaadinSessionInitializationListener() {
+ getService().addSessionInitListener(
+ new SessionInitListener() {
@Override
- public void vaadinSessionInitialized(
- VaadinSessionInitializeEvent event)
+ public void sessionInit(
+ SessionInitEvent event)
throws ServiceException {
try {
onVaadinSessionStarted(event.getRequest(),
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.server;
+
+import java.util.EventObject;
+
+/**
+ * Event fired when a Vaadin session is no longer in use.
+ *
+ * @see SessionDestroyListener#sessionDestroy(VaadinSessionDestroyEvent)
+ *
+ * @author Vaadin Ltd
+ * @since 7.0.0
+ */
+public class SessionDestroyEvent extends EventObject {
+
+ private final VaadinSession session;
+
+ /**
+ * Creates a new event.
+ *
+ * @param service
+ * the Vaadin service from which the even originates
+ * @param session
+ * the Vaadin session that is no longer used
+ */
+ public SessionDestroyEvent(VaadinService service,
+ VaadinSession session) {
+ super(service);
+ this.session = session;
+ }
+
+ @Override
+ public VaadinService getSource() {
+ return (VaadinService) super.getSource();
+ }
+
+ /**
+ * Gets the Vaadin service from which the even originates.
+ *
+ * @return the Vaadin service
+ */
+ public VaadinService getService() {
+ return getSource();
+ }
+
+ /**
+ * Gets the Vaadin session that is no longer used.
+ *
+ * @return the Vaadin session
+ */
+ public VaadinSession getSession() {
+ return session;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.server;
+
+/**
+ * A listener that gets notified when a Vaadin session is no longer used.
+ *
+ * @see VaadinService#addVaadinSessionDestroyListener(VaadinSessionDestroyListener)
+ *
+ * @author Vaadin Ltd
+ * @since 7.0.0
+ */
+public interface SessionDestroyListener {
+ /**
+ * Called when a Vaadin session is no longer used.
+ *
+ * @param event
+ * the event with details about the destroyed session
+ */
+ public void sessionDestroy(SessionDestroyEvent event);
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.server;
+
+import java.util.EventObject;
+
+/**
+ * Event gets fired when a new Vaadin 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
+ * only when the first request for that session is handled by a specific
+ * service.
+ *
+ * @see SessionInitListener#sessionInit(SessionInitEvent)
+ *
+ * @author Vaadin Ltd
+ * @since 7.0.0
+ */
+public class SessionInitEvent extends EventObject {
+
+ private final VaadinSession session;
+ private final VaadinRequest request;
+
+ /**
+ * Creates a new event.
+ *
+ * @param service
+ * the Vaadin service from which the event originates
+ * @param session
+ * the Vaadin session that has been initialized
+ * @param request
+ * the request that triggered the initialization
+ */
+ public SessionInitEvent(VaadinService service, VaadinSession session,
+ VaadinRequest request) {
+ super(service);
+ this.session = session;
+ this.request = request;
+ }
+
+ @Override
+ public VaadinService getSource() {
+ return (VaadinService) super.getSource();
+ }
+
+ /**
+ * Gets the Vaadin service from which this event originates
+ *
+ * @return the Vaadin service instance
+ */
+ public VaadinService getService() {
+ return getSource();
+ }
+
+ /**
+ * Gets the Vaadin session that has been initialized.
+ *
+ * @return the Vaadin session
+ */
+ public VaadinSession getSession() {
+ return session;
+ }
+
+ /**
+ * Gets the request that triggered the initialization.
+ *
+ * @return the request
+ */
+ public VaadinRequest getRequest() {
+ return request;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.server;
+
+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.
+ * <p>
+ * Because of the way different service instances share the same session, the
+ * listener is not necessarily notified immediately when the session is created
+ * but only when the first request for that session is handled by a specific
+ * service.
+ *
+ * @see VaadinService#addSessionInitListener(SessionInitListener)
+ *
+ * @author Vaadin Ltd
+ * @since 7.0.0
+ */
+public interface SessionInitListener extends Serializable {
+ /**
+ * Invoked when a new Vaadin 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 but only when the first request for that session is handled by a
+ * specific service.
+ *
+ * @param event
+ * the initialization event
+ * @throws ServiceException
+ * a problem occurs when processing the event
+ */
+ public void sessionInit(SessionInitEvent event)
+ throws ServiceException;
+}
}
private static final Method SESSION_INIT_METHOD = ReflectTools.findMethod(
- VaadinSessionInitializationListener.class,
- "vaadinSessionInitialized", VaadinSessionInitializeEvent.class);
+ SessionInitListener.class, "sessionInit", SessionInitEvent.class);
private static final Method SESSION_DESTROY_METHOD = ReflectTools
- .findMethod(VaadinSessionDestroyListener.class,
- "vaadinSessionDestroyed", VaadinSessionDestroyEvent.class);
+ .findMethod(SessionDestroyListener.class, "sessionDestroy",
+ SessionDestroyEvent.class);
/**
* @deprecated Only supported for {@link LegacyApplication}.
* created but only when the first request for that session is handled by
* this service.
*
- * @see #removeVaadinSessionInitializationListener(VaadinSessionInitializationListener)
- * @see VaadinSessionInitializationListener
+ * @see #removeSessionInitListener(SessionInitListener)
+ * @see SessionInitListener
*
* @param listener
* the vaadin session initialization listener
*/
- public void addVaadinSessionInitializationListener(
- VaadinSessionInitializationListener listener) {
- eventRouter.addListener(VaadinSessionInitializeEvent.class, listener,
+ public void addSessionInitListener(SessionInitListener listener) {
+ eventRouter.addListener(SessionInitEvent.class, listener,
SESSION_INIT_METHOD);
}
/**
* Removes a Vaadin session initialization listener from this service.
*
- * @see #addVaadinSessionInitializationListener(VaadinSessionInitializationListener)
+ * @see #addSessionInitListener(SessionInitListener)
*
* @param listener
* the Vaadin session initialization listener to remove.
*/
- public void removeVaadinSessionInitializationListener(
- VaadinSessionInitializationListener listener) {
- eventRouter.removeListener(VaadinSessionInitializeEvent.class,
- listener, SESSION_INIT_METHOD);
+ public void removeSessionInitListener(SessionInitListener listener) {
+ eventRouter.removeListener(SessionInitEvent.class, listener,
+ SESSION_INIT_METHOD);
}
/**
* Adds a listener that gets notified when a Vaadin session that has been
* initialized for this service is destroyed.
*
- * @see #addVaadinSessionInitializationListener(VaadinSessionInitializationListener)
+ * @see #addSessionInitListener(SessionInitListener)
*
* @param listener
* the vaadin session destroy listener
*/
- public void addVaadinSessionDestroyListener(
- VaadinSessionDestroyListener listener) {
- eventRouter.addListener(VaadinSessionDestroyEvent.class, listener,
+ public void addVaadinSessionDestroyListener(SessionDestroyListener listener) {
+ eventRouter.addListener(SessionDestroyEvent.class, listener,
SESSION_DESTROY_METHOD);
}
vaadinSession.cleanupUI(ui);
}
- eventRouter
- .fireEvent(new VaadinSessionDestroyEvent(this, vaadinSession));
+ eventRouter.fireEvent(new SessionDestroyEvent(this, vaadinSession));
}
/**
* Removes a Vaadin session destroy listener from this service.
*
- * @see #addVaadinSessionDestroyListener(VaadinSessionDestroyListener)
+ * @see #addVaadinSessionDestroyListener(SessionDestroyListener)
*
* @param listener
* the vaadin session destroy listener
*/
public void removeVaadinSessionDestroyListener(
- VaadinSessionDestroyListener listener) {
- eventRouter.removeListener(VaadinSessionDestroyEvent.class, listener,
+ SessionDestroyListener listener) {
+ eventRouter.removeListener(SessionDestroyEvent.class, listener,
SESSION_DESTROY_METHOD);
}
private void onVaadinSessionStarted(VaadinRequest request,
VaadinSession session) throws ServiceException {
- eventRouter.fireEvent(new VaadinSessionInitializeEvent(this, session,
- request));
+ eventRouter.fireEvent(new SessionInitEvent(this, session, request));
ServletPortletHelper.checkUiProviders(session, this);
}
* typically checks the @{@link PreserveOnRefresh} annotation but UI
* providers and ultimately VaadinService implementations may choose to
* override the defaults.
+ *
* @param provider
* the UI provider responsible for the UI
* @param event
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server;
-
-import java.util.EventObject;
-
-/**
- * Event fired when a Vaadin session is no longer in use.
- *
- * @see VaadinSessionDestroyListener#vaadinSessionDestroyed(VaadinSessionDestroyEvent)
- *
- * @author Vaadin Ltd
- * @since 7.0.0
- */
-public class VaadinSessionDestroyEvent extends EventObject {
-
- private final VaadinSession session;
-
- /**
- * Creates a new event.
- *
- * @param service
- * the Vaadin service from which the even originates
- * @param session
- * the Vaadin session that is no longer used
- */
- public VaadinSessionDestroyEvent(VaadinService service,
- VaadinSession session) {
- super(service);
- this.session = session;
- }
-
- @Override
- public VaadinService getSource() {
- return (VaadinService) super.getSource();
- }
-
- /**
- * Gets the Vaadin service from which the even originates.
- *
- * @return the Vaadin service
- */
- public VaadinService getService() {
- return getSource();
- }
-
- /**
- * Gets the Vaadin session that is no longer used.
- *
- * @return the Vaadin session
- */
- public VaadinSession getSession() {
- return session;
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server;
-
-/**
- * A listener that gets notified when a Vaadin session is no longer used.
- *
- * @see VaadinService#addVaadinSessionDestroyListener(VaadinSessionDestroyListener)
- *
- * @author Vaadin Ltd
- * @since 7.0.0
- */
-public interface VaadinSessionDestroyListener {
- /**
- * Called when a Vaadin session is no longer used.
- *
- * @param event
- * the event with details about the destroyed session
- */
- public void vaadinSessionDestroyed(VaadinSessionDestroyEvent event);
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server;
-
-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.
- * <p>
- * Because of the way different service instances share the same session, the
- * listener is not necessarily notified immediately when the session is created
- * but only when the first request for that session is handled by a specific
- * service.
- *
- * @see VaadinService#addVaadinSessionInitializationListener(VaadinSessionInitializationListener)
- *
- * @author Vaadin Ltd
- * @since 7.0.0
- */
-public interface VaadinSessionInitializationListener extends Serializable {
- /**
- * Invoked when a new Vaadin 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 but only when the first request for that session is handled by a
- * specific service.
- *
- * @param event
- * the initialization event
- * @throws ServiceException
- * a problem occurs when processing the event
- */
- public void vaadinSessionInitialized(VaadinSessionInitializeEvent event)
- throws ServiceException;
-}
+++ /dev/null
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server;
-
-import java.util.EventObject;
-
-/**
- * Event gets fired when a new Vaadin 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
- * only when the first request for that session is handled by a specific
- * service.
- *
- * @see VaadinSessionInitializationListener#vaadinSessionInitialized(VaadinSessionInitializeEvent)
- *
- * @author Vaadin Ltd
- * @since 7.0.0
- */
-public class VaadinSessionInitializeEvent extends EventObject {
-
- private final VaadinSession session;
- private final VaadinRequest request;
-
- /**
- * Creates a new event.
- *
- * @param service
- * the Vaadin service from which the event originates
- * @param session
- * the Vaadin session that has been initialized
- * @param request
- * the request that triggered the initialization
- */
- public VaadinSessionInitializeEvent(VaadinService service,
- VaadinSession session, VaadinRequest request) {
- super(service);
- this.session = session;
- this.request = request;
- }
-
- @Override
- public VaadinService getSource() {
- return (VaadinService) super.getSource();
- }
-
- /**
- * Gets the Vaadin service from which this event originates
- *
- * @return the Vaadin service instance
- */
- public VaadinService getService() {
- return getSource();
- }
-
- /**
- * Gets the Vaadin session that has been initialized.
- *
- * @return the Vaadin session
- */
- public VaadinSession getSession() {
- return session;
- }
-
- /**
- * Gets the request that triggered the initialization.
- *
- * @return the request
- */
- public VaadinRequest getRequest() {
- return request;
- }
-
-}
import com.vaadin.server.VaadinServletRequest;
import com.vaadin.server.VaadinServletService;
import com.vaadin.server.VaadinSession;
-import com.vaadin.server.VaadinSessionInitializationListener;
-import com.vaadin.server.VaadinSessionInitializeEvent;
+import com.vaadin.server.SessionInitListener;
+import com.vaadin.server.SessionInitEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.UI;
@Override
protected void servletInitialized() {
super.servletInitialized();
- getService().addVaadinSessionInitializationListener(
- new VaadinSessionInitializationListener() {
+ getService().addSessionInitListener(
+ new SessionInitListener() {
@Override
- public void vaadinSessionInitialized(
- VaadinSessionInitializeEvent event)
+ public void sessionInit(
+ SessionInitEvent event)
throws ServiceException {
onVaadinSessionStarted(event.getRequest(),
event.getSession());