summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2012-09-20 10:06:32 +0300
committerJohn Ahlroos <john@vaadin.com>2012-09-20 10:06:32 +0300
commit96d1ba6b53c2b8380a6cb4b3b1040e291a1a8766 (patch)
tree5a40e9e3e52ed623a0511c575bb3473ff8eef4c3 /server
parent5fd0cda243e548448fe2b60e6693d626a7d9b734 (diff)
parentc93035c9812b33718195c829a7231347e095b549 (diff)
downloadvaadin-framework-96d1ba6b53c2b8380a6cb4b3b1040e291a1a8766.tar.gz
vaadin-framework-96d1ba6b53c2b8380a6cb4b3b1040e291a1a8766.zip
Merge branch 'master' into html5-doctype
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/data/fieldgroup/FieldGroup.java3
-rw-r--r--server/src/com/vaadin/server/AbstractCommunicationManager.java6
-rw-r--r--server/src/com/vaadin/server/CombinedRequest.java7
-rw-r--r--server/src/com/vaadin/server/VaadinServlet.java5
-rw-r--r--server/src/com/vaadin/server/WrappedHttpServletRequest.java14
-rw-r--r--server/src/com/vaadin/server/WrappedPortletRequest.java14
-rw-r--r--server/src/com/vaadin/server/WrappedRequest.java20
-rw-r--r--server/src/com/vaadin/ui/UI.java4
8 files changed, 65 insertions, 8 deletions
diff --git a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
index 9fe99610b2..5d0c23e779 100644
--- a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
+++ b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
@@ -209,6 +209,9 @@ public class FieldGroup implements Serializable {
*/
public void setReadOnly(boolean fieldsReadOnly) {
readOnly = fieldsReadOnly;
+ for (Field<?> field : getFields()) {
+ field.setReadOnly(fieldsReadOnly);
+ }
}
/**
diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java
index 32800506a3..5832b144ec 100644
--- a/server/src/com/vaadin/server/AbstractCommunicationManager.java
+++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java
@@ -2464,9 +2464,11 @@ public abstract class AbstractCommunicationManager implements Serializable {
public void handleBrowserDetailsRequest(WrappedRequest request,
WrappedResponse response, VaadinSession session) throws IOException {
- assert UI.getCurrent() == null;
+ session.getLock().lock();
try {
+ assert UI.getCurrent() == null;
+
CombinedRequest combinedRequest = new CombinedRequest(request);
response.setContentType("application/json; charset=UTF-8");
@@ -2495,6 +2497,8 @@ public abstract class AbstractCommunicationManager implements Serializable {
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
+ } finally {
+ session.getLock().unlock();
}
}
diff --git a/server/src/com/vaadin/server/CombinedRequest.java b/server/src/com/vaadin/server/CombinedRequest.java
index 2364527a65..91c5093ece 100644
--- a/server/src/com/vaadin/server/CombinedRequest.java
+++ b/server/src/com/vaadin/server/CombinedRequest.java
@@ -114,7 +114,12 @@ public class CombinedRequest implements WrappedRequest {
@Override
public WrappedSession getWrappedSession() {
- return secondRequest.getWrappedSession();
+ return getWrappedSession(true);
+ }
+
+ @Override
+ public WrappedSession getWrappedSession(boolean allowSessionCreation) {
+ return secondRequest.getWrappedSession(allowSessionCreation);
}
@Override
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index 9372a08e10..fd95852c6a 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -677,7 +677,10 @@ public class VaadinServlet extends HttpServlet implements Constants {
* without using the bootstrap page.
*/
return true;
-
+ } else if (requestType == RequestType.BROWSER_DETAILS) {
+ // This is the first request if you are embedding by writing the
+ // embedding code yourself
+ return true;
} else if (requestType == RequestType.OTHER) {
/*
* I.e URIs that are not application resources or static (theme)
diff --git a/server/src/com/vaadin/server/WrappedHttpServletRequest.java b/server/src/com/vaadin/server/WrappedHttpServletRequest.java
index 87c6c521af..99e8881ec1 100644
--- a/server/src/com/vaadin/server/WrappedHttpServletRequest.java
+++ b/server/src/com/vaadin/server/WrappedHttpServletRequest.java
@@ -18,6 +18,7 @@ package com.vaadin.server;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpSession;
import com.vaadin.server.VaadinServlet.ServletService;
@@ -56,7 +57,17 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper
@Override
public WrappedSession getWrappedSession() {
- return new WrappedHttpSession(getSession());
+ return getWrappedSession(true);
+ }
+
+ @Override
+ public WrappedSession getWrappedSession(boolean allowSessionCreation) {
+ HttpSession session = getSession(allowSessionCreation);
+ if (session != null) {
+ return new WrappedHttpSession(session);
+ } else {
+ return null;
+ }
}
/**
@@ -111,4 +122,5 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper
}
return (WrappedHttpServletRequest) request;
}
+
} \ No newline at end of file
diff --git a/server/src/com/vaadin/server/WrappedPortletRequest.java b/server/src/com/vaadin/server/WrappedPortletRequest.java
index dd46194a2a..d4670cfd92 100644
--- a/server/src/com/vaadin/server/WrappedPortletRequest.java
+++ b/server/src/com/vaadin/server/WrappedPortletRequest.java
@@ -23,6 +23,7 @@ import java.util.Map;
import javax.portlet.ClientDataRequest;
import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
import javax.portlet.ResourceRequest;
import com.vaadin.server.VaadinPortlet.PortletService;
@@ -114,7 +115,18 @@ public class WrappedPortletRequest implements WrappedRequest {
@Override
public WrappedSession getWrappedSession() {
- return new WrappedPortletSession(request.getPortletSession());
+ return getWrappedSession(true);
+ }
+
+ @Override
+ public WrappedSession getWrappedSession(boolean allowSessionCreation) {
+ PortletSession session = request
+ .getPortletSession(allowSessionCreation);
+ if (session != null) {
+ return new WrappedPortletSession(session);
+ } else {
+ return null;
+ }
}
/**
diff --git a/server/src/com/vaadin/server/WrappedRequest.java b/server/src/com/vaadin/server/WrappedRequest.java
index 504f21aed4..aeaff2b384 100644
--- a/server/src/com/vaadin/server/WrappedRequest.java
+++ b/server/src/com/vaadin/server/WrappedRequest.java
@@ -161,7 +161,8 @@ public interface WrappedRequest extends Serializable {
public String getRequestPathInfo();
/**
- * Gets the session associated with this request.
+ * Gets the session associated with this request, creating a new if there is
+ * no session.
*
* @see WrappedSession
* @see HttpServletRequest#getSession()
@@ -172,6 +173,23 @@ public interface WrappedRequest extends Serializable {
public WrappedSession getWrappedSession();
/**
+ * Gets the session associated with this request, optionally creating a new
+ * if there is no session.
+ *
+ * @param allowSessionCreation
+ * <code>true</code> to create a new session for this request if
+ * necessary; <code>false</code> to return <code>null</code> if
+ * there's no current session
+ *
+ * @see WrappedSession
+ * @see HttpServletRequest#getSession(boolean)
+ * @see PortletRequest#getPortletSession(boolean)
+ *
+ * @return the wrapped session for this request
+ */
+ public WrappedSession getWrappedSession(boolean allowSessionCreation);
+
+ /**
* Returns the MIME type of the body of the request, or null if the type is
* not known.
*
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 7f0710c813..3ad0cc57fa 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -799,8 +799,8 @@ public abstract class UI extends AbstractComponentContainer implements
/**
* Remove the given subwindow from this UI.
*
- * Since Vaadin 6.5, {@link CloseListener}s are called also when explicitly
- * removing a window by calling this method.
+ * Since Vaadin 6.5, {@link Window.CloseListener}s are called also when
+ * explicitly removing a window by calling this method.
*
* Since Vaadin 6.5, returns a boolean indicating if the window was removed
* or not.