From c95bf3d9ff40e79174536905450c9e62b4ef3eee Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Tue, 15 Apr 2008 06:40:59 +0000 Subject: [PATCH] Fixed typo, continuing devel. svn changeset:4176/svn branch:trunk --- .../{tookit => toolkit}/demo/PortletDemo.java | 11 ++++++++--- .../terminal/gwt/server/ApplicationPortlet.java | 15 +++++++++++---- .../gwt/server/PortletApplicationContext.java | 1 + 3 files changed, 20 insertions(+), 7 deletions(-) rename portlet-src/com/itmill/{tookit => toolkit}/demo/PortletDemo.java (85%) diff --git a/portlet-src/com/itmill/tookit/demo/PortletDemo.java b/portlet-src/com/itmill/toolkit/demo/PortletDemo.java similarity index 85% rename from portlet-src/com/itmill/tookit/demo/PortletDemo.java rename to 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("

WTF?

"); + 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("

Servlet include failed!

"); out.print("
" + e + "
"); 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); -- 2.39.5