aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/VaadinService.java25
-rw-r--r--server/src/com/vaadin/server/VaadinSession.java11
-rw-r--r--server/src/com/vaadin/ui/AbstractComponent.java9
-rw-r--r--server/src/com/vaadin/ui/AbstractComponentContainer.java13
-rw-r--r--server/src/com/vaadin/ui/AbstractSingleComponentContainer.java13
-rw-r--r--server/src/com/vaadin/ui/Form.java13
6 files changed, 39 insertions, 45 deletions
diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java
index 5d3f79fddb..5338ec217b 100644
--- a/server/src/com/vaadin/server/VaadinService.java
+++ b/server/src/com/vaadin/server/VaadinService.java
@@ -789,12 +789,27 @@ public abstract class VaadinService implements Serializable {
removeClosedUIs(session);
} else {
if (!session.isClosing()) {
- getLogger().fine(
- "Closing inactive session "
- + session.getSession().getId());
closeSession(session);
+ if (session.getSession() != null) {
+ getLogger().fine(
+ "Closing inactive session "
+ + session.getSession().getId());
+ }
+ }
+ if (session.getSession() != null) {
+ /*
+ * If the VaadinSession has no WrappedSession then it has
+ * already been removed from the HttpSession and we do not have
+ * to do it again
+ */
+ session.removeFromSession(this);
}
- session.removeFromSession(this);
+
+ /*
+ * The session was destroyed during this request and therefore no
+ * destroy event has yet been sent
+ */
+ fireSessionDestroy(session);
}
}
@@ -914,7 +929,7 @@ public abstract class VaadinService implements Serializable {
* @return true if the session is active, false if it could be closed.
*/
private boolean isSessionActive(VaadinSession session) {
- if (session.isClosing()) {
+ if (session.isClosing() || session.getSession() == null) {
return false;
} else {
long now = System.currentTimeMillis();
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 205e4dc6cf..4aa2ef5d92 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -160,7 +160,18 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
"A VaadinSession instance not associated to any service is getting unbound. "
+ "Session destroy events will not be fired and UIs in the session will not get detached. "
+ "This might happen if a session is deserialized but never used before it expires.");
+ } else if (VaadinService.getCurrentRequest() != null
+ && getCurrent() == this) {
+ // There is still a request in progress for this session. The
+ // session will be destroyed after the response has been written.
+ if (!isClosing()) {
+ close();
+ }
} else {
+ /*
+ * We are not in a request related to this session so we can
+ * immediately destroy it
+ */
service.fireSessionDestroy(this);
}
session = null;
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index 876a6c482d..63cf19283f 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -401,7 +401,14 @@ public abstract class AbstractComponent extends AbstractClientConnector
}
this.visible = visible;
- markAsDirty();
+ if (visible) {
+ /*
+ * If the visibility state is toggled from invisible to visible it
+ * affects all children (the whole hierarchy) in addition to this
+ * component.
+ */
+ markAsDirtyRecursive();
+ }
if (getParent() != null) {
// Must always repaint the parent (at least the hierarchy) when
// visibility of a child component changes.
diff --git a/server/src/com/vaadin/ui/AbstractComponentContainer.java b/server/src/com/vaadin/ui/AbstractComponentContainer.java
index 427bb3491c..4dd8a8d24a 100644
--- a/server/src/com/vaadin/ui/AbstractComponentContainer.java
+++ b/server/src/com/vaadin/ui/AbstractComponentContainer.java
@@ -232,19 +232,6 @@ public abstract class AbstractComponentContainer extends AbstractComponent
}
@Override
- public void setVisible(boolean visible) {
- if (isVisible() == visible) {
- return;
- }
-
- super.setVisible(visible);
- // If the visibility state is toggled it might affect all children
- // as well, e.g. make container visible should make children visible if
- // they were only hidden because the container was hidden.
- markAsDirtyRecursive();
- }
-
- @Override
public void setWidth(float width, Unit unit) {
/*
* child tree repaints may be needed, due to our fall back support for
diff --git a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
index 7297318e95..5ff56d46dc 100644
--- a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
+++ b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
@@ -103,19 +103,6 @@ public abstract class AbstractSingleComponentContainer extends
}
@Override
- public void setVisible(boolean visible) {
- if (isVisible() == visible) {
- return;
- }
-
- super.setVisible(visible);
- // If the visibility state is toggled it might affect all children
- // aswell, e.g. make container visible should make children visible if
- // they were only hidden because the container was hidden.
- markAsDirtyRecursive();
- }
-
- @Override
public Component getContent() {
return content;
}
diff --git a/server/src/com/vaadin/ui/Form.java b/server/src/com/vaadin/ui/Form.java
index 68ebb079f9..862d98bb3c 100644
--- a/server/src/com/vaadin/ui/Form.java
+++ b/server/src/com/vaadin/ui/Form.java
@@ -1374,17 +1374,4 @@ public class Form extends AbstractField<Object> implements Item.Editor,
return count;
}
- @Override
- public void setVisible(boolean visible) {
- if (isVisible() == visible) {
- return;
- }
-
- super.setVisible(visible);
- // If the visibility state is toggled it might affect all children
- // aswell, e.g. make container visible should make children visible if
- // they were only hidden because the container was hidden.
- markAsDirtyRecursive();
- }
-
}