import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
-import javax.portlet.MimeResponse;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
import javax.portlet.ResourceRequest;
private transient ResourceResponse currentUidlResponse;
- private static class PortletResponseWrapper implements WrappedResponse {
-
- private final PortletResponse response;
-
- public PortletResponseWrapper(PortletResponse response) {
- this.response = response;
- }
-
- public OutputStream getOutputStream() throws IOException {
- return ((MimeResponse) response).getPortletOutputStream();
- }
-
- public MimeResponse getPortletResponse() {
- return (MimeResponse) response;
- }
-
- public void setContentType(String type) {
- ((MimeResponse) response).setContentType(type);
- }
-
- public PrintWriter getWriter() throws IOException {
- return ((MimeResponse) response).getWriter();
- }
-
- public void setStatus(int responseStatus) {
- response.setProperty(ResourceResponse.HTTP_STATUS_CODE,
- Integer.toString(responseStatus));
- }
-
- public void setHeader(String name, String value) {
- response.setProperty(name, value);
- }
- }
-
private static class AbstractApplicationPortletWrapper implements Callback {
private final AbstractApplicationPortlet portlet;
String details, String outOfSyncURL) throws IOException {
portlet.criticalNotification(
((WrappedPortletRequest) request).getPortletRequest(),
- ((PortletResponseWrapper) response).getPortletResponse(),
+ ((WrappedPortletResponse) response).getPortletResponse(),
cap, msg, details, outOfSyncURL);
}
if (contentType.contains("boundary")) {
doHandleSimpleMultipartFileUpload(
new WrappedPortletRequest(request),
- new PortletResponseWrapper(response), streamVariable, name,
+ new WrappedPortletResponse(response), streamVariable, name,
variableOwner, contentType.split("boundary=")[1]);
} else {
doHandleXhrFilePost(new WrappedPortletRequest(request),
- new PortletResponseWrapper(response), streamVariable, name,
+ new WrappedPortletResponse(response), streamVariable, name,
variableOwner, request.getContentLength());
}
throws InvalidUIDLSecurityKeyException, IOException {
currentUidlResponse = response;
doHandleUidlRequest(new WrappedPortletRequest(request),
- new PortletResponseWrapper(response),
+ new WrappedPortletResponse(response),
new AbstractApplicationPortletWrapper(applicationPortlet), root);
currentUidlResponse = null;
}
public boolean handleApplicationRequest(PortletRequest request,
PortletResponse response) throws IOException {
return handleApplicationRequest(new WrappedPortletRequest(request),
- new PortletResponseWrapper(response));
+ new WrappedPortletResponse(response));
}
}
--- /dev/null
+package com.vaadin.terminal.gwt.server;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+import javax.portlet.MimeResponse;
+import javax.portlet.PortletResponse;
+import javax.portlet.ResourceResponse;
+
+import com.vaadin.terminal.WrappedResponse;
+
+public class WrappedPortletResponse implements WrappedResponse {
+
+ private final PortletResponse response;
+
+ public WrappedPortletResponse(PortletResponse response) {
+ this.response = response;
+ }
+
+ public OutputStream getOutputStream() throws IOException {
+ return ((MimeResponse) response).getPortletOutputStream();
+ }
+
+ public MimeResponse getPortletResponse() {
+ return (MimeResponse) response;
+ }
+
+ public void setContentType(String type) {
+ ((MimeResponse) response).setContentType(type);
+ }
+
+ public PrintWriter getWriter() throws IOException {
+ return ((MimeResponse) response).getWriter();
+ }
+
+ public void setStatus(int responseStatus) {
+ response.setProperty(ResourceResponse.HTTP_STATUS_CODE,
+ Integer.toString(responseStatus));
+ }
+
+ public void setHeader(String name, String value) {
+ response.setProperty(name, value);
+ }
+}
\ No newline at end of file