summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-20 10:09:43 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-20 10:09:57 +0300
commitde4eba4b85b0dcafa00542ee1943817149fccf26 (patch)
treebb1343cf9e7e4bc6f0dd2a2a867ff77e11c97f2b
parent0dda5a66cf4dc1f033f82c57565b0aa25506f124 (diff)
downloadvaadin-framework-de4eba4b85b0dcafa00542ee1943817149fccf26.tar.gz
vaadin-framework-de4eba4b85b0dcafa00542ee1943817149fccf26.zip
Make Servlet/PortletService.getCurrentRequest give raw requests (#9505)
-rw-r--r--server/src/com/vaadin/server/VaadinPortlet.java10
-rw-r--r--server/src/com/vaadin/server/VaadinServlet.java10
-rw-r--r--server/src/com/vaadin/server/VaadinServletSession.java5
3 files changed, 19 insertions, 6 deletions
diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java
index dc1f93b2a8..a156c9b79d 100644
--- a/server/src/com/vaadin/server/VaadinPortlet.java
+++ b/server/src/com/vaadin/server/VaadinPortlet.java
@@ -222,10 +222,16 @@ public class VaadinPortlet extends GenericPortlet implements Constants {
return new PortletCommunicationManager(session);
}
- public static WrappedPortletRequest getCurrentRequest() {
+ public static PortletRequest getCurrentPortletRequest() {
WrappedRequest currentRequest = VaadinService.getCurrentRequest();
try {
- return WrappedPortletRequest.cast(currentRequest);
+ WrappedPortletRequest request = WrappedPortletRequest
+ .cast(currentRequest);
+ if (request != null) {
+ return request.getPortletRequest();
+ } else {
+ return null;
+ }
} catch (ClassCastException e) {
return null;
}
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index c42d029dc4..19e831c51b 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -198,10 +198,16 @@ public class VaadinServlet extends HttpServlet implements Constants {
return new CommunicationManager(session);
}
- public static WrappedHttpServletRequest getCurrentRequest() {
+ public static HttpServletRequest getCurrentServletRequest() {
WrappedRequest currentRequest = VaadinService.getCurrentRequest();
try {
- return WrappedHttpServletRequest.cast(currentRequest);
+ WrappedHttpServletRequest request = WrappedHttpServletRequest
+ .cast(currentRequest);
+ if (request != null) {
+ return request.getHttpServletRequest();
+ } else {
+ return null;
+ }
} catch (ClassCastException e) {
return null;
}
diff --git a/server/src/com/vaadin/server/VaadinServletSession.java b/server/src/com/vaadin/server/VaadinServletSession.java
index b2dc84d857..9a937b401b 100644
--- a/server/src/com/vaadin/server/VaadinServletSession.java
+++ b/server/src/com/vaadin/server/VaadinServletSession.java
@@ -19,6 +19,7 @@ package com.vaadin.server;
import java.util.Enumeration;
import java.util.HashMap;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
@@ -58,8 +59,8 @@ public class VaadinServletSession extends VaadinSession {
* to avoid session fixation attacks.
*/
public void reinitializeSession() {
- WrappedHttpServletRequest currentRequest = ServletService
- .getCurrentRequest();
+ HttpServletRequest currentRequest = ServletService
+ .getCurrentServletRequest();
if (currentRequest == null) {
throw new IllegalStateException(
"Can not reinitialize session outside normal request handling.");