summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorPetter Holmström <petter.holmstrom@itmill.com>2009-11-10 12:21:09 +0000
committerPetter Holmström <petter.holmstrom@itmill.com>2009-11-10 12:21:09 +0000
commitf886f99171a9257abdeb0a8af986ae8516aca62b (patch)
treeb5e38310191d2aa702fbb869f50fcec8dfe14e4b /src/com
parent4023ac28e9047ec2495d0a96159383ef0e276dc0 (diff)
downloadvaadin-framework-f886f99171a9257abdeb0a8af986ae8516aca62b.tar.gz
vaadin-framework-f886f99171a9257abdeb0a8af986ae8516aca62b.zip
Preliminary support for portlet events.
svn changeset:9708/svn branch:portlet_2.0
Diffstat (limited to 'src/com')
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
index 6119c048e0..4dcc38d21d 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
@@ -22,6 +22,9 @@ import java.util.Properties;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
+import javax.portlet.EventPortlet;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.MimeResponse;
import javax.portlet.PortletConfig;
@@ -255,7 +258,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
}
enum RequestType {
- FILE_UPLOAD, UIDL, RENDER, STATIC_FILE, APPLICATION_RESOURCE, DUMMY, UNKNOWN;
+ FILE_UPLOAD, UIDL, RENDER, STATIC_FILE, APPLICATION_RESOURCE, DUMMY, EVENT, UNKNOWN;
}
protected RequestType getRequestType(PortletRequest request) {
@@ -275,6 +278,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
if (isFileUploadRequest((ActionRequest) request)) {
return RequestType.FILE_UPLOAD;
}
+ } else if (request instanceof EventRequest) {
+ return RequestType.EVENT;
}
return RequestType.UNKNOWN;
}
@@ -310,18 +315,18 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
protected void handleRequest(PortletRequest request,
PortletResponse response) throws PortletException, IOException {
- System.out.println("AbstractApplicationPortlet.handleRequest() "
- + System.currentTimeMillis());
+// System.out.println("AbstractApplicationPortlet.handleRequest() "
+// + System.currentTimeMillis());
RequestType requestType = getRequestType(request);
- System.out.println(" RequestType: " + requestType);
- System.out.println(" WindowID: " + request.getWindowID());
+// System.out.println(" RequestType: " + requestType);
+// System.out.println(" WindowID: " + request.getWindowID());
if (requestType == RequestType.UNKNOWN) {
System.err.println("Unknown request type");
} else if (requestType == RequestType.DUMMY) {
- System.out.println("Printing Dummy page");
+// System.out.println("Printing Dummy page");
/*
* This dummy page is used by action responses to redirect to, in
* order to prevent the boot strap code from being rendered into
@@ -400,6 +405,17 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
(ResourceRequest) request,
(ResourceResponse) response, this);
return;
+ } else if (requestType == RequestType.EVENT) {
+ /*
+ * Redirect portlet event to application if it implements
+ * the EventPortlet interface (contains only one method).
+ */
+ // TODO Figure out a better way of handling events
+ if (application instanceof EventPortlet) {
+ ((EventPortlet) application).processEvent(
+ (EventRequest) request,
+ (EventResponse) response);
+ }
} else {
/*
* Removes the application if it has stopped
@@ -468,6 +484,12 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
}
}
+ @Override
+ public void processEvent(EventRequest request, EventResponse response)
+ throws PortletException, IOException {
+ handleRequest(request, response);
+ }
+
private boolean handleURI(PortletCommunicationManager applicationManager,
Window window, ResourceRequest request, ResourceResponse response)
throws IOException {