import com.vaadin.Application;
import com.vaadin.Application.SystemMessages;
import com.vaadin.terminal.Terminal;
+import com.vaadin.terminal.WrappedRequest;
+import com.vaadin.terminal.WrappedResponse;
import com.vaadin.terminal.gwt.client.ApplicationConfiguration;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
+import com.vaadin.terminal.gwt.server.AbstractCommunicationManager.Callback;
import com.vaadin.ui.Root;
/**
private static final Logger logger = Logger
.getLogger(AbstractApplicationPortlet.class.getName());
+ private static class AbstractApplicationPortletWrapper implements Callback {
+
+ private final AbstractApplicationPortlet portlet;
+
+ public AbstractApplicationPortletWrapper(
+ AbstractApplicationPortlet portlet) {
+ this.portlet = portlet;
+ }
+
+ public void criticalNotification(WrappedRequest request,
+ WrappedResponse response, String cap, String msg,
+ String details, String outOfSyncURL) throws IOException {
+ portlet.criticalNotification(
+ ((WrappedPortletRequest) request).getPortletRequest(),
+ ((WrappedPortletResponse) response).getPortletResponse(),
+ cap, msg, details, outOfSyncURL);
+ }
+
+ public String getRequestPathInfo(WrappedRequest request) {
+ return request.getRequestPathInfo();
+ }
+
+ public InputStream getThemeResourceAsStream(String themeName,
+ String resource) throws IOException {
+ return portlet.getPortletContext().getResourceAsStream(
+ "/" + AbstractApplicationPortlet.THEME_DIRECTORY_PATH
+ + themeName + "/" + resource);
+ }
+
+ }
+
/**
* This portlet parameter is used to add styles to the main element. E.g
* "height:500px" generates a style="height:500px" to the main element.
protected void handleRequest(PortletRequest request,
PortletResponse response) throws PortletException, IOException {
+ AbstractApplicationPortletWrapper portletWrapper = new AbstractApplicationPortletWrapper(
+ this);
RequestType requestType = getRequestType(request);
if (requestType == RequestType.UNKNOWN) {
break;
default:
root = applicationManager.getApplicationRoot(
- request, this, application, null);
+ request, portletWrapper, application, null);
}
// if window not found, not a problem - use null
}
}
applicationManager.handleUidlRequest(
(ResourceRequest) request,
- (ResourceResponse) response, this, root);
+ (ResourceResponse) response, portletWrapper, root);
return;
} else {
/*
package com.vaadin.terminal.gwt.server;
import java.io.IOException;
-import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import com.vaadin.terminal.Paintable;
import com.vaadin.terminal.StreamVariable;
import com.vaadin.terminal.VariableOwner;
-import com.vaadin.terminal.WrappedRequest;
-import com.vaadin.terminal.WrappedResponse;
import com.vaadin.ui.Component;
import com.vaadin.ui.Root;
private transient ResourceResponse currentUidlResponse;
- private static class AbstractApplicationPortletWrapper implements Callback {
-
- private final AbstractApplicationPortlet portlet;
-
- public AbstractApplicationPortletWrapper(
- AbstractApplicationPortlet portlet) {
- this.portlet = portlet;
- }
-
- public void criticalNotification(WrappedRequest request,
- WrappedResponse response, String cap, String msg,
- String details, String outOfSyncURL) throws IOException {
- portlet.criticalNotification(
- ((WrappedPortletRequest) request).getPortletRequest(),
- ((WrappedPortletResponse) response).getPortletResponse(),
- cap, msg, details, outOfSyncURL);
- }
-
- public String getRequestPathInfo(WrappedRequest request) {
- return request.getRequestPathInfo();
- }
-
- public InputStream getThemeResourceAsStream(String themeName,
- String resource) throws IOException {
- return portlet.getPortletContext().getResourceAsStream(
- "/" + AbstractApplicationPortlet.THEME_DIRECTORY_PATH
- + themeName + "/" + resource);
- }
-
- }
-
public PortletCommunicationManager(Application application) {
super(application);
}
}
public void handleUidlRequest(ResourceRequest request,
- ResourceResponse response,
- AbstractApplicationPortlet applicationPortlet, Root root)
+ ResourceResponse response, Callback callback, Root root)
throws InvalidUIDLSecurityKeyException, IOException {
currentUidlResponse = response;
doHandleUidlRequest(new WrappedPortletRequest(request),
- new WrappedPortletResponse(response),
- new AbstractApplicationPortletWrapper(applicationPortlet), root);
+ new WrappedPortletResponse(response), callback, root);
currentUidlResponse = null;
}
* if an exception has occurred that interferes with the
* servlet's normal operation.
*/
- Root getApplicationRoot(PortletRequest request,
- AbstractApplicationPortlet applicationPortlet,
+ Root getApplicationRoot(PortletRequest request, Callback callback,
Application application, Root assumedRoot) {
return doGetApplicationWindow(new WrappedPortletRequest(request),
- new AbstractApplicationPortletWrapper(applicationPortlet),
- application, assumedRoot);
+ callback, application, assumedRoot);
}
private Map<VariableOwner, Map<String, StreamVariable>> ownerToNameToStreamVariable;