@@ -6,7 +6,7 @@ | |||
<portlet> | |||
<portlet-name>JSR286TestPortlet</portlet-name> | |||
<display-name>Vaadin Portlet 2.0 Test</display-name> | |||
<portlet-class>com.vaadin.server.ApplicationPortlet2</portlet-class> | |||
<portlet-class>com.vaadin.server.VaadinPortlet</portlet-class> | |||
<init-param> | |||
<name>application</name> | |||
<value>com.vaadin.tests.integration.JSR286PortletApplication</value> | |||
@@ -44,7 +44,7 @@ | |||
<portlet-name>Vaadin Liferay Theme Portlet</portlet-name> | |||
<display-name>Vaadin Liferay Theme</display-name> | |||
<portlet-class>com.vaadin.server.ApplicationPortlet2</portlet-class> | |||
<portlet-class>com.vaadin.server.VaadinPortlet</portlet-class> | |||
<init-param> | |||
<name>application</name> | |||
<value>com.vaadin.tests.integration.LiferayThemeDemo</value> |
@@ -1,50 +0,0 @@ | |||
/* | |||
* Copyright 2011 Vaadin Ltd. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | |||
* use this file except in compliance with the License. You may obtain a copy of | |||
* the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.server; | |||
import javax.portlet.PortletConfig; | |||
import javax.portlet.PortletException; | |||
import com.vaadin.Application; | |||
import com.vaadin.server.ServletPortletHelper.ApplicationClassException; | |||
/** | |||
* TODO Write documentation, fix JavaDoc tags. | |||
* | |||
* @author peholmst | |||
*/ | |||
public class ApplicationPortlet2 extends AbstractApplicationPortlet { | |||
private Class<? extends Application> applicationClass; | |||
@Override | |||
public void init(PortletConfig config) throws PortletException { | |||
super.init(config); | |||
try { | |||
applicationClass = ServletPortletHelper | |||
.getApplicationClass(getDeploymentConfiguration()); | |||
} catch (ApplicationClassException e) { | |||
throw new PortletException(e); | |||
} | |||
} | |||
@Override | |||
protected Class<? extends Application> getApplicationClass() { | |||
return applicationClass; | |||
} | |||
} |
@@ -254,7 +254,7 @@ public class PortletApplicationContext2 extends ApplicationContext { | |||
} | |||
/** | |||
* This is for use by {@link AbstractApplicationPortlet} only. | |||
* This is for use by {@link VaadinPortlet} only. | |||
* | |||
* TODO cleaner implementation, now "semi-static"! | |||
* |
@@ -97,8 +97,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { | |||
ResourceURL portletResourceUrl = getRenderResponse(context) | |||
.createResourceURL(); | |||
portletResourceUrl | |||
.setResourceID(AbstractApplicationPortlet.RESOURCE_URL_ID); | |||
portletResourceUrl.setResourceID(VaadinPortlet.RESOURCE_URL_ID); | |||
defaults.put(ApplicationConstants.PORTLET_RESOUCE_URL_BASE, | |||
portletResourceUrl.toString()); | |||
@@ -113,10 +112,9 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { | |||
throws JSONException, IOException { | |||
// fixed base theme to use - all portal pages with Vaadin | |||
// applications will load this exactly once | |||
String portalTheme = WrappedPortletRequest | |||
.cast(context.getRequest()) | |||
.getPortalProperty( | |||
AbstractApplicationPortlet.PORTAL_PARAMETER_VAADIN_THEME); | |||
String portalTheme = WrappedPortletRequest.cast( | |||
context.getRequest()).getPortalProperty( | |||
VaadinPortlet.PORTAL_PARAMETER_VAADIN_THEME); | |||
if (portalTheme != null | |||
&& !portalTheme.equals(context.getThemeName())) { | |||
String portalThemeUri = getThemeUri(context, portalTheme); | |||
@@ -133,8 +131,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { | |||
DeploymentConfiguration deploymentConfiguration = context | |||
.getRequest().getDeploymentConfiguration(); | |||
return deploymentConfiguration.getApplicationOrSystemProperty( | |||
AbstractApplicationPortlet.PORTLET_PARAMETER_STYLE, | |||
null); | |||
VaadinPortlet.PORTLET_PARAMETER_STYLE, null); | |||
} | |||
@Override | |||
@@ -164,8 +161,8 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { | |||
PortletContext portletContext = context.getPortletSession() | |||
.getPortletContext(); | |||
return portletContext.getResourceAsStream("/" | |||
+ AbstractApplicationPortlet.THEME_DIRECTORY_PATH + themeName | |||
+ "/" + resource); | |||
+ VaadinPortlet.THEME_DIRECTORY_PATH + themeName + "/" | |||
+ resource); | |||
} | |||
} |
@@ -55,6 +55,7 @@ import com.liferay.portal.kernel.util.PropsUtil; | |||
import com.vaadin.Application; | |||
import com.vaadin.Application.ApplicationStartEvent; | |||
import com.vaadin.server.AbstractCommunicationManager.Callback; | |||
import com.vaadin.server.ServletPortletHelper.ApplicationClassException; | |||
import com.vaadin.ui.UI; | |||
/** | |||
@@ -65,8 +66,8 @@ import com.vaadin.ui.UI; | |||
* | |||
* @author peholmst | |||
*/ | |||
public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
implements Constants { | |||
public class VaadinPortlet extends GenericPortlet implements | |||
Constants { | |||
public static final String RESOURCE_URL_ID = "APP"; | |||
@@ -174,10 +175,10 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
public static class AbstractApplicationPortletWrapper implements Callback { | |||
private final AbstractApplicationPortlet portlet; | |||
private final VaadinPortlet portlet; | |||
public AbstractApplicationPortletWrapper( | |||
AbstractApplicationPortlet portlet) { | |||
VaadinPortlet portlet) { | |||
this.portlet = portlet; | |||
} | |||
@@ -322,7 +323,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
@Override | |||
public SystemMessages getSystemMessages() { | |||
return AbstractApplicationPortlet.this.getSystemMessages(); | |||
return VaadinPortlet.this.getSystemMessages(); | |||
} | |||
}; | |||
@@ -892,8 +893,11 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
return null; | |||
} | |||
protected abstract Class<? extends Application> getApplicationClass() | |||
throws ClassNotFoundException; | |||
protected Class<? extends Application> getApplicationClass() | |||
throws ApplicationClassException { | |||
return ServletPortletHelper | |||
.getApplicationClass(getDeploymentConfiguration()); | |||
} | |||
protected Application getNewApplication(PortletRequest request) | |||
throws PortletException { | |||
@@ -904,7 +908,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
throw new PortletException("getNewApplication failed", e); | |||
} catch (final InstantiationException e) { | |||
throw new PortletException("getNewApplication failed", e); | |||
} catch (final ClassNotFoundException e) { | |||
} catch (final ApplicationClassException e) { | |||
throw new PortletException("getNewApplication failed", e); | |||
} | |||
} | |||
@@ -1035,7 +1039,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
} | |||
private static final Logger getLogger() { | |||
return Logger.getLogger(AbstractApplicationPortlet.class.getName()); | |||
return Logger.getLogger(VaadinPortlet.class.getName()); | |||
} | |||
} |
@@ -101,7 +101,7 @@ public class WrappedPortletRequest implements WrappedRequest { | |||
if (request instanceof ResourceRequest) { | |||
ResourceRequest resourceRequest = (ResourceRequest) request; | |||
String resourceID = resourceRequest.getResourceID(); | |||
if (AbstractApplicationPortlet.RESOURCE_URL_ID.equals(resourceID)) { | |||
if (VaadinPortlet.RESOURCE_URL_ID.equals(resourceID)) { | |||
String resourcePath = resourceRequest | |||
.getParameter(ApplicationConstants.V_RESOURCE_PATH); | |||
return resourcePath; |
@@ -40,8 +40,7 @@ public class TestClassesSerializable extends TestCase { | |||
"com\\.vaadin\\.event\\.FieldEvents", // | |||
"com\\.vaadin\\.event\\.LayoutEvents", // | |||
"com\\.vaadin\\.event\\.MouseEvents", // | |||
"com\\.vaadin\\.server\\.AbstractApplicationPortlet", // | |||
"com\\.vaadin\\.server\\.ApplicationPortlet2", // | |||
"com\\.vaadin\\.server\\.VaadinPortlet", // | |||
"com\\.vaadin\\.server\\.Constants", // | |||
"com\\.vaadin\\.util\\.SerializerHelper", // fully static | |||
// class level filtering, also affecting nested classes and |