From 6bc4eda9973c56cc6e0ac8f4ba881833f566f643 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Thu, 26 Nov 2009 11:31:49 +0000 Subject: [PATCH] Minor corrections for Portlet 2.0 and some javadoc svn changeset:10065/svn branch:6.2 --- .../server/AbstractApplicationPortlet.java | 17 ++++------ .../server/AbstractApplicationServlet.java | 23 +++++++++++++ .../server/PortletApplicationContext2.java | 7 ++-- .../gwt/server/WebApplicationContext.java | 33 ++++++++++--------- 4 files changed, 52 insertions(+), 28 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java index fb01e13419..0cfb04bb91 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java @@ -749,7 +749,6 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet if (session != null) { PortletApplicationContext2 context = PortletApplicationContext2 .getApplicationContext(session); - context.applicationToAjaxAppMgrMap.remove(application); context.removeApplication(application); } } @@ -813,21 +812,19 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet final BufferedWriter page = new BufferedWriter(new OutputStreamWriter( response.getPortletOutputStream(), "UTF-8")); - // TODO this is broken, not set as no servlet - String requestWidgetset = (String) request - .getAttribute(AbstractApplicationServlet.REQUEST_WIDGETSET); - + // TODO check + String requestWidgetset = getApplicationOrSystemProperty( + PARAMETER_WIDGETSET, null); String sharedWidgetset = getPortalProperty( PORTAL_PARAMETER_VAADIN_WIDGETSET, request.getPortalContext()); - if (requestWidgetset == null && sharedWidgetset == null) { - requestWidgetset = getApplicationOrSystemProperty( - PARAMETER_WIDGETSET, DEFAULT_WIDGETSET); - } + String widgetset; if (requestWidgetset != null) { widgetset = requestWidgetset; - } else { + } else if (sharedWidgetset != null) { widgetset = sharedWidgetset; + } else { + widgetset = DEFAULT_WIDGETSET; } // TODO Currently, we can only load widgetsets and themes from the diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java index 26abd0fa3e..59a1827f62 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java @@ -109,6 +109,9 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements /** * If the attribute is present in the request, a html fragment will be * written instead of a whole page. + * + * It is set to "true" by the {@link ApplicationPortlet} (Portlet 1.0) and + * read by {@link AbstractApplicationServlet}. */ public static final String REQUEST_FRAGMENT = ApplicationServlet.class .getName() @@ -116,6 +119,10 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements /** * This request attribute forces widgetsets to be loaded from under the * specified base path; e.g shared widgetset for all portlets in a portal. + * + * It is set by the {@link ApplicationPortlet} (Portlet 1.0) based on + * {@link Constants.PORTAL_PARAMETER_VAADIN_RESOURCE_PATH} and read by + * {@link AbstractApplicationServlet}. */ public static final String REQUEST_VAADIN_STATIC_FILE_PATH = ApplicationServlet.class .getName() @@ -123,6 +130,10 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements /** * This request attribute forces widgetset used; e.g for portlets that can * not have different widgetsets. + * + * It is set by the {@link ApplicationPortlet} (Portlet 1.0) based on + * {@link ApplicationPortlet.PORTLET_PARAMETER_WIDGETSET} and read by + * {@link AbstractApplicationServlet}. */ public static final String REQUEST_WIDGETSET = ApplicationServlet.class .getName() @@ -130,6 +141,10 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements /** * This request attribute indicates the shared widgetset (e.g. portal-wide * default widgetset). + * + * It is set by the {@link ApplicationPortlet} (Portlet 1.0) based on + * {@link Constants.PORTAL_PARAMETER_VAADIN_WIDGETSET} and read by + * {@link AbstractApplicationServlet}. */ public static final String REQUEST_SHARED_WIDGETSET = ApplicationServlet.class .getName() @@ -137,6 +152,10 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements /** * If set, do not load the default theme but assume that loading it is * handled e.g. by ApplicationPortlet. + * + * It is set by the {@link ApplicationPortlet} (Portlet 1.0) based on + * {@link Constants.PORTAL_PARAMETER_VAADIN_THEME} and read by + * {@link AbstractApplicationServlet}. */ public static final String REQUEST_DEFAULT_THEME = ApplicationServlet.class .getName() @@ -145,6 +164,10 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements * This request attribute is used to add styles to the main element. E.g * "height:500px" generates a style="height:500px" to the main element, * useful from some embedding situations (e.g portlet include.) + * + * It is typically set by the {@link ApplicationPortlet} (Portlet 1.0) based + * on {@link ApplicationPortlet.PORTLET_PARAMETER_STYLE} and read by + * {@link AbstractApplicationServlet}. */ public static final String REQUEST_APPSTYLE = ApplicationServlet.class .getName() diff --git a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java index c3c319724d..fce8ac405e 100644 --- a/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java +++ b/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java @@ -32,9 +32,10 @@ import com.vaadin.service.ApplicationContext; /** * TODO Write documentation, fix JavaDoc tags. - * - * TODO is implementing HttpSessionBindingListener correct/useful? - * + * + * This is automatically registered as a {@link HttpSessionBindingListener} when + * {@link PortletSession#setAttribute()} is called with the context as value. + * * @author peholmst */ @SuppressWarnings("serial") diff --git a/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java b/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java index 2e114a38dc..109095e907 100644 --- a/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java +++ b/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java @@ -1,4 +1,4 @@ -/* +/* @ITMillApache2LicenseForJavaFiles@ */ @@ -27,6 +27,9 @@ import com.vaadin.service.ApplicationContext; /** * Web application context for Vaadin applications. * + * This is automatically added as a {@link HttpSessionBindingListener} when + * added to a {@link HttpSession}. + * * @author IT Mill Ltd. * @version * @VERSION@ @@ -49,7 +52,7 @@ public class WebApplicationContext implements ApplicationContext, /** * Creates a new Web Application Context. - * + * */ WebApplicationContext() { @@ -57,7 +60,7 @@ public class WebApplicationContext implements ApplicationContext, /** * Gets the application context base directory. - * + * * @see com.vaadin.service.ApplicationContext#getBaseDirectory() */ public File getBaseDirectory() { @@ -71,7 +74,7 @@ public class WebApplicationContext implements ApplicationContext, /** * Gets the http-session application is running in. - * + * * @return HttpSession this application context resides in. */ public HttpSession getHttpSession() { @@ -80,7 +83,7 @@ public class WebApplicationContext implements ApplicationContext, /** * Gets the applications in this context. - * + * * @see com.vaadin.service.ApplicationContext#getApplications() */ public Collection getApplications() { @@ -89,7 +92,7 @@ public class WebApplicationContext implements ApplicationContext, /** * Gets the application context for an HttpSession. - * + * * @param session * the HTTP session. * @return the application context for HttpSession. @@ -112,8 +115,8 @@ public class WebApplicationContext implements ApplicationContext, * Adds a transaction listener to this context. The transaction listener is * called before and after each each HTTP request related to this session * except when serving static resources. - * - * + * + * * @see com.vaadin.service.ApplicationContext#addTransactionListener(com.vaadin.service.ApplicationContext.TransactionListener) */ public void addTransactionListener(TransactionListener listener) { @@ -124,7 +127,7 @@ public class WebApplicationContext implements ApplicationContext, * Removes a transaction listener from this context. The transaction * listener is called before and after each each HTTP request related to * this session except when serving static resources. - * + * * @see com.vaadin.service.ApplicationContext#removeTransactionListener(com.vaadin.service.ApplicationContext.TransactionListener) */ public void removeTransactionListener(TransactionListener listener) { @@ -134,7 +137,7 @@ public class WebApplicationContext implements ApplicationContext, /** * Sends a notification that a transaction is starting. - * + * * @param application * The application associated with the transaction. * @param request @@ -151,7 +154,7 @@ public class WebApplicationContext implements ApplicationContext, /** * Sends a notification that a transaction has ended. - * + * * @param application * The application associated with the transaction. * @param request @@ -233,11 +236,11 @@ public class WebApplicationContext implements ApplicationContext, /** * Get the web browser associated with this application context. - * + * * Because application context is related to the http session and server * maintains one session per browser-instance, each context has exactly one * web browser associated with it. - * + * * @return */ public WebBrowser getBrowser() { @@ -246,10 +249,10 @@ public class WebApplicationContext implements ApplicationContext, /** * Gets communication manager for an application. - * + * * If this application has not been running before, a new manager is * created. - * + * * @param application * @return CommunicationManager */ -- 2.39.5