summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--portlet-src/com/itmill/toolkit/demo/PortletDemo.java (renamed from portlet-src/com/itmill/tookit/demo/PortletDemo.java)11
-rw-r--r--portlet-src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java15
-rw-r--r--portlet-src/com/itmill/toolkit/terminal/gwt/server/PortletApplicationContext.java1
3 files changed, 20 insertions, 7 deletions
diff --git a/portlet-src/com/itmill/tookit/demo/PortletDemo.java b/portlet-src/com/itmill/toolkit/demo/PortletDemo.java
index 7e57132466..d519874812 100644
--- a/portlet-src/com/itmill/tookit/demo/PortletDemo.java
+++ b/portlet-src/com/itmill/toolkit/demo/PortletDemo.java
@@ -1,7 +1,7 @@
/**
*
*/
-package com.itmill.tookit.demo;
+package com.itmill.toolkit.demo;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
@@ -33,6 +33,7 @@ public class PortletDemo extends Application {
public void init() {
main = new Window();
+ setMainWindow(main);
tf.setEnabled(false);
main.addComponent(tf);
@@ -43,9 +44,13 @@ public class PortletDemo extends Application {
portletMax.setEnabled(false);
main.addComponent(portletMax);
- PortletApplicationContext ctx = (PortletApplicationContext) getContext();
+ if (getContext() instanceof PortletApplicationContext) {
+ PortletApplicationContext ctx = (PortletApplicationContext) getContext();
+ ctx.addPortletListener(this, new DemoPortletListener());
+ } else {
+ getMainWindow().showNotification("Not inited via Portal!");
+ }
- ctx.addPortletListener(this, new DemoPortletListener());
}
private class DemoPortletListener implements PortletListener {
diff --git a/portlet-src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java b/portlet-src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java
index bb88456059..5a924cd41a 100644
--- a/portlet-src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java
+++ b/portlet-src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java
@@ -17,7 +17,7 @@ import com.itmill.toolkit.Application;
public class ApplicationPortlet implements Portlet {
// The application to show
- protected String app = "PortletDemo";
+ protected String app = "Calc";
// some applications might require that the height is specified
protected String height = null; // e.g "200px"
@@ -31,7 +31,7 @@ public class ApplicationPortlet implements Portlet {
this.config = config;
app = config.getInitParameter("application");
if (app == null) {
- app = "PortalDemo";
+ app = "PortletDemo";
}
height = config.getInitParameter("height");
}
@@ -61,8 +61,10 @@ public class ApplicationPortlet implements Portlet {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
- if (app != null) {
+ out.println("<h1>WTF?</h1>");
+ if (app != null) {
+ System.err.println("WTFFF???");
PortletSession sess = request.getPortletSession();
PortletApplicationContext ctx = PortletApplicationContext
.getApplicationContext(sess);
@@ -76,11 +78,16 @@ public class ApplicationPortlet implements Portlet {
-*/
PortletRequestDispatcher dispatcher = sess.getPortletContext()
- .getRequestDispatcher("/" + app);
+ .getRequestDispatcher(
+ "/" + request.getContextPath() + "/" + app);
try {
+ // TODO remove:
+
+ System.err.println(request.getContextPath() + " (portlet ctx)");
// TODO height
dispatcher.include(request, response);
+
} catch (PortletException e) {
out.print("<h1>Servlet include failed!</h1>");
out.print("<div>" + e + "</div>");
diff --git a/portlet-src/com/itmill/toolkit/terminal/gwt/server/PortletApplicationContext.java b/portlet-src/com/itmill/toolkit/terminal/gwt/server/PortletApplicationContext.java
index 4ddbabdb96..46c28e72ca 100644
--- a/portlet-src/com/itmill/toolkit/terminal/gwt/server/PortletApplicationContext.java
+++ b/portlet-src/com/itmill/toolkit/terminal/gwt/server/PortletApplicationContext.java
@@ -42,6 +42,7 @@ public class PortletApplicationContext extends WebApplicationContext {
static public PortletApplicationContext getApplicationContext(
PortletSession session) {
+ System.err.println("PortletApplicationContext.getApplicationContext");
WebApplicationContext cx = (WebApplicationContext) session
.getAttribute(WebApplicationContext.class.getName(),
PortletSession.APPLICATION_SCOPE);