summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-06-13 18:31:59 +0300
committerArtur Signell <artur@vaadin.com>2013-06-14 09:15:12 +0300
commitbad3208d69e863322cf17cfaa1dca97170c7e6a7 (patch)
tree5aaf6b83f8509ae655dc588f518ed1ee1e964902 /server
parent54ffbdb70746743f4754416911f726f8d556b3ed (diff)
downloadvaadin-framework-bad3208d69e863322cf17cfaa1dca97170c7e6a7.tar.gz
vaadin-framework-bad3208d69e863322cf17cfaa1dca97170c7e6a7.zip
Corrected fix and better error checking for action/event request (#12056)
Change-Id: I85e8fff753baba2d0c373f235ddf74d0d2a97ed3
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/VaadinPortletResponse.java15
-rw-r--r--server/src/com/vaadin/server/communication/PortletStateAwareRequestHandler.java9
2 files changed, 21 insertions, 3 deletions
diff --git a/server/src/com/vaadin/server/VaadinPortletResponse.java b/server/src/com/vaadin/server/VaadinPortletResponse.java
index 334b94a5dc..ccb35a2c91 100644
--- a/server/src/com/vaadin/server/VaadinPortletResponse.java
+++ b/server/src/com/vaadin/server/VaadinPortletResponse.java
@@ -85,12 +85,23 @@ public class VaadinPortletResponse implements VaadinResponse {
@Override
public void setContentType(String type) {
- ((MimeResponse) response).setContentType(type);
+ if (response instanceof MimeResponse) {
+ ((MimeResponse) response).setContentType(type);
+ } else {
+ throw new RuntimeException(
+ "Content type cannot be set for response of type "
+ + response.getClass().getName());
+ }
}
@Override
public PrintWriter getWriter() throws IOException {
- return ((MimeResponse) response).getWriter();
+ if (response instanceof MimeResponse) {
+ return ((MimeResponse) response).getWriter();
+ } else {
+ throw new IOException("Writer not available for response of type "
+ + response.getClass().getName());
+ }
}
@Override
diff --git a/server/src/com/vaadin/server/communication/PortletStateAwareRequestHandler.java b/server/src/com/vaadin/server/communication/PortletStateAwareRequestHandler.java
index 162c479fac..4072aae359 100644
--- a/server/src/com/vaadin/server/communication/PortletStateAwareRequestHandler.java
+++ b/server/src/com/vaadin/server/communication/PortletStateAwareRequestHandler.java
@@ -17,9 +17,11 @@ package com.vaadin.server.communication;
import java.io.IOException;
+import javax.portlet.PortletResponse;
import javax.portlet.StateAwareResponse;
import com.vaadin.server.RequestHandler;
+import com.vaadin.server.VaadinPortletResponse;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinResponse;
import com.vaadin.server.VaadinSession;
@@ -43,7 +45,12 @@ public class PortletStateAwareRequestHandler implements RequestHandler {
@Override
public boolean handleRequest(VaadinSession session, VaadinRequest request,
VaadinResponse response) throws IOException {
- if (response instanceof StateAwareResponse) {
+ if (!(response instanceof VaadinPortletResponse)) {
+ return false;
+ }
+ PortletResponse portletResponse = ((VaadinPortletResponse) response)
+ .getPortletResponse();
+ if (portletResponse instanceof StateAwareResponse) {
// StateAwareResponse is fully handled by listeners through
// PortletListenerNotifier
return true;