JBoss Portal SVN: r6705 - in trunk/wsrp/src: resources/portal-wsrp-war and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-15 20:12:26 -0400 (Thu, 15 Mar 2007)
New Revision: 6705
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
trunk/wsrp/src/resources/portal-wsrp-war/style.css
Log:
- Started to add support for choosing between using WSDL or not.
- Buttons on editConsumer don't work for some reasons... and styling is messed up. :(
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-03-15 22:36:31 UTC (rev 6704)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-03-16 00:12:26 UTC (rev 6705)
@@ -27,6 +27,7 @@
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import javax.faces.context.FacesContext;
+import javax.faces.event.ValueChangeEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
@@ -40,6 +41,7 @@
{
private ConsumerRegistry registry;
private String selectedId;
+ private Boolean useWSDL = null;
public ConsumerRegistry getRegistry()
{
@@ -83,7 +85,7 @@
// todo: error message
}
- return null;
+ return listConsumers();
}
public String registerConsumer()
@@ -125,9 +127,25 @@
return "index";
}
+ public void useWSDLListener(ValueChangeEvent event)
+ {
+ useWSDL = (Boolean)event.getNewValue();
+ }
+
+ public boolean isUseWSDL()
+ {
+ if (useWSDL != null)
+ {
+ return useWSDL.booleanValue();
+ }
+
+ return getSelectedConsumer().getProducerInfo().getEndpointConfigurationInfo().usesWSDL();
+ }
+
private String refreshConsumerId()
{
selectedId = getParameter("id");
+ useWSDL = null;
return selectedId;
}
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-03-15 22:36:31 UTC (rev 6704)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-03-16 00:12:26 UTC (rev 6705)
@@ -24,38 +24,45 @@
<tr>
<th>Endpoint configuration:</th>
<td>
- <table border="0" class='portlet-table-body'>
- <tr>
- <th class="portlet-form-field-label">Service Description URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.serviceDescriptionURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">Markup URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.markupURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">Registration URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.registrationURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">Portlet Management URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.portletManagementURL}"/>
- </td>
- </tr>
- <tr>
- <th class="portlet-form-field-label">WSDL URL:</th>
- <td><h:inputText size="50"
- value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.wsdlDefinitionURL}"/>
- </td>
- </tr>
- </table>
+ <h:selectBooleanCheckbox value="#{consumersMgr.useWSDL}"
+ valueChangeListener="#{consumersMgr.useWSDLListener}"
+ onchange="submit()" immediate="true"/>Use WSDL?
+
+ <c:choose>
+ <c:when test="#{consumersMgr.useWSDL}">
+ <h:inputText size="70"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.wsdlDefinitionURL}"/>
+ </c:when>
+
+ <c:otherwise>
+ <table border="0" class='portlet-table-body'>
+ <tr>
+ <th>Service Description URL:</th>
+ <td><h:inputText size="70"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.serviceDescriptionURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Markup URL:</th>
+ <td><h:inputText size="70"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.markupURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Registration URL:</th>
+ <td><h:inputText size="70"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.registrationURL}"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Portlet Management URL:</th>
+ <td><h:inputText size="70"
+ value="#{consumersMgr.selectedConsumer.producerInfo.endpointConfigurationInfo.portletManagementURL}"/>
+ </td>
+ </tr>
+ </table>
+ </c:otherwise>
+ </c:choose>
</td>
</tr>
<tr>
@@ -67,19 +74,17 @@
<c:choose>
<c:when
test="#{!empty consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationPropertyNames}">
- <table border='1' cellspacing='0' class='portlet-table-body'>
+ <table border='1' cellspacing='0' class='registration-prop-table'>
<tr>
<th>Name</th>
<th>Value</th>
- <th>Description</th>
</tr>
<c:forEach
items="#{consumersMgr.selectedConsumer.producerInfo.registrationInfo.registrationProperties}"
var="prop">
- <tr>
- <td><h:inputText value="#{prop.name}"/></td>
- <td><h:inputText value="#{prop.value}"/></td>
- <td><h:outputText value="#{prop.description.label.value}"/></td>
+ <tr title="#{prop.description.label.value}">
+ <td><h:inputText value="#{prop.name}" size="40"/></td>
+ <td><h:inputText value="#{prop.value}" size="40"/></td>
</tr>
</c:forEach>
</table>
@@ -103,5 +108,22 @@
<hr/>
</h:form>
-<h:form><h:commandButton action="#{consumersMgr.listConsumers}" value="Back"/></h:form>
+<h:form>
+ <h:commandButton action="#{consumersMgr.listConsumers}" value="Back"/>
+ <h:commandButton action="#{consumersMgr.activateConsumer}"
+ value="#{consumersMgr.selectedConsumer.producerInfo.active ? 'Deactivate' : 'Activate'}">
+ <f:param name="id" value="#{consumersMgr.selectedConsumer.producerId}"/>
+ <f:param name="activate" value="#{!consumersMgr.selectedConsumer.producerInfo.active}"/>
+ </h:commandButton>
+ <c:if test="#{consumersMgr.selectedConsumer.producerInfo.active}">
+ <h:commandButton action="#{consumersMgr.registerConsumer}"
+ value="#{consumersMgr.selectedConsumer.producerInfo.registered ? 'Deregister' : 'Register'}">
+ <f:param name="id" value="#{consumersMgr.selectedConsumer.producerId}"/>
+ <f:param name="register" value="#{!consumersMgr.selectedConsumer.producerInfo.registered}"/>
+ </h:commandButton>
+ </c:if>
+ <h:commandButton action="#{consumersMgr.destroyConsumer}" value="Destroy">
+ <f:param name="id" value="#{consumersMgr.selectedConsumer.producerId}"/>
+ </h:commandButton>
+</h:form>
</div>
\ No newline at end of file
Modified: trunk/wsrp/src/resources/portal-wsrp-war/style.css
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/style.css 2007-03-15 22:36:31 UTC (rev 6704)
+++ trunk/wsrp/src/resources/portal-wsrp-war/style.css 2007-03-16 00:12:26 UTC (rev 6705)
@@ -28,11 +28,21 @@
padding-top: 2px;
}
-.active {
+.wsrp-consumers-ui .active {
background-color: #C7DDB7;
font-weight: bold;
}
-.inactive {
+.wsrp-consumers-ui .inactive {
background-color: #EBD1B8;
+}
+
+.wsrp-consumer-ui .registration-prop-table {
+ text-align: left;
+ border: 0;
+ border-collapse: separate;
+}
+
+.wsrp-consumer-ui .registration-prop-table th {
+ border: none;
}
\ No newline at end of file
19 years, 1 month
JBoss Portal SVN: r6704 - in trunk: common/src/main/org/jboss/portal/common/util and 28 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 18:36:31 -0400 (Thu, 15 Mar 2007)
New Revision: 6704
Added:
trunk/common/src/main/org/jboss/portal/common/util/ContentInfo.java
trunk/common/src/main/org/jboss/portal/common/util/MarkupInfo.java
trunk/common/src/main/org/jboss/portal/common/util/MediaType.java
Removed:
trunk/common/src/main/org/jboss/portal/common/MediaType.java
trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
trunk/core/src/main/org/jboss/portal/core/portlet/login/LoginPortlet.java
trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java
trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
trunk/server/src/main/org/jboss/portal/server/ServerRequest.java
trunk/server/src/main/org/jboss/portal/server/ServerResponse.java
trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java
trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java
trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java
trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestRenderSetMetaData.java
trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java
trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java
trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutStategyMetaDataFactory.java
trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/RenderSetMetaDataFactory.java
trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java
trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
trunk/theme/src/main/org/jboss/portal/theme/metadata/LayoutStrategyMetaData.java
trunk/theme/src/main/org/jboss/portal/theme/metadata/RendererSetMetaData.java
trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java
trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/strategy/LayoutStrategy.java
trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
Log:
- moved HTTPStreamInfo to common package
- renamed HTTPStreamInfo -> MarkupInfo
- added a superclass to MarkupInfo which is ContentInfo whichs holds the content type. MarkupInfo extends it and add a charset field
Deleted: trunk/common/src/main/org/jboss/portal/common/MediaType.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/MediaType.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/common/src/main/org/jboss/portal/common/MediaType.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -1,342 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.common;
-
-import javax.activation.MimeType;
-import javax.activation.MimeTypeParseException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This is a immutable wrapper to the activation MimeTpye.
- * <p>This class contains some extensions to the activation MimeType, such as the typesafe enum
- * pattern, and allows for a mime type to specify allowed sub types.</p>
- *
- * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
- * @version $LastChangedRevision$, $LastChangedDate$
- * @see javax.activation.MimeType
- * see also ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/
- */
-public final class MediaType
-{
- private static Map allowedTypes = new HashMap();
- private static Map supportedExtensions = new HashMap();
-
- /**
- * Mime type 'Any' maps to an accept mime type of '*.*' (used by IE for css, images, etc.)
- */
- public static final MediaType ANY =
- new MediaType("*", "*", new String[]{});
-
- /**
- * Mime type xhtml
- */
- public static final MediaType XHTML = new MediaType("application", "xhtml+xml",
- new String[]{"xhtml"});
-
- /**
- * Mime type html
- */
- public static final MediaType HTML = new MediaType("text", "html",
- new String[]{"html", "htm"},
- new MediaType[]{XHTML});
-
- /**
- * Mime type form (application/x-www-form-urlencoded)
- */
- public static final MediaType FORM =
- new MediaType("application", "x-www-form-urlencoded", new String[]{});
-
- /**
- * Mime type xml
- */
- public static final MediaType XML = new MediaType("text", "xml", new String[]{"xml"},
- new MediaType[]{XHTML});
-
- /**
- * Mime type wml
- */
- public static final MediaType WML = new MediaType("text", "vnd.wap.wml",
- new String[]{"wml"});
-
- /**
- * Mime type css
- */
- public static final MediaType CSS = new MediaType("text", "css",
- new String[]{"css"});
-
- /**
- * Mime type text
- */
- public static final MediaType TEXT = new MediaType("text", "plain",
- new String[]{"txt"});
-
- /**
- * Mime type js
- */
- public static final MediaType JS = new MediaType("text", "javascript",
- new String[]{"js"});
-
- /**
- * Mime type svg
- */
- public static final MediaType SVG = new MediaType("image", "svg+xml",
- new String[]{"svg"});
-
- /**
- * Mime type jpeg
- */
- public static final MediaType JPEG = new MediaType("image", "jpeg",
- new String[]{"jpeg", "jpg"});
-
- /**
- * Mime type gif
- */
- public static final MediaType GIF = new MediaType("image", "gif",
- new String[]{"gif"});
-
- /**
- * Mime type png
- */
- public static final MediaType PNG = new MediaType("image", "png",
- new String[]{"png"});
-
- /**
- * Mime type wbmp
- */
- public static final MediaType WBMP = new MediaType("image", "vnd.wap.wbmp",
- new String[]{"wbpm"});
-
- /**
- * Mime type rss
- */
- public static final MediaType RSS = new MediaType("application", "rss+xml",
- new String[]{});
-
- /**
- * Mime type ico (see http://filext.com/detaillist.php?extdetail=ICO)
- */
- public static final MediaType ICO = new MediaType("application", "octet-stream",
- new String[]{"ico"});
- private MimeType m_mimeType = null;
- private MediaType[] m_allowedSubTypes;
- private Set allowSubTypeSet;
-
- /**
- * Construct a mime type instance without any allowed subtypes.
- *
- * @param primaryType the primary type of the mime type (i.e. 'text')
- * @param subType the sub type of the mime type (i.e. 'html')
- */
- private MediaType(String primaryType, String subType, String[] extensions)
- {
- try
- {
- m_mimeType = new MimeType(primaryType, subType);
- m_allowedSubTypes = null;
- allowSubTypeSet = null;
- allowedTypes.put(m_mimeType.getBaseType(), this);
- for (int i = 0; i < extensions.length; i++)
- {
- supportedExtensions.put(extensions[i], this);
- }
- }
- catch (MimeTypeParseException e)
- {
- // +++TODO handle this , but where ?
- System.out.println(e.getMessage());
- }
- }
-
- /**
- * Construct a mime type with the provided allowed subtypes.
- *
- * @param primaryType the primary type of the mime type (i.e. 'text')
- * @param subType the sub type of the mime type (i.e. 'html')
- * @param allowedSubTypes an array of <code>MediaType</code>s to allow as valid subtypes of this type
- */
- private MediaType(String primaryType, String subType, String[] extensions, MediaType[] allowedSubTypes)
- {
- this(primaryType, subType, extensions);
- // only if the mime type was sucessfully created
- if (m_mimeType != null)
- {
- m_allowedSubTypes = allowedSubTypes;
- allowSubTypeSet = new HashSet(Arrays.asList(allowedSubTypes));
- }
- }
-
- /**
- * Get the mime type for the presented string, if the string contains a valid mime type.
- *
- * @param mimeType the <code>java.lang.String</code> to parse into a <code>RegistryMimeTpye</code>
- * @return the <code>RegistryMimeTpye</code> that matches with the presented string
- * @throws MimeTypeParseException if the presented mimetype is not supported
- * @throws IllegalArgumentException if the presented string is null or empty
- */
- public static MediaType parseMimeType(String mimeType) throws MimeTypeParseException
- {
- if (mimeType == null || "".equals(mimeType))
- {
- throw new IllegalArgumentException("no valid mime type provided");
- }
-
- String type = mimeType.trim().toLowerCase();
- if (allowedTypes.keySet().contains(type))
- {
- return (MediaType)allowedTypes.get(type);
- }
-
- throw new MimeTypeParseException("Type [" + mimeType + "] not supported");
- }
-
- /**
- * Get the mime type for the presented string.
- * <p>The string is handles as a file name extension. example: 'xml' returns MediaType.XML</p>
- *
- * @param extension the <code>java.lang.String</code> to parse into a <code>RegistryMimeTpye</code>
- * @return the <code>RegistryMimeTpye</code> that matches with the presented string
- * @throws MimeTypeParseException if the presented mimetype is not supported
- * @throws IllegalArgumentException if the presented string is null or empty
- */
- public static MediaType parseMimeTypeByExtension(String extension)
- throws MimeTypeParseException
- {
- if (extension == null || "".equals(extension))
- {
- throw new IllegalArgumentException("no valid mime type provided [" + extension + "]");
- }
-
- String ext = extension.trim().toLowerCase();
- if (supportedExtensions.keySet().contains(ext))
- {
- return (MediaType)supportedExtensions.get(ext);
- }
-
- throw new MimeTypeParseException("Extension [" + extension + "] not supported");
- }
-
- /**
- * Get a list of allowed sub types for the passed mime type.
- *
- * @param mimeType the <code>RegistryMimeTpye</code> to get the list of allowed subtypes for
- * @return a <code>java.util.List</code> of <code>PortalMimeTpye</code>s
- */
- public static List getAllowedSubTypes(MediaType mimeType)
- {
- if (mimeType.m_allowedSubTypes == null)
- {
- return Collections.EMPTY_LIST;
- }
- else
- {
- return Collections.unmodifiableList(Arrays.asList(mimeType.m_allowedSubTypes));
- }
- }
-
- /**
- * Get a list of allowed sub types for for this mime type.
- *
- * @return a <code>java.util.List</code> of <code>RegistryMimeTpye</code>s
- */
- public List getAllowedSubTypes()
- {
- if (m_allowedSubTypes == null)
- {
- return Collections.EMPTY_LIST;
- }
- else
- {
- return Collections.unmodifiableList(Arrays.asList(m_allowedSubTypes));
- }
- }
-
- /**
- * Return true if the allowed sub types contains the specified media type.
- *
- * @param other the sub type to test
- * @return true if it is an allowed sub type
- */
- public boolean isAllowedSubType(MediaType other)
- {
- if (equals(other))
- {
- return true;
- }
- if (allowSubTypeSet == null)
- {
- return false;
- }
- return allowSubTypeSet.contains(other);
- }
-
- /**
- * Get the String representation of the mime type (i.e. 'text/html').
- *
- * @return the mime type as a <code>java.lang.String</code>
- * @see java.lang.Object#toString
- */
- public String toString()
- {
- return m_mimeType.getBaseType();
- }
-
- /**
- * compare the parameter with this instance and see if they are equals.
- *
- * @param o the Object to compare this instance to
- * @return true if this and the paramters o are equal
- * @see java.lang.Object#equals
- */
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (!(o instanceof MediaType))
- {
- return false;
- }
-
- final MediaType type = (MediaType)o;
-
- return m_mimeType.equals(type.m_mimeType);
- }
-
- /**
- * Get the hascode for this mime type.
- *
- * @return an int value representing this instance
- * @see java.lang.Object#hashCode
- */
- public int hashCode()
- {
- return m_mimeType.hashCode();
- }
-}
Copied: trunk/common/src/main/org/jboss/portal/common/util/ContentInfo.java (from rev 6701, trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/ContentInfo.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/util/ContentInfo.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.util;
+
+/**
+ * Describe how content should be interpreted.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ContentInfo
+{
+
+ /** The content type. */
+ private final MediaType contentType;
+
+ public ContentInfo(MediaType contentType)
+ {
+ if (contentType == null)
+ {
+ throw new IllegalArgumentException("Content type cannot be null");
+ }
+ this.contentType = contentType;
+ }
+
+ public MediaType getContentType()
+ {
+ return contentType;
+ }
+}
Property changes on: trunk/common/src/main/org/jboss/portal/common/util/ContentInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/common/src/main/org/jboss/portal/common/util/MarkupInfo.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/MarkupInfo.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/util/MarkupInfo.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.util;
+
+/**
+ * Extends content to describe markup content.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MarkupInfo extends ContentInfo
+{
+
+ /** The charset. */
+ private final String charset;
+
+ public MarkupInfo(MediaType contentType, String charset)
+ {
+ super(contentType);
+
+ //
+ if (charset == null)
+ {
+ throw new IllegalArgumentException("Charset cannot be null");
+ }
+
+ //
+ this.charset = charset;
+ }
+
+ public String getCharset()
+ {
+ return charset;
+ }
+}
Copied: trunk/common/src/main/org/jboss/portal/common/util/MediaType.java (from rev 6701, trunk/common/src/main/org/jboss/portal/common/MediaType.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/MediaType.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/util/MediaType.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -0,0 +1,342 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.util;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This is a immutable wrapper to the activation MimeTpye.
+ * <p>This class contains some extensions to the activation MimeType, such as the typesafe enum
+ * pattern, and allows for a mime type to specify allowed sub types.</p>
+ *
+ * @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
+ * @version $LastChangedRevision$, $LastChangedDate$
+ * @see javax.activation.MimeType
+ * see also ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/
+ */
+public final class MediaType
+{
+ private static Map allowedTypes = new HashMap();
+ private static Map supportedExtensions = new HashMap();
+
+ /**
+ * Mime type 'Any' maps to an accept mime type of '*.*' (used by IE for css, images, etc.)
+ */
+ public static final MediaType ANY =
+ new MediaType("*", "*", new String[]{});
+
+ /**
+ * Mime type xhtml
+ */
+ public static final MediaType XHTML = new MediaType("application", "xhtml+xml",
+ new String[]{"xhtml"});
+
+ /**
+ * Mime type html
+ */
+ public static final MediaType HTML = new MediaType("text", "html",
+ new String[]{"html", "htm"},
+ new MediaType[]{XHTML});
+
+ /**
+ * Mime type form (application/x-www-form-urlencoded)
+ */
+ public static final MediaType FORM =
+ new MediaType("application", "x-www-form-urlencoded", new String[]{});
+
+ /**
+ * Mime type xml
+ */
+ public static final MediaType XML = new MediaType("text", "xml", new String[]{"xml"},
+ new MediaType[]{XHTML});
+
+ /**
+ * Mime type wml
+ */
+ public static final MediaType WML = new MediaType("text", "vnd.wap.wml",
+ new String[]{"wml"});
+
+ /**
+ * Mime type css
+ */
+ public static final MediaType CSS = new MediaType("text", "css",
+ new String[]{"css"});
+
+ /**
+ * Mime type text
+ */
+ public static final MediaType TEXT = new MediaType("text", "plain",
+ new String[]{"txt"});
+
+ /**
+ * Mime type js
+ */
+ public static final MediaType JS = new MediaType("text", "javascript",
+ new String[]{"js"});
+
+ /**
+ * Mime type svg
+ */
+ public static final MediaType SVG = new MediaType("image", "svg+xml",
+ new String[]{"svg"});
+
+ /**
+ * Mime type jpeg
+ */
+ public static final MediaType JPEG = new MediaType("image", "jpeg",
+ new String[]{"jpeg", "jpg"});
+
+ /**
+ * Mime type gif
+ */
+ public static final MediaType GIF = new MediaType("image", "gif",
+ new String[]{"gif"});
+
+ /**
+ * Mime type png
+ */
+ public static final MediaType PNG = new MediaType("image", "png",
+ new String[]{"png"});
+
+ /**
+ * Mime type wbmp
+ */
+ public static final MediaType WBMP = new MediaType("image", "vnd.wap.wbmp",
+ new String[]{"wbpm"});
+
+ /**
+ * Mime type rss
+ */
+ public static final MediaType RSS = new MediaType("application", "rss+xml",
+ new String[]{});
+
+ /**
+ * Mime type ico (see http://filext.com/detaillist.php?extdetail=ICO)
+ */
+ public static final MediaType ICO = new MediaType("application", "octet-stream",
+ new String[]{"ico"});
+ private MimeType m_mimeType = null;
+ private MediaType[] m_allowedSubTypes;
+ private Set allowSubTypeSet;
+
+ /**
+ * Construct a mime type instance without any allowed subtypes.
+ *
+ * @param primaryType the primary type of the mime type (i.e. 'text')
+ * @param subType the sub type of the mime type (i.e. 'html')
+ */
+ private MediaType(String primaryType, String subType, String[] extensions)
+ {
+ try
+ {
+ m_mimeType = new MimeType(primaryType, subType);
+ m_allowedSubTypes = null;
+ allowSubTypeSet = null;
+ allowedTypes.put(m_mimeType.getBaseType(), this);
+ for (int i = 0; i < extensions.length; i++)
+ {
+ supportedExtensions.put(extensions[i], this);
+ }
+ }
+ catch (MimeTypeParseException e)
+ {
+ // +++TODO handle this , but where ?
+ System.out.println(e.getMessage());
+ }
+ }
+
+ /**
+ * Construct a mime type with the provided allowed subtypes.
+ *
+ * @param primaryType the primary type of the mime type (i.e. 'text')
+ * @param subType the sub type of the mime type (i.e. 'html')
+ * @param allowedSubTypes an array of <code>MediaType</code>s to allow as valid subtypes of this type
+ */
+ private MediaType(String primaryType, String subType, String[] extensions, MediaType[] allowedSubTypes)
+ {
+ this(primaryType, subType, extensions);
+ // only if the mime type was sucessfully created
+ if (m_mimeType != null)
+ {
+ m_allowedSubTypes = allowedSubTypes;
+ allowSubTypeSet = new HashSet(Arrays.asList(allowedSubTypes));
+ }
+ }
+
+ /**
+ * Get the mime type for the presented string, if the string contains a valid mime type.
+ *
+ * @param mimeType the <code>java.lang.String</code> to parse into a <code>RegistryMimeTpye</code>
+ * @return the <code>RegistryMimeTpye</code> that matches with the presented string
+ * @throws MimeTypeParseException if the presented mimetype is not supported
+ * @throws IllegalArgumentException if the presented string is null or empty
+ */
+ public static MediaType parseMimeType(String mimeType) throws MimeTypeParseException
+ {
+ if (mimeType == null || "".equals(mimeType))
+ {
+ throw new IllegalArgumentException("no valid mime type provided");
+ }
+
+ String type = mimeType.trim().toLowerCase();
+ if (allowedTypes.keySet().contains(type))
+ {
+ return (MediaType)allowedTypes.get(type);
+ }
+
+ throw new MimeTypeParseException("Type [" + mimeType + "] not supported");
+ }
+
+ /**
+ * Get the mime type for the presented string.
+ * <p>The string is handles as a file name extension. example: 'xml' returns MediaType.XML</p>
+ *
+ * @param extension the <code>java.lang.String</code> to parse into a <code>RegistryMimeTpye</code>
+ * @return the <code>RegistryMimeTpye</code> that matches with the presented string
+ * @throws MimeTypeParseException if the presented mimetype is not supported
+ * @throws IllegalArgumentException if the presented string is null or empty
+ */
+ public static MediaType parseMimeTypeByExtension(String extension)
+ throws MimeTypeParseException
+ {
+ if (extension == null || "".equals(extension))
+ {
+ throw new IllegalArgumentException("no valid mime type provided [" + extension + "]");
+ }
+
+ String ext = extension.trim().toLowerCase();
+ if (supportedExtensions.keySet().contains(ext))
+ {
+ return (MediaType)supportedExtensions.get(ext);
+ }
+
+ throw new MimeTypeParseException("Extension [" + extension + "] not supported");
+ }
+
+ /**
+ * Get a list of allowed sub types for the passed mime type.
+ *
+ * @param mimeType the <code>RegistryMimeTpye</code> to get the list of allowed subtypes for
+ * @return a <code>java.util.List</code> of <code>PortalMimeTpye</code>s
+ */
+ public static List getAllowedSubTypes(MediaType mimeType)
+ {
+ if (mimeType.m_allowedSubTypes == null)
+ {
+ return Collections.EMPTY_LIST;
+ }
+ else
+ {
+ return Collections.unmodifiableList(Arrays.asList(mimeType.m_allowedSubTypes));
+ }
+ }
+
+ /**
+ * Get a list of allowed sub types for for this mime type.
+ *
+ * @return a <code>java.util.List</code> of <code>RegistryMimeTpye</code>s
+ */
+ public List getAllowedSubTypes()
+ {
+ if (m_allowedSubTypes == null)
+ {
+ return Collections.EMPTY_LIST;
+ }
+ else
+ {
+ return Collections.unmodifiableList(Arrays.asList(m_allowedSubTypes));
+ }
+ }
+
+ /**
+ * Return true if the allowed sub types contains the specified media type.
+ *
+ * @param other the sub type to test
+ * @return true if it is an allowed sub type
+ */
+ public boolean isAllowedSubType(MediaType other)
+ {
+ if (equals(other))
+ {
+ return true;
+ }
+ if (allowSubTypeSet == null)
+ {
+ return false;
+ }
+ return allowSubTypeSet.contains(other);
+ }
+
+ /**
+ * Get the String representation of the mime type (i.e. 'text/html').
+ *
+ * @return the mime type as a <code>java.lang.String</code>
+ * @see java.lang.Object#toString
+ */
+ public String toString()
+ {
+ return m_mimeType.getBaseType();
+ }
+
+ /**
+ * compare the parameter with this instance and see if they are equals.
+ *
+ * @param o the Object to compare this instance to
+ * @return true if this and the paramters o are equal
+ * @see java.lang.Object#equals
+ */
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (!(o instanceof MediaType))
+ {
+ return false;
+ }
+
+ final MediaType type = (MediaType)o;
+
+ return m_mimeType.equals(type.m_mimeType);
+ }
+
+ /**
+ * Get the hascode for this mime type.
+ *
+ * @return an int value representing this instance
+ * @see java.lang.Object#hashCode
+ */
+ public int hashCode()
+ {
+ return m_mimeType.hashCode();
+ }
+}
Property changes on: trunk/common/src/main/org/jboss/portal/common/util/MediaType.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -43,7 +43,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
@@ -97,7 +97,7 @@
PortletContextFactory cf,
InvokePortletCommandFactory cpc)
{
- HTTPStreamInfo streamInfo = controllerContext.getServerInvocation().getResponse().getStreamInfo();
+ MarkupInfo markupInfo = (MarkupInfo)controllerContext.getServerInvocation().getResponse().getContentInfo();
//
ActionContext ctx = new ControllerActionContext(
@@ -105,7 +105,7 @@
controllerContext,
mode, windowState,
navigationalState,
- streamInfo,
+ markupInfo,
interactionState,
form);
@@ -134,7 +134,7 @@
PortletContextFactory cf,
InvokePortletCommandFactory cpc)
{
- HTTPStreamInfo streamInfo = controllerContext.getServerInvocation().getResponse().getStreamInfo();
+ MarkupInfo markupInfo = (MarkupInfo)controllerContext.getServerInvocation().getResponse().getContentInfo();
//
RenderContext ctx = new ControllerRenderContext(
@@ -143,7 +143,7 @@
mode,
windowState,
navigationalState,
- streamInfo);
+ markupInfo);
//
RenderInvocation render = new RenderInvocation(ctx);
@@ -166,9 +166,9 @@
{
private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
- public ControllerActionContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, HTTPStreamInfo streamInfo, StateString interactionState, PortletParameters form)
+ public ControllerActionContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, MarkupInfo markupInfo, StateString interactionState, PortletParameters form)
{
- super(mode, windowState, navigationalState, streamInfo, interactionState, form);
+ super(mode, windowState, navigationalState, markupInfo, interactionState, form);
//
this.cmdFactory = cmdFactory;
@@ -198,9 +198,9 @@
{
private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
- public ControllerRenderContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, HTTPStreamInfo streamInfo)
+ public ControllerRenderContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, streamInfo);
+ super(mode, windowState, navigationalState, markupInfo);
//
this.cmdFactory = cmdFactory;
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/login/LoginPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/login/LoginPortlet.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/login/LoginPortlet.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -23,7 +23,7 @@
package org.jboss.portal.core.portlet.login;
import org.apache.log4j.Logger;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portlet.JBossPortlet;
import org.jboss.portlet.JBossRenderRequest;
import org.jboss.portlet.JBossRenderResponse;
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -31,7 +31,7 @@
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.common.util.LocalizedString;
import org.jboss.portal.common.util.IteratorStatus;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.MetaInfo;
Modified: trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -29,7 +29,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.ContentInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.server.impl.RequestAttributeResolver;
import org.jboss.portal.server.impl.PrincipalAttributeResolver;
import org.jboss.portal.server.impl.MapAttributeResolver;
@@ -51,10 +52,10 @@
Mode mode, WindowState
windowState,
StateString interactionState,
- HTTPStreamInfo streamInfo,
+ MarkupInfo markupInfo,
JSFInvocation invocation)
{
- super(mode, windowState, null, streamInfo, interactionState, null);
+ super(mode, windowState, null, markupInfo, interactionState, null);
//
this.invocation = invocation;
Modified: trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -42,11 +42,11 @@
import org.jboss.portal.portlet.impl.PortletRequestEncoder;
import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
import org.jboss.portal.common.text.FastURLEncoder;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.bridge.JBossServletContextProvider;
-import org.jboss.portal.common.http.HTTPStreamInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -148,7 +148,7 @@
mode,
windowState,
interactionState,
- new HTTPStreamInfo(MediaType.HTML, "UTF-8"),
+ new MarkupInfo(MediaType.HTML, "UTF-8"),
this);
//
@@ -169,7 +169,7 @@
mode,
windowState,
navState,
- new HTTPStreamInfo(MediaType.HTML, "UTF-8"),
+ new MarkupInfo(MediaType.HTML, "UTF-8"),
this);
//
Modified: trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -30,7 +30,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.impl.PrincipalAttributeResolver;
import org.jboss.portal.server.impl.RequestAttributeResolver;
@@ -52,10 +52,10 @@
Mode mode, WindowState
windowState,
PortletParameters navState,
- HTTPStreamInfo streamInfo,
+ MarkupInfo markupInfo,
JSFInvocation invocation)
{
- super(mode, windowState, navState != null ? new PortletParametersStateString(navState) : null, streamInfo);
+ super(mode, windowState, navState != null ? new PortletParametersStateString(navState) : null, markupInfo);
//
this.invocation = invocation;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -28,7 +28,7 @@
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.ContentInfo;
import java.util.HashSet;
import java.util.Iterator;
@@ -64,7 +64,7 @@
protected Set getModes(PortletInvocation invocation)
{
// Get content type
- HTTPStreamInfo si = invocation.getPortletContext().getStreamInfo();
+ ContentInfo si = invocation.getPortletContext().getMarkupInfo();
String contentType = si.getContentType().toString();
// Get the modes for this content type
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -431,7 +431,7 @@
public String getResponseContentType()
{
- return invocation.getPortletContext().getStreamInfo().getContentType().toString();
+ return invocation.getPortletContext().getMarkupInfo().getContentType().toString();
}
public Enumeration getResponseContentTypes()
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,13 +22,13 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
-import org.jboss.portal.common.http.HTTPStreamInfo;
import javax.activation.MimeTypeParseException;
import javax.portlet.PortletURL;
@@ -93,7 +93,7 @@
MediaType requestedMediaType = MediaType.parseMimeType(contentType);
// Get the response media type
- HTTPStreamInfo info = invocation.getPortletContext().getStreamInfo();
+ ContentInfo info = invocation.getPortletContext().getMarkupInfo();
MediaType responseMediaType = info.getContentType();
// Check if the requested media type is allowed as a subtype of the main response
@@ -145,7 +145,7 @@
public String getCharacterEncoding()
{
- return invocation.getPortletContext().getStreamInfo().getCharset();
+ return invocation.getPortletContext().getMarkupInfo().getCharset();
}
public Locale getLocale()
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -27,7 +27,7 @@
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import java.io.BufferedReader;
import java.io.IOException;
@@ -51,11 +51,11 @@
Mode mode,
WindowState windowState,
StateString navigationalState,
- HTTPStreamInfo streamInfo,
+ MarkupInfo markupInfo,
StateString interactionState,
PortletParameters form)
{
- super(mode, windowState, navigationalState, streamInfo);
+ super(mode, windowState, navigationalState, markupInfo);
this.interactionState = interactionState;
this.form = form;
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -24,7 +24,7 @@
import org.jboss.portal.common.invocation.AbstractInvocationContext;
import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.Mode;
@@ -43,7 +43,7 @@
{
/** . */
- protected HTTPStreamInfo streamInfo;
+ protected MarkupInfo markupInfo;
/** . */
protected Mode mode;
@@ -54,12 +54,12 @@
/** . */
protected StateString navigationalState;
- protected AbstractPortletInvocationContext(Mode mode, WindowState windowState, StateString navigationalState, HTTPStreamInfo streamInfo)
+ protected AbstractPortletInvocationContext(Mode mode, WindowState windowState, StateString navigationalState, MarkupInfo markupInfo)
{
this.mode = mode;
this.windowState = windowState;
this.navigationalState = navigationalState;
- this.streamInfo = streamInfo;
+ this.markupInfo = markupInfo;
}
/**
@@ -106,8 +106,8 @@
return navigationalState;
}
- public HTTPStreamInfo getStreamInfo()
+ public MarkupInfo getMarkupInfo()
{
- return streamInfo;
+ return markupInfo;
}
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -26,7 +26,8 @@
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.ContentInfo;
+import org.jboss.portal.common.util.MarkupInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -38,8 +39,8 @@
Mode mode,
WindowState windowState,
StateString navigationalState,
- HTTPStreamInfo streamInfo)
+ MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, streamInfo);
+ super(mode, windowState, navigationalState, markupInfo);
}
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -25,7 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.InvocationContext;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
@@ -63,7 +63,7 @@
*
* @return the stream info
*/
- HTTPStreamInfo getStreamInfo();
+ MarkupInfo getMarkupInfo();
/**
* <p>Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -25,7 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.AbstractInvocationContext;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
@@ -52,7 +52,7 @@
throw new UnsupportedOperationException();
}
- public HTTPStreamInfo getStreamInfo()
+ public MarkupInfo getMarkupInfo()
{
throw new UnsupportedOperationException();
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -28,6 +28,7 @@
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.URLTools;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.PortletParameters;
@@ -579,7 +580,7 @@
WindowState windowState,
Mode mode)
{
- super(mode, windowState, navigationalState, invocation.getResponse().getStreamInfo());
+ super(mode, windowState, navigationalState, (MarkupInfo)invocation.getResponse().getContentInfo());
//
this.portlet = portlet;
Deleted: trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.common.http;
-
-import org.jboss.portal.common.MediaType;
-
-/**
- * The info about how the content of an HTTP stream should be interpreted.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class HTTPStreamInfo
-{
- /** The content type. */
- private final MediaType contentType;
-
- /** The charset. */
- private final String charset;
-
- public HTTPStreamInfo(MediaType contentType, String charset)
- {
- if (contentType == null)
- {
- throw new IllegalArgumentException("Content type cannot be null");
- }
- if (charset == null)
- {
- throw new IllegalArgumentException("Charset cannot be null");
- }
- this.contentType = contentType;
- this.charset = charset;
- }
-
- public MediaType getContentType()
- {
- return contentType;
- }
-
- public String getCharset()
- {
- return charset;
- }
-}
Modified: trunk/server/src/main/org/jboss/portal/server/ServerRequest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerRequest.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/server/src/main/org/jboss/portal/server/ServerRequest.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -37,6 +37,7 @@
/** The server used during the request. */
protected Server server;
+ /** . */
protected ServerInvocationContext invocationContext;
public ServerRequest(ServerInvocationContext invocationContext)
Modified: trunk/server/src/main/org/jboss/portal/server/ServerResponse.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerResponse.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/server/src/main/org/jboss/portal/server/ServerResponse.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -24,7 +24,7 @@
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.ContentInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -40,7 +40,7 @@
protected ServerRequest req;
/** . */
- protected HTTPStreamInfo streamInfo;
+ protected ContentInfo contentInfo;
/** Indicate that the invocation requires a sign out of the current authenticated user. */
boolean wantSignOut;
@@ -54,14 +54,14 @@
this.invocationCtx = invocationCtx;
}
- public HTTPStreamInfo getStreamInfo()
+ public ContentInfo getContentInfo()
{
- return streamInfo;
+ return contentInfo;
}
- public void setStreamInfo(HTTPStreamInfo streamInfo)
+ public void setContentInfo(ContentInfo contentInfo)
{
- this.streamInfo = streamInfo;
+ this.contentInfo = contentInfo;
}
public boolean getWantSignOut()
Modified: trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,14 +22,15 @@
******************************************************************************/
package org.jboss.portal.server.aspects.server;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.util.ContentInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInterceptor;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerInvocationContext;
import org.jboss.portal.server.ServerResponse;
-import org.jboss.portal.common.http.HTTPStreamInfo;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
@@ -59,9 +60,9 @@
}
// Configure the stream info
- HTTPStreamInfo info = new HTTPStreamInfo(MediaType.HTML, "UTF-8");
+ ContentInfo info = new MarkupInfo(MediaType.HTML, "UTF-8");
ServerResponse resp = invocation.getResponse();
- resp.setStreamInfo(info);
+ resp.setContentInfo(info);
// Continue invocation
invocation.invokeNext();
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.theme;
import junit.framework.TestCase;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.theme.LayoutException;
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.theme.metadata;
import junit.framework.TestCase;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.theme.deployment.jboss.LayoutStategyMetaDataFactory;
import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
import org.jboss.xb.binding.JBossXBException;
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestRenderSetMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestRenderSetMetaData.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestRenderSetMetaData.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.theme.metadata;
import junit.framework.TestCase;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.theme.deployment.jboss.RenderSetMetaDataFactory;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
import org.jboss.portal.theme.metadata.RendererSetMetaData;
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,10 +22,10 @@
package org.jboss.portal.test.theme.render;
import junit.framework.TestCase;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.server.ServerRequest;
import org.jboss.portal.test.theme.TestHelper;
import org.jboss.portal.theme.LayoutService;
@@ -135,7 +135,7 @@
portalProps.put(ThemeConstants.PORTAL_PROP_RENDERSET, renderSet.getName());
//
- HTTPStreamInfo streamInfo = new HTTPStreamInfo(MediaType.HTML, "utf-8");
+ MarkupInfo streamInfo = new MarkupInfo(MediaType.HTML, "utf-8");
ServerRequest serverRequest = TestHelper.createServerRequest();
// pageresult obj
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -25,8 +25,8 @@
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.server.ServerRequest;
import org.jboss.portal.theme.LayoutConstants;
import org.jboss.portal.theme.LayoutDispatcher;
@@ -154,7 +154,7 @@
portalProps.put(ThemeConstants.PORTAL_PROP_RENDERSET, renderSet.getName());
//
- HTTPStreamInfo streamInfo = new HTTPStreamInfo(MediaType.HTML, "utf-8");
+ MarkupInfo markupInfo = new MarkupInfo(MediaType.HTML, "utf-8");
ServerRequest serverRequest = new ServerRequest(null);
// pageresult obj
@@ -177,7 +177,7 @@
}
// set the renderctx and req/res attr
- RenderContext renderCtx = new RenderContext(layout, streamInfo, pageResult, serverRequest);
+ RenderContext renderCtx = new RenderContext(layout, markupInfo, pageResult, serverRequest);
httpServletResponse.setContentType(renderCtx.getContentType().toString());
httpServletResponse.setCharacterEncoding(renderCtx.getCharset());
httpServletRequest.setAttribute(LayoutConstants.ATTR_RENDERCONTEXT, renderCtx);
Modified: trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -23,8 +23,8 @@
package org.jboss.portal.theme;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.theme.render.PortalRenderSet;
import org.jboss.portal.theme.strategy.LayoutStrategy;
import org.jboss.portal.theme.page.PageResult;
@@ -119,5 +119,5 @@
*/
Collection getRenderSets();
- PortalRenderSet getRenderSet(LayoutInfo info, HTTPStreamInfo streamInfo, PageResult result);
+ PortalRenderSet getRenderSet(LayoutInfo info, ContentInfo streamInfo, PageResult result);
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -24,7 +24,8 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.ContentInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.page.PageResult;
@@ -95,13 +96,13 @@
/**
* Create a new render context for this request and layout
*
- * @param streamInfo the information about the content type and encoding this layout should produce
+ * @param markupInfo the information about the content type and encoding this layout should produce
* @param request the current server request
* @param markupResult the result of the portlet render process
* @return a new render context
*/
- public RenderContext getRenderContext(HTTPStreamInfo streamInfo, ServerRequest request, PageResult markupResult)
+ public RenderContext getRenderContext(MarkupInfo markupInfo, ServerRequest request, PageResult markupResult)
{
- return new RenderContext(this, streamInfo, markupResult, request);
+ return new RenderContext(this, markupInfo, markupResult, request);
}
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutStategyMetaDataFactory.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutStategyMetaDataFactory.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/LayoutStategyMetaDataFactory.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.theme.deployment.jboss;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
Modified: trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/RenderSetMetaDataFactory.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/RenderSetMetaDataFactory.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/deployment/jboss/RenderSetMetaDataFactory.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.theme.deployment.jboss;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.theme.metadata.RenderSetMetaData;
import org.jboss.portal.theme.metadata.RendererSetMetaData;
import org.jboss.xb.binding.ObjectModelFactory;
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/JSPLayout.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -28,6 +28,7 @@
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.page.PageResult;
import org.jboss.portal.theme.render.RenderContext;
+import org.jboss.portal.common.util.MarkupInfo;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -49,7 +50,7 @@
{
HttpServletRequest httpRequest = invocation.getServerContext().getClientRequest();
HttpServletResponse httpResponse = invocation.getServerContext().getClientResponse();
- RenderContext renderCtx = getRenderContext(invocation.getResponse().getStreamInfo(), invocation.getRequest(), markupResult);
+ RenderContext renderCtx = getRenderContext((MarkupInfo)invocation.getResponse().getContentInfo(), invocation.getRequest(), markupResult);
LayoutDispatcher dispatcher = new LayoutDispatcher(renderCtx, httpRequest, httpResponse, markupResult);
dispatcher.include();
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -23,9 +23,9 @@
package org.jboss.portal.theme.impl;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.theme.LayoutException;
import org.jboss.portal.theme.LayoutInfo;
import org.jboss.portal.theme.LayoutService;
@@ -355,7 +355,7 @@
}
}
- /** @see LayoutService#getStrategy(String,org.jboss.portal.common.MediaType) */
+ /** @see LayoutService#getStrategy(String,org.jboss.portal.common.util.MediaType) */
public LayoutStrategy getStrategy(String strategyName, MediaType mediaType)
{
ServerRegistrationID id;
@@ -433,7 +433,7 @@
}
}
- /** @see LayoutService#getRenderSet(String,org.jboss.portal.common.MediaType) */
+ /** @see LayoutService#getRenderSet(String,org.jboss.portal.common.util.MediaType) */
public PortalRenderSet getRenderSet(String renderSetName, MediaType mediaType)
{
ServerRegistrationID id;
@@ -515,7 +515,7 @@
* @param result
* @return a renderSet to decorate the markup fragments on the page with
*/
- public PortalRenderSet getRenderSet(LayoutInfo info, HTTPStreamInfo streamInfo, PageResult result)
+ public PortalRenderSet getRenderSet(LayoutInfo info, ContentInfo streamInfo, PageResult result)
{
if (info == null || result == null || streamInfo == null)
{
Modified: trunk/theme/src/main/org/jboss/portal/theme/metadata/LayoutStrategyMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/metadata/LayoutStrategyMetaData.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/metadata/LayoutStrategyMetaData.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.theme.metadata;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
/**
* Meta data describing a single layout strategy as provided in the portal-layouts.xml descriptor.
Modified: trunk/theme/src/main/org/jboss/portal/theme/metadata/RendererSetMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/metadata/RendererSetMetaData.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/metadata/RendererSetMetaData.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.theme.metadata;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
/**
* Meta data describing a render set.
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.theme.render;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.theme.RuntimeContext;
import org.jboss.portal.theme.ServerRegistrationID;
import org.jboss.portal.theme.impl.render.dynamic.DynaDecorationRenderer;
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.theme.render;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.server.ServerRequest;
import org.jboss.portal.theme.LayoutInfo;
import org.jboss.portal.theme.PortalLayout;
@@ -59,12 +59,12 @@
private StringBuffer markup;
private Object fragment;
- private HTTPStreamInfo streamInfo;
+ private MarkupInfo markupInfo;
// initialize
- private void init(PortalLayout layout, Object fragment, HTTPStreamInfo streamInfo, PageResult result, ServerRequest request)
+ private void init(PortalLayout layout, Object fragment, MarkupInfo markupInfo, PageResult result, ServerRequest request)
{
- this.renderSet = layout.getServiceInfo().getRenderSet(layout.getLayoutInfo(), streamInfo, result);
+ this.renderSet = layout.getServiceInfo().getRenderSet(layout.getLayoutInfo(), markupInfo, result);
if (renderSet == null)
{
throw new IllegalStateException("No RenderSet determined");
@@ -76,7 +76,7 @@
this.pageResult = result;
this.request = request;
this.fragment = fragment;
- this.streamInfo = streamInfo;
+ this.markupInfo = markupInfo;
if (fragment != null && fragment instanceof Region)
{
@@ -90,7 +90,7 @@
}
}
- private RenderContext(PortalLayout layout, Object markupContainer, HTTPStreamInfo streamInfo, PageResult result, ServerRequest request)
+ private RenderContext(PortalLayout layout, Object markupContainer, MarkupInfo streamInfo, PageResult result, ServerRequest request)
{
init(layout, markupContainer, streamInfo, result, request);
}
@@ -100,17 +100,17 @@
* (page, region , window context) to render.</p>
*
* @param layout the layout that is used for this render context
- * @param streamInfo information about the content type and encoding to use when writing the response
+ * @param markupInfo information about the content type and encoding to use when writing the response
* @param result the rendered result(s) from the portlet container (PageResult, RegionResult, WindowResult)
* @param request the current server request
*/
- public RenderContext(PortalLayout layout, HTTPStreamInfo streamInfo, PageResult result, ServerRequest request)
+ public RenderContext(PortalLayout layout, MarkupInfo markupInfo, PageResult result, ServerRequest request)
{
if (layout == null)
{
throw new IllegalArgumentException("no layout provided");
}
- if (streamInfo == null)
+ if (markupInfo == null)
{
throw new IllegalArgumentException("no stream info provided");
}
@@ -124,7 +124,7 @@
}
// context for the entire page
- init(layout, null, streamInfo, result, request);
+ init(layout, null, markupInfo, result, request);
}
/**
@@ -139,7 +139,7 @@
*/
public RenderContext getContext(Region region, String cssId, RegionOrientation orientation)
{
- RenderContext context = new RenderContext(this.layout, region, this.streamInfo, this.pageResult, this.request);
+ RenderContext context = new RenderContext(this.layout, region, this.markupInfo, this.pageResult, this.request);
if (cssId != null)
{
context.regionCssId = cssId;
@@ -160,7 +160,7 @@
*/
public RenderContext getContext(WindowContext windowContext)
{
- return new RenderContext(layout, windowContext, streamInfo, pageResult, request);
+ return new RenderContext(layout, windowContext, markupInfo, pageResult, request);
}
/** @return a markup fragment */
@@ -172,13 +172,13 @@
/** @return the content type */
public MediaType getContentType()
{
- return streamInfo.getContentType();
+ return markupInfo.getContentType();
}
/** @return the encoding to use when writing to the output */
public String getCharset()
{
- return streamInfo.getCharset();
+ return markupInfo.getCharset();
}
/** @return the region orientation */
@@ -213,7 +213,7 @@
return getRegionRenderer();
}
- PortalRenderSet renderSet = layout.getServiceInfo().getRenderSet(renderSetName, streamInfo.getContentType());
+ PortalRenderSet renderSet = layout.getServiceInfo().getRenderSet(renderSetName, markupInfo.getContentType());
if (renderSet != null)
{
@@ -253,7 +253,7 @@
if (renderSetName != null)
{
- PortalRenderSet renderSet = layout.getServiceInfo().getRenderSet(renderSetName, streamInfo.getContentType());
+ PortalRenderSet renderSet = layout.getServiceInfo().getRenderSet(renderSetName, markupInfo.getContentType());
if (renderSet != null)
{
@@ -295,7 +295,7 @@
if (renderSetName != null)
{
- PortalRenderSet renderSet = layout.getServiceInfo().getRenderSet(renderSetName, streamInfo.getContentType());
+ PortalRenderSet renderSet = layout.getServiceInfo().getRenderSet(renderSetName, markupInfo.getContentType());
if (renderSet != null)
{
@@ -341,7 +341,7 @@
if (renderSetName != null)
{
- PortalRenderSet renderSet = layout.getServiceInfo().getRenderSet(renderSetName, streamInfo.getContentType());
+ PortalRenderSet renderSet = layout.getServiceInfo().getRenderSet(renderSetName, markupInfo.getContentType());
if (renderSet != null)
{
Modified: trunk/theme/src/main/org/jboss/portal/theme/strategy/LayoutStrategy.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/strategy/LayoutStrategy.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/strategy/LayoutStrategy.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.theme.strategy;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.theme.RuntimeContext;
import org.jboss.portal.theme.ServerRegistrationID;
import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
Modified: trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -25,8 +25,8 @@
import org.jboss.logging.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.theme.navigation.WindowNavigationalState;
import org.jboss.portal.theme.page.WindowContext;
@@ -57,18 +57,18 @@
private final HttpServletRequest httpRequest;
private final Set supportedWindowStates;
private final Set supportedPortletModes;
- private final HTTPStreamInfo streamInfo;
+ private final MarkupInfo markupInfo;
private final List localWindowContexts;
private final AttributeResolver navigationalStateContext;
public StrategyContext(AttributeResolver navCtx,
- HttpServletRequest httpRequest, HTTPStreamInfo streamInfo,
+ HttpServletRequest httpRequest, MarkupInfo markupInfo,
Set windowStates, Set portletModes, List regionNames)
{
this.httpRequest = httpRequest;
this.supportedWindowStates = windowStates;
this.supportedPortletModes = portletModes;
- this.streamInfo = streamInfo;
+ this.markupInfo = markupInfo;
this.navigationalStateContext = navCtx;
this.localWindowContexts = new ArrayList();
}
@@ -85,12 +85,12 @@
public MediaType getMediaType()
{
- return streamInfo.getContentType();
+ return markupInfo.getContentType();
}
public String getCharSet()
{
- return streamInfo.getCharset();
+ return markupInfo.getCharset();
}
public boolean isSupportedWindowState(WindowState state)
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -25,7 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
@@ -35,7 +35,7 @@
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.server.impl.RequestAttributeResolver;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.wsrp.WSRPConstants;
import javax.servlet.http.HttpServletRequest;
@@ -64,7 +64,7 @@
mode != null ? mode : Mode.VIEW,
state != null ? state : WindowState.MAXIMIZED,
StateString.createFrom(ns),
- new HTTPStreamInfo(MediaType.HTML, WSRPConstants.DEFAULT_CHARACTER_SET));
+ new MarkupInfo(MediaType.HTML, WSRPConstants.DEFAULT_CHARACTER_SET));
ClassLoader classLoader = getClass().getClassLoader();
HttpSession session = (HttpSession)Proxy.newProxyInstance(classLoader, new Class[]{HttpSession.class},
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -26,7 +26,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.URLTools;
import javax.activation.MimeTypeParseException;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -25,7 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
@@ -83,7 +83,7 @@
ParameterValidation.throwIllegalArgExceptionIfNull(userContext, USER_CONTEXT);
PortletInvocationContext context = invocation.getPortletContext();
ParameterValidation.throwIllegalArgExceptionIfNull(context, INVOCATION_CONTEXT);
- HTTPStreamInfo streamInfo = context.getStreamInfo();
+ ContentInfo streamInfo = context.getMarkupInfo();
ParameterValidation.throwIllegalArgExceptionIfNull(streamInfo, STREAM_INFO);
String mode;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -33,7 +33,7 @@
import org.jboss.portal.portlet.spi.SecurityContext;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.wsrp.servlet.ServletAccess;
import javax.servlet.ServletRequest;
@@ -56,12 +56,12 @@
private StateString interactionState;
public WSRPActionContext(StateString navigationalState,
- SecurityContext securityContext, HTTPStreamInfo streamInfo, PortalContext portalContext,
+ SecurityContext securityContext, MarkupInfo markupInfo, PortalContext portalContext,
UserContext userContext, InstanceContext instanceContext, WindowContext windowContext,
Mode mode, WindowState windowState, StateString interactionState,
PortletParameters formParameters, String characterEncoding, String contentType)
{
- super(navigationalState, securityContext, streamInfo, portalContext, userContext, instanceContext,
+ super(navigationalState, securityContext, markupInfo, portalContext, userContext, instanceContext,
windowContext, mode, windowState);
this.formParameters = formParameters;
this.request = ServletAccess.getRequest();
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -26,6 +26,8 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
import org.jboss.portal.common.util.URLTools;
+import org.jboss.portal.common.util.ContentInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
@@ -39,7 +41,6 @@
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.impl.RequestAttributeResolver;
-import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.wsrp.WSRPPortletURL;
import org.jboss.portal.wsrp.WSRPRewritingConstants;
import org.jboss.portal.wsrp.servlet.ServletAccess;
@@ -69,13 +70,13 @@
private static final String EQ_TRUE = "=true";
public WSRPPortletInvocationContext(StateString navigationalState, SecurityContext securityContext,
- HTTPStreamInfo streamInfo, PortalContext portalContext, UserContext userContext,
+ MarkupInfo markupInfo, PortalContext portalContext, UserContext userContext,
InstanceContext instanceContext, WindowContext windowContext, Mode mode, WindowState windowState)
{
- super(mode, windowState, navigationalState, streamInfo);
+ super(mode, windowState, navigationalState, markupInfo);
this.securityContext = securityContext;
- this.streamInfo = streamInfo;
+ this.markupInfo = markupInfo;
this.portalContext = portalContext;
this.userContext = userContext;
this.instanceContext = instanceContext;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -24,7 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.spi.PortalContext;
@@ -41,10 +41,10 @@
{
public WSRPRenderContext(StateString navigationalState, SecurityContext securityContext,
- HTTPStreamInfo streamInfo, PortalContext portalContext, UserContext userContext,
+ MarkupInfo markupInfo, PortalContext portalContext, UserContext userContext,
InstanceContext instanceContext, WindowContext windowContext, Mode mode, WindowState windowState)
{
- super(navigationalState, securityContext, streamInfo, portalContext, userContext, instanceContext,
+ super(navigationalState, securityContext, markupInfo, portalContext, userContext, instanceContext,
windowContext, mode, windowState);
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -34,7 +34,8 @@
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.ContentInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.InteractionParams;
@@ -116,7 +117,7 @@
}
void initInvocation(StateString navigationalState, SecurityContext securityContext,
- HTTPStreamInfo streamInfo, PortalContext portalContext,
+ MarkupInfo markupInfo, PortalContext portalContext,
UserContext userContext,
WindowContext windowContext
)
@@ -156,7 +157,7 @@
StateString interactionState = createNavigationalState(interactionParams.getInteractionState());
- WSRPActionContext actionContext = new WSRPActionContext(navigationalState, securityContext, streamInfo,
+ WSRPActionContext actionContext = new WSRPActionContext(navigationalState, securityContext, markupInfo,
portalContext, userContext, instanceContext, windowContext,
WSRPUtils.getJSR168PortletModeFromWSRPName(markupRequest.getMode()),
WSRPUtils.getJSR168WindowStateFromWSRPName(markupRequest.getWindowState()), interactionState, parameters,
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -24,7 +24,7 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.info.CacheInfo;
@@ -111,12 +111,12 @@
}
void initInvocation(StateString navigationalState, SecurityContext securityContext,
- HTTPStreamInfo streamInfo, PortalContext portalContext,
+ MarkupInfo markupInfo, PortalContext portalContext,
UserContext userContext,
WindowContext windowContext
)
{
- WSRPRenderContext renderContext = new WSRPRenderContext(navigationalState, securityContext, streamInfo,
+ WSRPRenderContext renderContext = new WSRPRenderContext(navigationalState, securityContext, markupInfo,
portalContext, userContext, instanceContext, windowContext,
WSRPUtils.getJSR168PortletModeFromWSRPName(markupRequest.getMode()),
WSRPUtils.getJSR168WindowStateFromWSRPName(markupRequest.getWindowState()));
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-03-15 21:51:04 UTC (rev 6703)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-03-15 22:36:31 UTC (rev 6704)
@@ -23,9 +23,9 @@
package org.jboss.portal.wsrp.producer;
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.http.HTTPStreamInfo;
+import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -135,7 +135,7 @@
checkUserContext(wsrpUserContext);
SecurityContext securityContext = createSecurityContext(params, runtimeContext, wsrpUserContext);
- HTTPStreamInfo streamInfo = createStreamInfo(markupRequest);
+ MarkupInfo streamInfo = createStreamInfo(markupRequest);
PortalContext portalContext = createPortalContext(params, markupRequest);
UserContext userContext = createUserContext(wsrpUserContext, markupRequest.getLocale(), desiredLocales);
instanceContext = createInstanceContext(portletContext, getAccessMode());
@@ -160,7 +160,7 @@
abstract AccessMode getAccessMode() throws MissingParametersFault;
abstract void initInvocation(StateString navigationalState, SecurityContext securityContext,
- HTTPStreamInfo streamInfo, PortalContext portalContext, UserContext userContext,
+ MarkupInfo markupInfo, PortalContext portalContext, UserContext userContext,
WindowContext windowContext);
abstract Object processResponse(PortletInvocationResponse response);
@@ -383,19 +383,19 @@
};
}
- private HTTPStreamInfo createStreamInfo(MarkupRequest markupRequest)
+ private MarkupInfo createStreamInfo(MarkupRequest markupRequest)
throws UnsupportedMimeTypeFault
{
- HTTPStreamInfo streamInfo;
+ MarkupInfo markupInfo;
try
{
- streamInfo = new HTTPStreamInfo(MediaType.parseMimeType(markupRequest.getMimeType()), markupRequest.getCharacterSet());
+ markupInfo = new MarkupInfo(MediaType.parseMimeType(markupRequest.getMimeType()), markupRequest.getCharacterSet());
}
catch (MimeTypeParseException e)
{
throw (UnsupportedMimeTypeFault)WSRPUtils.createFaultFrom(UnsupportedMimeTypeFault.class, e);
}
- return streamInfo;
+ return markupInfo;
}
// fix-me: check that the correct semantics is used.
19 years, 1 month
JBoss Portal SVN: r6703 - in trunk/wsrp/src/resources/portal-wsrp-war: WEB-INF/jsf/consumers and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-15 17:51:04 -0400 (Thu, 15 Mar 2007)
New Revision: 6703
Modified:
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml
trunk/wsrp/src/resources/portal-wsrp-war/style.css
Log:
- Now highlight consumers based on activation status.
- Removed footer.
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-03-15 21:36:24 UTC (rev 6702)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsf/consumers/consumers.xhtml 2007-03-15 21:51:04 UTC (rev 6703)
@@ -11,25 +11,26 @@
<h:form>
<table width="100%" class="portlet-table-body">
- <thead class="portlet-table-header">
- <tr>
+ <thead>
+ <tr class="portlet-table-header">
<th>Consumer</th>
<th>Actions</th>
</tr>
- </thead>
- <tfoot class="portlet-table-footer">
<tr>
- <th>Consumer</th>
- <th>Actions</th>
+ <td colspan="2">Legend:
+ <span class="active">active</span>
+ <span class="inactive">inactive</span>
+ </td>
</tr>
- </tfoot>
+ </thead>
<tbody>
- <c:forEach items="#{consumersMgr.consumers}" var="consumer" varStatus="status">
- <tr class="status.index % 2 == 0 ? 'portlet-table-body' : 'portlet-table-alternate'">
+ <c:forEach items="#{consumersMgr.consumers}" var="consumer">
+ <tr class="#{consumer.producerInfo.active ? 'active' : 'inactive'}">
<td>
<h:commandLink action="#{consumersMgr.configureConsumer}">
<f:param name="id" value="#{consumer.producerId}"/>
- <h:outputText value="#{consumer.producerId}"/>
+ <h:outputText
+ value="#{consumer.producerId} (#{consumer.producerInfo.active ? 'active' : 'inactive'})"/>
</h:commandLink>
</td>
<td>
Modified: trunk/wsrp/src/resources/portal-wsrp-war/style.css
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/style.css 2007-03-15 21:36:24 UTC (rev 6702)
+++ trunk/wsrp/src/resources/portal-wsrp-war/style.css 2007-03-15 21:51:04 UTC (rev 6703)
@@ -26,4 +26,13 @@
border: 0;
padding-bottom: 2px;
padding-top: 2px;
+}
+
+.active {
+ background-color: #C7DDB7;
+ font-weight: bold;
+}
+
+.inactive {
+ background-color: #EBD1B8;
}
\ No newline at end of file
19 years, 1 month
JBoss Portal SVN: r6701 - in trunk: faces/src/main/org/jboss/portal/faces/component/portlet and 22 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 17:34:02 -0400 (Thu, 15 Mar 2007)
New Revision: 6701
Added:
trunk/server/src/main/org/jboss/portal/common/
trunk/server/src/main/org/jboss/portal/common/http/
trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java
Removed:
trunk/server/src/main/org/jboss/portal/server/util/HTTPStreamInfo.java
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java
trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java
trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
trunk/server/src/main/org/jboss/portal/server/ServerResponse.java
trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java
trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java
trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java
trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
Log:
moved HTTPStreamInfo to the common package
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -43,7 +43,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
Modified: trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -29,7 +29,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.server.impl.RequestAttributeResolver;
import org.jboss.portal.server.impl.PrincipalAttributeResolver;
import org.jboss.portal.server.impl.MapAttributeResolver;
Modified: trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -46,7 +46,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.bridge.JBossServletContextProvider;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Modified: trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -24,14 +24,13 @@
import org.jboss.portal.portlet.impl.spi.AbstractRenderContext;
import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.impl.PrincipalAttributeResolver;
import org.jboss.portal.server.impl.RequestAttributeResolver;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ModesInterceptor.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -28,7 +28,7 @@
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import java.util.HashSet;
import java.util.Iterator;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -28,7 +28,7 @@
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import javax.activation.MimeTypeParseException;
import javax.portlet.PortletURL;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -27,7 +27,7 @@
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import java.io.BufferedReader;
import java.io.IOException;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -24,11 +24,11 @@
import org.jboss.portal.common.invocation.AbstractInvocationContext;
import org.jboss.portal.common.util.URLTools;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.server.util.HTTPStreamInfo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -26,7 +26,7 @@
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -34,7 +34,6 @@
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.server.ServerInvocation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -25,9 +25,9 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.InvocationContext;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.server.util.HTTPStreamInfo;
/**
* Contract that defines what input/services the caller of a portlet container must provide.
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -25,10 +25,10 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.AbstractInvocationContext;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.server.util.HTTPStreamInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Copied: trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java (from rev 6697, trunk/server/src/main/org/jboss/portal/server/util/HTTPStreamInfo.java)
===================================================================
--- trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java (rev 0)
+++ trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.common.http;
+
+import org.jboss.portal.common.MediaType;
+
+/**
+ * The info about how the content of an HTTP stream should be interpreted.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class HTTPStreamInfo
+{
+ /** The content type. */
+ private final MediaType contentType;
+
+ /** The charset. */
+ private final String charset;
+
+ public HTTPStreamInfo(MediaType contentType, String charset)
+ {
+ if (contentType == null)
+ {
+ throw new IllegalArgumentException("Content type cannot be null");
+ }
+ if (charset == null)
+ {
+ throw new IllegalArgumentException("Charset cannot be null");
+ }
+ this.contentType = contentType;
+ this.charset = charset;
+ }
+
+ public MediaType getContentType()
+ {
+ return contentType;
+ }
+
+ public String getCharset()
+ {
+ return charset;
+ }
+}
Property changes on: trunk/server/src/main/org/jboss/portal/common/http/HTTPStreamInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/server/src/main/org/jboss/portal/server/ServerResponse.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerResponse.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/server/src/main/org/jboss/portal/server/ServerResponse.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -24,7 +24,7 @@
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/server/src/main/org/jboss/portal/server/aspects/server/ContentTypeInterceptor.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -29,7 +29,7 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerInvocationContext;
import org.jboss.portal.server.ServerResponse;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
Deleted: trunk/server/src/main/org/jboss/portal/server/util/HTTPStreamInfo.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/util/HTTPStreamInfo.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/server/src/main/org/jboss/portal/server/util/HTTPStreamInfo.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.server.util;
-
-import org.jboss.portal.common.MediaType;
-
-/**
- * The info about how the content of an HTTP stream should be interpreted.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class HTTPStreamInfo
-{
- /** The content type. */
- private final MediaType contentType;
-
- /** The charset. */
- private final String charset;
-
- public HTTPStreamInfo(MediaType contentType, String charset)
- {
- if (contentType == null)
- {
- throw new IllegalArgumentException("Content type cannot be null");
- }
- if (charset == null)
- {
- throw new IllegalArgumentException("Charset cannot be null");
- }
- this.contentType = contentType;
- this.charset = charset;
- }
-
- public MediaType getContentType()
- {
- return contentType;
- }
-
- public String getCharset()
- {
- return charset;
- }
-}
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderedMarkup.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -23,10 +23,10 @@
import junit.framework.TestCase;
import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.util.HTTPStreamInfo;
import org.jboss.portal.test.theme.TestHelper;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.PortalLayout;
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -26,8 +26,8 @@
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.util.HTTPStreamInfo;
import org.jboss.portal.theme.LayoutConstants;
import org.jboss.portal.theme.LayoutDispatcher;
import org.jboss.portal.theme.LayoutService;
Modified: trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/theme/src/main/org/jboss/portal/theme/LayoutServiceInfo.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -24,7 +24,7 @@
package org.jboss.portal.theme;
import org.jboss.portal.common.MediaType;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.theme.render.PortalRenderSet;
import org.jboss.portal.theme.strategy.LayoutStrategy;
import org.jboss.portal.theme.page.PageResult;
Modified: trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -24,7 +24,7 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.page.PageResult;
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/LayoutServiceImpl.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -25,7 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.MediaType;
import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.theme.LayoutException;
import org.jboss.portal.theme.LayoutInfo;
import org.jboss.portal.theme.LayoutService;
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -23,8 +23,8 @@
package org.jboss.portal.theme.render;
import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.server.ServerRequest;
-import org.jboss.portal.server.util.HTTPStreamInfo;
import org.jboss.portal.theme.LayoutInfo;
import org.jboss.portal.theme.PortalLayout;
import org.jboss.portal.theme.ThemeConstants;
Modified: trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/theme/src/main/org/jboss/portal/theme/strategy/StrategyContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -26,8 +26,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.common.invocation.AttributeResolver;
-import org.jboss.portal.server.util.HTTPStreamInfo;
import org.jboss.portal.theme.navigation.WindowNavigationalState;
import org.jboss.portal.theme.page.WindowContext;
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -35,7 +35,7 @@
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.server.impl.RequestAttributeResolver;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.wsrp.WSRPConstants;
import javax.servlet.http.HttpServletRequest;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -25,6 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
@@ -32,7 +33,6 @@
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.spi.SecurityContext;
import org.jboss.portal.portlet.spi.UserContext;
-import org.jboss.portal.server.util.HTTPStreamInfo;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -33,7 +33,7 @@
import org.jboss.portal.portlet.spi.SecurityContext;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.wsrp.servlet.ServletAccess;
import javax.servlet.ServletRequest;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -39,7 +39,7 @@
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.impl.RequestAttributeResolver;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.wsrp.WSRPPortletURL;
import org.jboss.portal.wsrp.WSRPRewritingConstants;
import org.jboss.portal.wsrp.servlet.ServletAccess;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPRenderContext.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -24,6 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.spi.PortalContext;
@@ -31,7 +32,6 @@
import org.jboss.portal.portlet.spi.SecurityContext;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.server.util.HTTPStreamInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -34,7 +34,7 @@
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.server.util.HTTPStreamInfo;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.InteractionParams;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -24,6 +24,7 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.info.CacheInfo;
@@ -35,7 +36,6 @@
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.server.util.HTTPStreamInfo;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPRewritingConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-03-15 21:27:09 UTC (rev 6700)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-03-15 21:34:02 UTC (rev 6701)
@@ -24,6 +24,7 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.http.HTTPStreamInfo;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.Portlet;
@@ -36,7 +37,6 @@
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.portlet.state.AccessMode;
-import org.jboss.portal.server.util.HTTPStreamInfo;
import org.jboss.portal.wsrp.UserContextConverter;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPUtils;
19 years, 1 month
JBoss Portal SVN: r6700 - in trunk/portlet/src/main/org/jboss/portal/portlet: impl/jsr168 and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 17:27:09 -0400 (Thu, 15 Mar 2007)
New Revision: 6700
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java
Removed:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java
Log:
moved the PortletContainerAdapter at the right place
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-15 21:05:07 UTC (rev 6699)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-15 21:27:09 UTC (rev 6700)
@@ -35,12 +35,12 @@
import org.jboss.portal.common.xml.NullEntityResolver;
import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
import org.jboss.portal.portlet.container.PortletApplicationRegistry;
-import org.jboss.portal.portlet.impl.jsr168.PortletContainerAdapter;
import org.jboss.portal.portlet.deployment.JBossApplicationMetaDataFactory;
import org.jboss.portal.portlet.deployment.PortletApplicationMetaDataFactory;
import org.jboss.portal.portlet.impl.jsr168.APIFactory;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.deployment.jboss.PortletContainerAdapter;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
import org.jboss.portal.portlet.metadata.PolicyPermissionMetaData;
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java (from rev 6697, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java 2007-03-15 21:27:09 UTC (rev 6700)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.deployment.jboss;
+
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
+import org.jboss.portal.portlet.container.PortletContainer;
+
+/**
+ * Adapt the life cycle of micro container to the portlet container impl.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletContainerAdapter
+{
+
+ /** . */
+ private PortletMetaData portletMD;
+
+ /** . */
+ private JBossPortletMetaData jbossPortletMD;
+
+ /** . */
+ private PortletApplicationContextImpl portletApplicationContext;
+
+ /** . */
+ private PortletContainerImpl portletContainer;
+
+ public PortletContainerAdapter(PortletMetaData portletMD, JBossPortletMetaData jbossPortletMD)
+ {
+ this.portletMD = portletMD;
+ this.jbossPortletMD = jbossPortletMD;
+ }
+
+ public PortletApplicationContextImpl getPortletApplicationContext()
+ {
+ return portletApplicationContext;
+ }
+
+ public void setPortletWebAppAdapter(PortletApplicationContextImpl portletApplicationContext)
+ {
+ this.portletApplicationContext = portletApplicationContext;
+ }
+
+ public PortletContainer getPortletContainer()
+ {
+ return portletContainer;
+ }
+
+ public void start() throws Exception
+ {
+ PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
+ portletContainer = new PortletContainerImpl(portletApp, portletMD, jbossPortletMD);
+ portletContainer.start();
+ portletApp.addContainer(portletContainer);
+ }
+
+ public void stop()
+ {
+ PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
+ portletApp.removeContainer(portletContainer);
+ portletContainer.stop();
+ portletContainer = null;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletContainerAdapter.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java 2007-03-15 21:05:07 UTC (rev 6699)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java 2007-03-15 21:27:09 UTC (rev 6700)
@@ -1,85 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
-import org.jboss.portal.portlet.container.PortletContainer;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletContainerAdapter
-{
-
- /** . */
- private PortletMetaData portletMD;
-
- /** . */
- private JBossPortletMetaData jbossPortletMD;
-
- /** . */
- private PortletApplicationContextImpl portletApplicationContext;
-
- /** . */
- private PortletContainerImpl portletContainer;
-
- public PortletContainerAdapter(PortletMetaData portletMD, JBossPortletMetaData jbossPortletMD)
- {
- this.portletMD = portletMD;
- this.jbossPortletMD = jbossPortletMD;
- }
-
- public PortletApplicationContextImpl getPortletApplicationContext()
- {
- return portletApplicationContext;
- }
-
- public void setPortletWebAppAdapter(PortletApplicationContextImpl portletApplicationContext)
- {
- this.portletApplicationContext = portletApplicationContext;
- }
-
- public PortletContainer getPortletContainer()
- {
- return portletContainer;
- }
-
- public void start() throws Exception
- {
- PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
- portletContainer = new PortletContainerImpl(portletApp, portletMD, jbossPortletMD);
- portletContainer.start();
- portletApp.addContainer(portletContainer);
- }
-
- public void stop()
- {
- PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
- portletApp.removeContainer(portletContainer);
- portletContainer.stop();
- portletContainer = null;
- }
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2007-03-15 21:05:07 UTC (rev 6699)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2007-03-15 21:27:09 UTC (rev 6700)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.impl.jsr168;
import org.jboss.logging.Logger;
-import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.impl.jsr168.api.PortletConfigImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
@@ -157,7 +156,7 @@
return valve.getState() == Valve.OPEN;
}
- public void start() throws Exception, PortletInitializationException
+ public void start() throws PortletInitializationException
{
// Set class name
this.className = metaData.getClassName();
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java 2007-03-15 21:05:07 UTC (rev 6699)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java 2007-03-15 21:27:09 UTC (rev 6700)
@@ -52,7 +52,7 @@
private ContentTypes contentTypes;
private PortletResourceBundleManager bundleMgr;
- public ContainerCapabilities(Set supportedLocales, PortletResourceBundleManager bundleMgr, ContentTypes contentTypes) throws Exception
+ public ContainerCapabilities(Set supportedLocales, PortletResourceBundleManager bundleMgr, ContentTypes contentTypes)
{
this.supportedLocales = supportedLocales;
this.contentTypes = contentTypes;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java 2007-03-15 21:05:07 UTC (rev 6699)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java 2007-03-15 21:27:09 UTC (rev 6700)
@@ -62,7 +62,6 @@
PortletContainerImpl container,
PortletResourceBundleManager bundleMgr,
ContentTypes contentTypes)
- throws Exception
{
PortletMetaData portletMD = container.getMetaData();
JBossPortletMetaData jbossPortletMD = container.getJBossMetaData();
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java 2007-03-15 21:05:07 UTC (rev 6699)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java 2007-03-15 21:27:09 UTC (rev 6700)
@@ -84,7 +84,7 @@
this.metadata = metadata;
}
- public void start() throws Exception
+ public void start()
{
initFromMetadata(metadata);
}
19 years, 1 month
JBoss Portal SVN: r6699 - trunk/portlet/src/main/org/jboss/portal/portlet/container.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 17:05:07 -0400 (Thu, 15 Mar 2007)
New Revision: 6699
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryListener.java
Removed:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerRegistryListener.java
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistry.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java
Log:
correctly renamed the PortletContainerRegistryListener to PortletApplicationRegistryListener
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistry.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistry.java 2007-03-15 20:57:21 UTC (rev 6698)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistry.java 2007-03-15 21:05:07 UTC (rev 6699)
@@ -58,12 +58,12 @@
*
* @param listener
*/
- void addListener(PortletContainerRegistryListener listener);
+ void addListener(PortletApplicationRegistryListener listener);
/**
* Removes a portlet container registry listener.
*
* @param listener
*/
- void removeListener(PortletContainerRegistryListener listener);
+ void removeListener(PortletApplicationRegistryListener listener);
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-15 20:57:21 UTC (rev 6698)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-15 21:05:07 UTC (rev 6699)
@@ -97,7 +97,7 @@
return (PortletApplication)portletApplications.get(id);
}
- public void addListener(PortletContainerRegistryListener listener)
+ public void addListener(PortletApplicationRegistryListener listener)
{
if (listener == null)
{
@@ -112,7 +112,7 @@
}
}
- public void removeListener(PortletContainerRegistryListener listener)
+ public void removeListener(PortletApplicationRegistryListener listener)
{
if (listener == null)
{
@@ -132,8 +132,8 @@
Iterator it = listeners.iterator();
while (it.hasNext())
{
- PortletContainerRegistryListener listener = (PortletContainerRegistryListener)it.next();
- listener.registerPortletContainer(portlet);
+ PortletApplicationRegistryListener listener = (PortletApplicationRegistryListener)it.next();
+ listener.portletContainerRegistered(portlet);
}
}
@@ -142,8 +142,8 @@
Iterator it = listeners.iterator();
while (it.hasNext())
{
- PortletContainerRegistryListener listener = (PortletContainerRegistryListener)it.next();
- listener.unregisterPortletContainer(portlet);
+ PortletApplicationRegistryListener listener = (PortletApplicationRegistryListener)it.next();
+ listener.portletContainerUnregistered(portlet);
}
}
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryListener.java (from rev 6697, trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerRegistryListener.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryListener.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryListener.java 2007-03-15 21:05:07 UTC (rev 6699)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.container;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ */
+public interface PortletApplicationRegistryListener
+{
+
+ /**
+ * A portlet container has been registered.
+ */
+ void portletContainerRegistered(PortletContainer portletContainer);
+
+ /**
+ * A portlet container has been unregistered.
+ */
+ void portletContainerUnregistered(PortletContainer portletContainer);
+
+}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2007-03-15 20:57:21 UTC (rev 6698)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2007-03-15 21:05:07 UTC (rev 6699)
@@ -55,7 +55,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PortletContainerInvoker extends AbstractJBossService implements PortletInvoker, PortletContainerRegistryListener
+public class PortletContainerInvoker extends AbstractJBossService implements PortletInvoker, PortletApplicationRegistryListener
{
/** . */
@@ -107,7 +107,7 @@
this.stackFactory = stackFactory;
}
- public synchronized void registerPortletContainer(PortletContainer portletContainer)
+ public synchronized void portletContainerRegistered(PortletContainer portletContainer)
{
Map portlets = new HashMap(this.portlets);
PortletImpl portlet = new PortletImpl(portletContainer);
@@ -117,7 +117,7 @@
this.portlets = portlets;
}
- public synchronized void unregisterPortletContainer(PortletContainer portletContainer)
+ public synchronized void portletContainerUnregistered(PortletContainer portletContainer)
{
Map portlets = new HashMap(this.portlets);
PortletImpl portlet = new PortletImpl(portletContainer);
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerRegistryListener.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerRegistryListener.java 2007-03-15 20:57:21 UTC (rev 6698)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerRegistryListener.java 2007-03-15 21:05:07 UTC (rev 6699)
@@ -1,40 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- */
-public interface PortletContainerRegistryListener {
-
- /**
- * A portlet container has been registered.
- */
- void registerPortletContainer(PortletContainer portletContainer);
-
- /**
- * A portlet container has been unregistered.
- */
- void unregisterPortletContainer(PortletContainer portletContainer);
-
-}
19 years, 1 month
JBoss Portal SVN: r6697 - in trunk: core/src/main/org/jboss/portal/core/aspects/portlet and 14 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 16:53:20 -0400 (Thu, 15 Mar 2007)
New Revision: 6697
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistrationContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortalContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletPreferencesImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCacheInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerMetaInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerModeInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferenceInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferencesInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSecurityInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSessionInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerWindowStateInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/InfoBundle.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/PortletResourceBundleManager.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/Utils.java
Removed:
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerAdapter.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCacheInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCapabilities.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerMetaInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerModeInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPortletInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferenceInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferencesInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSecurityInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSessionInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerWindowStateInfo.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContentTypes.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/InfoBundle.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/PortletResourceBundleManager.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/info/Utils.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortalContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletConfigImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletPreferencesImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestDispatcherImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletSessionImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java
Modified:
trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java
trunk/core/src/main/org/jboss/portal/test/core/I18nELTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/I18nOutELTestCase.java
trunk/core/src/main/org/jboss/portlet/JBossAPIFactory.java
trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java
trunk/core/src/main/org/jboss/portlet/JBossActionResponse.java
trunk/core/src/main/org/jboss/portlet/JBossPortletPreferences.java
trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java
trunk/core/src/main/org/jboss/portlet/JBossRenderResponse.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistry.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java
trunk/portlet/src/main/org/jboss/portal/portlet/deployment/JBossApplicationMetaDataFactory.java
trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactory.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactoryImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/info/PreferenceInfoTest.java
trunk/portlet/src/main/org/jboss/portal/test/server/ContentTypesTestCase.java
trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
Log:
improve split between interfaces and jsr168 based implementation of portlet container
Modified: trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java
===================================================================
--- trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/bridge/src/main/org/jboss/portal/bridge/JBossServletContextProvider.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -23,7 +23,7 @@
package org.jboss.portal.bridge;
import org.apache.portals.bridges.common.ServletContextProvider;
-import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import javax.portlet.GenericPortlet;
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -28,7 +28,7 @@
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
import org.jboss.portal.core.metadata.portlet.ElementMetaData;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/portlet/TransactionInterceptor.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -24,7 +24,7 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.transaction.Transactions;
-import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
Modified: trunk/core/src/main/org/jboss/portal/test/core/I18nELTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/I18nELTestCase.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portal/test/core/I18nELTestCase.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -25,8 +25,8 @@
import org.apache.cactus.JspTestCase;
import org.jboss.portal.core.servlet.jsp.PortalJsp;
import org.jboss.portal.core.servlet.jsp.taglib.PortalLib;
-import org.jboss.portal.portlet.container.info.PortletResourceBundleManager;
-import org.jboss.portal.portlet.impl.jsr168.PortletConfigImpl;
+import org.jboss.portal.portlet.impl.jsr168.info.PortletResourceBundleManager;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletConfigImpl;
import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
import javax.portlet.PortletConfig;
Modified: trunk/core/src/main/org/jboss/portal/test/core/I18nOutELTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/I18nOutELTestCase.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portal/test/core/I18nOutELTestCase.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -27,8 +27,8 @@
import org.jboss.portal.core.servlet.jsp.taglib.PortalLib;
import org.jboss.portal.core.servlet.jsp.taglib.context.Context;
import org.jboss.portal.core.servlet.jsp.taglib.context.DelegateContext;
-import org.jboss.portal.portlet.container.info.PortletResourceBundleManager;
-import org.jboss.portal.portlet.impl.jsr168.PortletConfigImpl;
+import org.jboss.portal.portlet.impl.jsr168.info.PortletResourceBundleManager;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletConfigImpl;
import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
import javax.portlet.PortletConfig;
Modified: trunk/core/src/main/org/jboss/portlet/JBossAPIFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossAPIFactory.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portlet/JBossAPIFactory.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -23,10 +23,10 @@
package org.jboss.portlet;
import org.jboss.portal.portlet.impl.jsr168.APIFactory;
-import org.jboss.portal.portlet.impl.jsr168.ActionRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.ActionResponseImpl;
-import org.jboss.portal.portlet.impl.jsr168.RenderRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.RenderResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
Modified: trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portlet/JBossActionRequest.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -27,13 +27,12 @@
import org.jboss.portal.core.controller.portlet.ControllerUserContext;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.identity.User;
-import org.jboss.portal.portlet.impl.jsr168.ActionRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portlet.util.Parameters;
import javax.portlet.PortletPreferences;
-import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: trunk/core/src/main/org/jboss/portlet/JBossActionResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossActionResponse.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portlet/JBossActionResponse.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -29,8 +29,8 @@
import org.jboss.portal.core.aspects.controller.node.PortalObjectNode;
import org.jboss.portal.core.controller.portlet.SignOutResponse;
import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.portlet.impl.jsr168.ActionResponseImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
Modified: trunk/core/src/main/org/jboss/portlet/JBossPortletPreferences.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossPortletPreferences.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portlet/JBossPortletPreferences.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -23,9 +23,9 @@
package org.jboss.portlet;
import org.jboss.portal.common.util.ProxyInfo;
-import org.jboss.portal.portlet.impl.jsr168.PortletPreferencesImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletPreferencesImpl;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferencesInfo;
import org.jboss.portal.portlet.state.PropertyContext;
-import org.jboss.portal.portlet.container.info.ContainerPreferencesInfo;
import javax.portlet.PreferencesValidator;
import java.lang.reflect.InvocationHandler;
Modified: trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portlet/JBossRenderRequest.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -27,7 +27,7 @@
import org.jboss.portal.core.controller.portlet.ControllerUserContext;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.identity.User;
-import org.jboss.portal.portlet.impl.jsr168.RenderRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portlet.util.Parameters;
Modified: trunk/core/src/main/org/jboss/portlet/JBossRenderResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portlet/JBossRenderResponse.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/core/src/main/org/jboss/portlet/JBossRenderResponse.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -27,8 +27,8 @@
import org.jboss.portal.core.aspects.controller.node.PortalNodeURLFactory;
import org.jboss.portal.core.aspects.controller.node.PortalObjectNode;
import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.portlet.impl.jsr168.PortletRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.RenderResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -26,7 +26,7 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.container.PortletApplication;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -24,9 +24,9 @@
import org.jboss.portal.common.concurrent.Valve;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.portlet.container.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationContextImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -29,6 +29,7 @@
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
import org.jboss.portal.portlet.impl.jsr168.APIFactory;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
@@ -84,11 +85,13 @@
public void start() throws Exception
{
portletApp = new PortletApplicationImpl(portletAppMD, jbossAppMD, this);
- portletApp.setRegistry(registry);
+ PortletApplicationRegistrationContext registrationContext = registry.registerPortletApplication(portletApp);
+
+ //
+ portletApp.setRegistrationContext(registrationContext);
portletApp.setAPIFactory(apiFactory);
portletApp.create();
portletApp.start();
- registry.registerPortletApplication(portletApp);
}
public void stop()
@@ -96,6 +99,10 @@
registry.unregisterPortletApplication(portletApp);
portletApp.stop();
portletApp.destroy();
+
+ //
+ portletApp.setRegistrationContext(null);
+ portletApp = null;
}
public PortletApplicationImpl getPortletApplication()
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,192 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container;
-
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.portlet.impl.jsr168.APIFactory;
-import org.jboss.portal.portlet.impl.jsr168.PortletContextImpl;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
-import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
-
-import javax.portlet.PortletContext;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletApplicationImpl extends AbstractJBossService implements PortletApplication
-{
-
- protected LinkedHashMap portlets;
- protected PortletApplicationMetaData metaData;
- protected JBossApplicationMetaData jbossMetaData;
- protected PortletApplicationContext context;
-
- protected PortletContext portletContext;
- protected String version;
- protected Map portletModes;
- protected Map windowStates;
- protected APIFactory apiFactory;
- protected PortletApplicationRegistry registry;
-
- public PortletApplicationImpl(
- PortletApplicationMetaData metaData,
- JBossApplicationMetaData jbossMetaData,
- PortletApplicationContext context)
- {
- this.metaData = metaData;
- this.jbossMetaData = jbossMetaData;
- this.portlets = new LinkedHashMap();
- this.context = context;
- }
-
- public String getId()
- {
- return metaData.getId();
- }
-
- public PortletApplicationRegistry getRegistry()
- {
- return registry;
- }
-
- public void setRegistry(PortletApplicationRegistry registry)
- {
- this.registry = registry;
- }
-
- public APIFactory getAPIFactory()
- {
- return apiFactory;
- }
-
- public void setAPIFactory(APIFactory apiFactory)
- {
- this.apiFactory = apiFactory;
- }
-
- public PortletApplicationMetaData getMetaData()
- {
- return metaData;
- }
-
- public JBossApplicationMetaData getJBossMetaData()
- {
- return jbossMetaData;
- }
-
- public void addContainer(PortletContainer container)
- {
- portlets.put(container.getId(), container);
- registry.registerPortlet(container);
- }
-
- public void removeContainer(PortletContainer container)
- {
- registry.unregisterPortlet(container);
- portlets.remove(container.getId());
- }
-
- //
-
- public void startService() throws Exception
- {
- super.startService();
-
- //
- version = metaData.getVersion();
- portletModes = metaData.getPortletModes();
- windowStates = metaData.getWindowStates();
- portletContext = new PortletContextImpl(context.getServletContext());
- }
-
- public void stopService() throws Exception
- {
- //
- version = null;
- portletModes = null;
- windowStates = null;
- portletContext = null;
-
- //
- super.stopService();
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public PortletContext getPortletContext()
- {
- return portletContext;
- }
-
- public Map getPortletModes()
- {
- return portletModes;
- }
-
- public Map getWindowStates()
- {
- return windowStates;
- }
-
- public void start(String portletName) throws Exception
- {
- context.startPortlet(portletName);
- }
-
- public void stop(String portletName) throws Exception
- {
- context.stopPortlet(portletName);
- }
-
- // WebApp implementation ********************************************************************************************
-
- public Set getPortletContainers()
- {
- return new HashSet(portlets.values());
- }
-
- public PortletContainer getPortletContainer(String name)
- {
- return (PortletContainer)portlets.get(name);
- }
-
- public PortletApplicationContext getContext()
- {
- return context;
- }
-
- // Container implementation *****************************************************************************************
-
- public String toString()
- {
- return "PortletWebApp[" + metaData.getId() + "]";
- }
-}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistrationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistrationContext.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistrationContext.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.container;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PortletApplicationRegistrationContext
+{
+
+ /**
+ * Register a portlet.
+ *
+ * @param portletContainer the portlet container
+ */
+ void registerPortlet(PortletContainer portletContainer);
+
+ /**
+ * Unregister a portlet.
+ *
+ * @param portletContainer the portlet container
+ */
+ void unregisterPortlet(PortletContainer portletContainer);
+
+
+}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistry.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistry.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistry.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -31,25 +31,39 @@
*/
public interface PortletApplicationRegistry
{
- /** Register a portlet application. */
- void registerPortletApplication(PortletApplication portletApplication);
+ /**
+ * Register a portlet application.
+ *
+ * @param portletApplication the portlet application to register
+ * @throws IllegalArgumentException if the portlet application is null or already registered
+ */
+ PortletApplicationRegistrationContext registerPortletApplication(PortletApplication portletApplication) throws IllegalArgumentException;
- /** Unregister a portlet application. */
- void unregisterPortletApplication(PortletApplication portletApplication);
+ /**
+ * Unregister a portlet application.
+ *
+ * @param portletApplication the portlet application to unregister
+ * @throws IllegalArgumentException if the portlet application is null or not registered
+ */
+ void unregisterPortletApplication(PortletApplication portletApplication) throws IllegalArgumentException;
- /** Register a portlet. */
- void registerPortlet(PortletContainer portlet);
-
- /** Unregister a portlet. */
- void unregisterPortlet(PortletContainer portlet);
-
/** Return an immutable list all the known portlet application in the registry. */
Collection getPortletApplications();
/** Return a portlet app using its id or null if it does not exist. */
PortletApplication getPortletApplication(String id);
+ /**
+ * Adds a portlet container registry listener.
+ *
+ * @param listener
+ */
void addListener(PortletContainerRegistryListener listener);
+ /**
+ * Removes a portlet container registry listener.
+ *
+ * @param listener
+ */
void removeListener(PortletContainerRegistryListener listener);
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -40,13 +40,16 @@
public class PortletApplicationRegistryImpl extends AbstractJBossService implements PortletApplicationRegistry
{
+ /** . */
private Map portletApplications = new HashMap();
- private Map portlets = new HashMap();
+ /** . */
+ private Map portletContainers = new HashMap();
+ /** . */
private List listeners = new ArrayList();
- public void registerPortletApplication(PortletApplication portletApplication)
+ public PortletApplicationRegistrationContext registerPortletApplication(PortletApplication portletApplication)
{
if (portletApplication == null)
{
@@ -58,9 +61,11 @@
{
throw new IllegalArgumentException("This portlet app is already registered");
}
+ PortletApplicationRegistrationContext ctx = new PortletApplicationRegistrationContextImpl(portletApplication);
Map webAppsCopy = new HashMap(portletApplications);
webAppsCopy.put(portletApplication.getId(), portletApplication);
portletApplications = webAppsCopy;
+ return ctx;
}
}
@@ -82,38 +87,6 @@
}
}
- public void registerPortlet(PortletContainer portlet)
- {
- if (portlet == null)
- {
- throw new IllegalArgumentException("No null portlet accepted");
- }
- synchronized (this)
- {
- Map componentsCopy = new HashMap(portlets);
- componentsCopy.put(new ContainerKey(portlet), portlet);
- portlets = componentsCopy;
-
- //
- raiseRegisterPortletContainerEvent(portlet);
- }
- }
-
- public void unregisterPortlet(PortletContainer portlet)
- {
- if (portlet == null)
- {
- throw new IllegalArgumentException("No null portlet accepted");
- }
- synchronized (this)
- {
- Map componentsCopy = new HashMap(portlets);
- componentsCopy.remove(portlet);
- portlets = componentsCopy;
- raiseUnregisterPortletContainerEvent(portlet);
- }
- }
-
public Collection getPortletApplications()
{
return Collections.unmodifiableCollection(portletApplications.values());
@@ -174,7 +147,6 @@
}
}
-
private static class ContainerKey
{
/** . */
@@ -208,4 +180,70 @@
return applicationId.hashCode() & containerId.hashCode();
}
}
+
+ private class PortletApplicationRegistrationContextImpl implements PortletApplicationRegistrationContext
+ {
+
+ /** . */
+ private PortletApplication portletApplication;
+
+ /** . */
+ private boolean active;
+
+ public PortletApplicationRegistrationContextImpl(PortletApplication portletApplication)
+ {
+ this.portletApplication = portletApplication;
+ this.active = true;
+ }
+
+ public void registerPortlet(PortletContainer portletContainer)
+ {
+ if (portletContainer == null)
+ {
+ throw new IllegalArgumentException("No null portlet accepted");
+ }
+ if (portletContainer.getApplication() != portletApplication)
+ {
+ throw new IllegalArgumentException("The container does not belong to the application owning the registration");
+ }
+ if (!active)
+ {
+ throw new IllegalStateException("Not anymore active");
+ }
+ synchronized (this)
+ {
+ Map componentsCopy = new HashMap(portletContainers);
+ componentsCopy.put(new ContainerKey(portletContainer), portletContainer);
+ portletContainers = componentsCopy;
+
+ //
+ raiseRegisterPortletContainerEvent(portletContainer);
+ }
+ }
+
+ public void unregisterPortlet(PortletContainer portletContainer)
+ {
+ if (portletContainer == null)
+ {
+ throw new IllegalArgumentException("No null portlet accepted");
+ }
+ if (portletContainer.getApplication() != portletApplication)
+ {
+ throw new IllegalArgumentException("The container does not belong to the application owning the registration");
+ }
+ if (!active)
+ {
+ throw new IllegalStateException("Not anymore active");
+ }
+ synchronized (this)
+ {
+ Map componentsCopy = new HashMap(portletContainers);
+ componentsCopy.remove(portletContainer);
+ portletContainers = componentsCopy;
+ raiseUnregisterPortletContainerEvent(portletContainer);
+ }
+ }
+
+ }
+
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -22,494 +22,35 @@
******************************************************************************/
package org.jboss.portal.portlet.container;
-import org.jboss.logging.Logger;
import org.jboss.portal.common.concurrent.Valve;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
-import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.container.info.ContentTypes;
-import org.jboss.portal.portlet.container.info.PortletResourceBundleManager;
-import org.jboss.portal.portlet.impl.jsr168.APIConstants;
-import org.jboss.portal.portlet.impl.jsr168.APIFactory;
-import org.jboss.portal.portlet.impl.jsr168.ActionRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.ActionResponseImpl;
-import org.jboss.portal.portlet.impl.jsr168.PortletConfigImpl;
-import org.jboss.portal.portlet.impl.jsr168.RenderRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.RenderResponseImpl;
-import org.jboss.portal.portlet.impl.jsr168.metadata.ParameterMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletPreferencesMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.SecurityRoleRefMetaData;
+import org.jboss.portal.portlet.impl.jsr168.info.ContentTypes;
import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.SecurityErrorResponse;
-import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-import javax.portlet.Portlet;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PreferencesValidator;
-import javax.portlet.UnavailableException;
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PortletContainer
+public interface PortletContainer
{
- /** Logger. */
- protected final Logger log;
+ PortletInfo getInfo();
- /** . */
- protected PortletApplicationImpl application;
+ String getId();
- /** . */
- protected PortletMetaData metaData;
+ JBossPortletMetaData getJBossMetaData();
- /** . */
- protected JBossPortletMetaData jbossMetaData;
+ boolean isStarted();
- /** The portlet implementation class name. */
- protected String className;
+ ContentTypes getContentTypes();
- /** The portlet config. */
- protected PortletConfig config;
+ PortletApplication getApplication();
- /** The portlet instance. */
- protected Portlet portlet;
+ Valve getValve();
- /** . */
- protected ContentTypes contentTypes;
-
- /** . */
- protected PortletResourceBundleManager bundleMgr;
-
- /** The invocation valve. */
- protected final Valve valve;
-
- /** Give the correspondance between role name and role link. */
- protected Map securityRoleRefsMap;
-
- /** Are we started or not. */
- protected boolean started;
-
- /** User data constraint. */
- protected Set userDataConstraints;
-
- /** Return info. */
- protected PortletInfo info;
-
- /**
- * The preference validator, this is not exposed as runtime meta data as it is only used by the JSR 168 portlet
- * container implementation.
- */
- protected PreferencesValidator preferencesValidator;
-
- public PortletContainer(PortletApplicationImpl application, PortletMetaData metaData, JBossPortletMetaData jbossMetaData)
- {
- this.application = application;
- this.metaData = metaData;
- this.jbossMetaData = jbossMetaData;
- this.valve = new Valve();
- this.log = Logger.getLogger("org.jboss.portal.portlet.container." + metaData.getClassName().replace('.', '_'));
- this.started = false;
- }
-
- public PortletInfo getInfo()
- {
- return info;
- }
-
- public String getId()
- {
- return metaData.getName();
- }
-
- public PortletMetaData getMetaData()
- {
- return metaData;
- }
-
- public JBossPortletMetaData getJBossMetaData()
- {
- return jbossMetaData;
- }
-
- public boolean isStarted()
- {
- return valve.getState() == Valve.OPEN;
- }
-
- public void start() throws Exception, PortletInitializationException
- {
- // Set class name
- this.className = metaData.getClassName();
-
- //
- PortletPreferencesMetaData preferences = metaData.getPreferences();
- if (preferences != null)
- {
- String validatorClassName = preferences.getValidator();
- if (validatorClassName != null)
- {
- try
- {
- ClassLoader loader = application.getContext().getClassLoader();
-
- //
- if (validatorClassName != null)
- {
- // Load the class
- Class preferencesValidatorClass = loader.loadClass(validatorClassName);
- preferencesValidator = (PreferencesValidator)preferencesValidatorClass.newInstance();
- }
- }
- catch (ClassNotFoundException e)
- {
- log.error("Class for preference validator not found", e);
- }
- catch (InstantiationException e)
- {
- log.error("Cannot instantiate preference validator", e);
- }
- catch (IllegalAccessException e)
- {
- throw new Error();
- }
- }
- }
-
- // Security role ref
- Map securityRoleRefsMap = new HashMap();
- for (Iterator i = metaData.getSecurityRoleRefs().iterator(); i.hasNext();)
- {
- SecurityRoleRefMetaData securityRoleRefMD = (SecurityRoleRefMetaData)i.next();
- securityRoleRefsMap.put(securityRoleRefMD.getRoleName(), securityRoleRefMD.getRoleLink());
- }
-
- // Init parameters
- Map initParameters = new HashMap();
- for (Iterator i = metaData.getParameters().values().iterator(); i.hasNext();)
- {
- ParameterMetaData parameterMD = (ParameterMetaData)i.next();
- initParameters.put(parameterMD.getName(), parameterMD.getValue());
- }
-
- // Portlet config object
- PortletResourceBundleManager bundleMgr = new PortletResourceBundleManager(application.getContext().getClassLoader(), metaData.getLanguages());
-
- //
- PortletConfig config = new PortletConfigImpl(
- metaData.getName(),
- application.getPortletContext(),
- initParameters,
- bundleMgr);
-
- //
- ContentTypes contentTypes = new ContentTypes();
- contentTypes.setMetadata(metaData.getContentTypes());
- contentTypes.start();
-
- //
- PortletInfo info = new ContainerPortletInfo(this, bundleMgr, contentTypes);
-
- // Finally initialize the porlet instance
- try
- {
- log.debug("Loading portlet class " + className);
- Class portletClass = application.getContext().getClassLoader().loadClass(className);
- log.debug("Creating portlet object " + className);
- Portlet portlet = (Portlet)portletClass.newInstance();
- log.debug("Created portlet object " + className);
- initPortlet(portlet, config);
- log.debug("Initialized portlet object " + className);
-
- // We are safe, update state
- this.portlet = portlet;
- this.config = config;
- this.securityRoleRefsMap = Collections.unmodifiableMap(securityRoleRefsMap);
- this.contentTypes = contentTypes;
- this.bundleMgr = bundleMgr;
- this.info = info;
- this.started = true;
-
- // Let invocation flow in
- valve.open();
-
- // Register
- // webApp.addContainer(this);
- }
- catch (IllegalAccessException e)
- {
- throw new PortletInitializationException("Portlet class not accessible " + className, e);
- }
- catch (ClassNotFoundException e)
- {
- throw new PortletInitializationException("Portlet class not found " + className, e);
- }
- catch (InstantiationException e)
- {
- throw new PortletInitializationException("Portlet class cannot be instantiated " + className, e);
- }
- catch (PortletException e)
- {
- throw new PortletInitializationException("The portlet " + getId() + " threw a portlet exception during init", e);
- }
- catch (RuntimeException e)
- {
- throw new PortletInitializationException("The portlet " + getId() + " threw a runtime exception during init", e);
- }
- catch (Error e)
- {
- throw new PortletInitializationException("The portlet " + getId() + " threw an error during init", e);
- }
- }
-
- public void stop()
- {
- //
- // webApp.removeContainer(this);
-
- // Wait at most 60 seconds before all invocations are done
- log.debug("Trying to close the valve");
- boolean done = valve.closing(60000);
- if (!done)
- {
- log.warn("The valve is still holding invocations, continue anyway");
- }
-
- //
- valve.closed();
-
- //
- if (started)
- {
- //
- started = false;
-
- // Destroy the portlet object
- destroyPortlet(portlet);
-
- // Stop the plugins (static)
- contentTypes.stop();
-
- // Update state
- preferencesValidator = null;
- className = null;
- portlet = null;
- securityRoleRefsMap = null;
- config = null;
- contentTypes = null;
- userDataConstraints = null;
- info = null;
- }
- }
-
- public PortletConfig getConfig()
- {
- return config;
- }
-
- public Portlet getPortlet()
- {
- return portlet;
- }
-
- public ContentTypes getContentTypes()
- {
- return contentTypes;
- }
-
- public Map getSecurityRoleRefsMap()
- {
- return securityRoleRefsMap;
- }
-
- public PortletApplication getApplication()
- {
- return application;
- }
-
- public Valve getValve()
- {
- return valve;
- }
-
- public Set getUserDataConstraints()
- {
- return userDataConstraints;
- }
-
- public PreferencesValidator getPreferencesValidator()
- {
- return preferencesValidator;
- }
-
- public String toString()
- {
- return "PortletContainer[name=" + getId() + ",+application=" + application.getId() + "]";
- }
-
- /** Initialize the portlet. */
- private void initPortlet(Portlet portlet, PortletConfig config) throws PortletException
- {
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- // Set the war loader for the request
- ClassLoader newLoader = application.getContext().getClassLoader();
- Thread.currentThread().setContextClassLoader(newLoader);
- portlet.init(config);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- }
-
- /** Destroy the portlet. */
- private void destroyPortlet(Portlet portlet)
- {
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- // Set the war loader for the request
- ClassLoader newLoader = application.getContext().getClassLoader();
- Thread.currentThread().setContextClassLoader(newLoader);
- if (portlet != null)
- {
- portlet.destroy();
- }
- else
- {
- log.debug("Cannot call destroy, portlet was null");
- }
- }
- catch (RuntimeException e)
- {
- log.error("The portlet threw a runtime exception", e);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- }
-
- public PortletInvocationResponse dispatch(PortletInvocation invocation) throws PortletInvokerException, InvocationException
- {
- try
- {
- if (invocation instanceof ActionInvocation)
- {
- return invokeAction((ActionInvocation)invocation);
- }
- else if (invocation instanceof RenderInvocation)
- {
- return invokeRender((RenderInvocation)invocation);
- }
- else
- {
- throw new InvocationException("Unexpected invocation " + invocation);
- }
- }
- catch (NoClassDefFoundError e)
- {
- //
- return new ErrorResponse(e);
- }
- catch (Exception e)
- {
- log.error("The portlet threw an exception", e);
-
- //
- if (e instanceof PortletSecurityException)
- {
- return new SecurityErrorResponse(e);
- }
- else if (e instanceof UnavailableException)
- {
- UnavailableException ue = (UnavailableException)e;
- if (ue.isPermanent())
- {
- return new UnavailableResponse();
- }
- else
- {
- return new UnavailableResponse(ue.getUnavailableSeconds());
- }
- }
- else
- {
- // The exception is either a PortletException, an IOException or a RuntimeException
- return new ErrorResponse(e);
- }
- }
- }
-
- protected PortletInvocationResponse invokeAction(ActionInvocation invocation) throws IOException, PortletException
- {
- APIFactory factory = application.getAPIFactory();
- ActionRequestImpl areq = factory.createActionRequest(invocation);
- ActionResponseImpl aresp = factory.createActionResponse(invocation, areq);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, areq);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, aresp);
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
- portlet.processAction(areq, aresp);
- }
- finally
- {
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
- }
-
- return aresp.getResult();
- }
-
- protected PortletInvocationResponse invokeRender(RenderInvocation invocation) throws IOException, PortletException
- {
- APIFactory factory = application.getAPIFactory();
- RenderRequestImpl rreq = factory.createRenderRequest(invocation);
- RenderResponseImpl rresp = factory.createRenderResponse(invocation, rreq);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, rreq);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, rresp);
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
- portlet.render(rreq, rresp);
- }
- finally
- {
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
- }
-
- return rresp.getResult();
- }
-
-
+ PortletInvocationResponse dispatch(PortletInvocation invocation) throws PortletInvokerException, InvocationException;
}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerAdapter.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerAdapter.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerAdapter.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,83 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container;
-
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletContainerAdapter
-{
-
- /** . */
- private PortletMetaData portletMD;
-
- /** . */
- private JBossPortletMetaData jbossPortletMD;
-
- /** . */
- private PortletApplicationContextImpl portletApplicationContext;
-
- /** . */
- private PortletContainer portletContainer;
-
- public PortletContainerAdapter(PortletMetaData portletMD, JBossPortletMetaData jbossPortletMD)
- {
- this.portletMD = portletMD;
- this.jbossPortletMD = jbossPortletMD;
- }
-
- public PortletApplicationContextImpl getPortletApplicationContext()
- {
- return portletApplicationContext;
- }
-
- public void setPortletWebAppAdapter(PortletApplicationContextImpl portletApplicationContext)
- {
- this.portletApplicationContext = portletApplicationContext;
- }
-
- public PortletContainer getPortletContainer()
- {
- return portletContainer;
- }
-
- public void start() throws Exception
- {
- PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
- portletContainer = new PortletContainer(portletApp, portletMD, jbossPortletMD);
- portletContainer.start();
- portletApp.addContainer(portletContainer);
- }
-
- public void stop()
- {
- PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
- portletApp.removeContainer(portletContainer);
- portletContainer.stop();
- portletContainer = null;
- }
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerInvoker.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -32,9 +32,9 @@
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.container.info.ContainerPreferencesInfo;
-import org.jboss.portal.portlet.container.info.ContainerPreferenceInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferencesInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferenceInfo;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCacheInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCacheInfo.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCacheInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,86 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.portlet.impl.jsr168.metadata.CacheConfigMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.info.CacheInfo;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ContainerCacheInfo implements CacheInfo
-{
-
- /** Cache uses strong references. */
- public static int REF_STRONG = 0;
-
- /** Cache uses soft references. */
- public static int REF_SOFT = 1;
-
- /** . */
- private static Logger log = Logger.getLogger(ContainerCacheInfo.class);
-
- /** . */
- private int expirationTimeSecs;
-
- /** . */
- private int referenceType;
-
- public ContainerCacheInfo(PortletMetaData portletMD, JBossPortletMetaData jbossPortletMD)
- {
- CacheConfigMetaData cacheConfigMD = portletMD.getCacheConfig();
- if (cacheConfigMD != null)
- {
- expirationTimeSecs = cacheConfigMD.getExpirationTime();
- if (expirationTimeSecs < 0 && expirationTimeSecs != -1)
- {
- log.warn("Seen bad caching expiration value " + expirationTimeSecs + " disable caching instead");
- expirationTimeSecs = 0;
- }
- }
- else
- {
- expirationTimeSecs = 0;
- }
-
- referenceType = REF_STRONG;
- if (jbossPortletMD != null)
- {
- referenceType = jbossPortletMD.getCacheRefType() == null ? REF_STRONG : jbossPortletMD.getCacheRefType().intValue();
- }
- }
-
- public int getExpirationSecs()
- {
- return expirationTimeSecs;
- }
-
- public int getReferenceType()
- {
- return referenceType;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCapabilities.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCapabilities.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCapabilities.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,111 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.info.CapabilitiesInfo;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class ContainerCapabilities implements CapabilitiesInfo
-{
- private static Set WINDOW_STATES = new HashSet(3);
-
- static
- {
- WINDOW_STATES.add(new ContainerWindowStateInfo(WindowState.MAXIMIZED));
- WINDOW_STATES.add(new ContainerWindowStateInfo(WindowState.MINIMIZED));
- WINDOW_STATES.add(new ContainerWindowStateInfo(WindowState.NORMAL));
- WINDOW_STATES = Collections.unmodifiableSet(WINDOW_STATES);
- }
-
- private Set supportedLocales;
- private ContentTypes contentTypes;
- private PortletResourceBundleManager bundleMgr;
-
- public ContainerCapabilities(Set supportedLocales, PortletResourceBundleManager bundleMgr, ContentTypes contentTypes) throws Exception
- {
- this.supportedLocales = supportedLocales;
- this.contentTypes = contentTypes;
- this.bundleMgr = bundleMgr;
- }
-
- public Set getMimeTypes()
- {
- return new HashSet(contentTypes.getAllContentTypes());
- }
-
- public Set getAllModes()
- {
- Set infos = new HashSet();
- for (Iterator i = contentTypes.getAllModes().iterator(); i.hasNext();)
- {
- infos.add(new ContainerModeInfo((Mode)i.next()));
- }
- return infos;
- }
-
- public Set getModes(String mimeType)
- {
- Set infos = new HashSet();
- for (Iterator i = contentTypes.getSupportedModes(mimeType).iterator(); i.hasNext();)
- {
- infos.add(new ContainerModeInfo((Mode)i.next()));
- }
- return infos;
- }
-
- public Set getAllWindowStates()
- {
- return WINDOW_STATES;
- }
-
- public Set getWindowStates(String mimeType)
- {
- if (contentTypes.isContentTypeSupported(mimeType))
- {
- return getAllWindowStates();
- }
- return Collections.EMPTY_SET;
- }
-
- public Set getAllLocales()
- {
- return supportedLocales;
- }
-
- public Set getLocales(String mimeType)
- {
- return getAllLocales();
- }
-
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerMetaInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerMetaInfo.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerMetaInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,93 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.info.MetaInfo;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class ContainerMetaInfo implements MetaInfo
-{
-
- private Map values;
- private static final String JAVAX_PORTLET = "javax.portlet.";
- private static final String[] KEYS = {TITLE, SHORT_TITLE, KEYWORDS};
- private static final String[] BUNDLE_KEYS = {JAVAX_PORTLET + TITLE, JAVAX_PORTLET + SHORT_TITLE, JAVAX_PORTLET + KEYWORDS};
-
- public ContainerMetaInfo(PortletMetaData metadata, PortletResourceBundleManager rb)
- {
- this.values = new HashMap();
-
- // Construct info from resource bundle manager
- if (rb != null)
- {
- for (int i = 0; i < KEYS.length; i++)
- {
- String key = KEYS[i];
- Map tmp = new HashMap();
- List locales = metadata.getLanguages().getSupportedLocales();
-
- // Add english locale
- locales.add(Locale.ENGLISH);
-
- for (Iterator j = locales.iterator(); j.hasNext();)
- {
- Locale locale = (Locale)j.next();
- ResourceBundle bundle = rb.getResourceBundle(locale);
- try
- {
- String value = bundle.getString(BUNDLE_KEYS[i]);
- tmp.put(locale, value);
- }
- catch (MissingResourceException ignore)
- {
- }
- }
- LocalizedString ls = new LocalizedString(tmp, Locale.ENGLISH);
- values.put(key, ls);
- }
- }
-
- // Add stuff coming from meta data
- values.put(DESCRIPTION, Utils.getLocalizedDescription(metadata.getDescription()));
- values.put(DISPLAY_NAME, Utils.getLocalizedDescription(metadata.getDisplayName()));
- }
-
- public LocalizedString getMetaValue(String key)
- {
- return (LocalizedString)values.get(key);
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerModeInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerModeInfo.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerModeInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,83 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.portlet.info.ModeInfo;
-
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.4
- */
-class ContainerModeInfo implements ModeInfo
-{
- private final Mode mode;
- private static final LocalizedString DEFAULT_DESCRIPTION = new LocalizedString("Default Portlet mode description.", Locale.ENGLISH);
-
- public ContainerModeInfo(Mode mode)
- {
- this.mode = mode;
- }
-
- public LocalizedString getDescription()
- {
- return DEFAULT_DESCRIPTION; // fix-me
- }
-
- public Mode getMode()
- {
- return mode;
- }
-
- public String getModeName()
- {
- return mode.toString();
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o == null || getClass() != o.getClass())
- {
- return false;
- }
-
- final ContainerModeInfo modeInfo = (ContainerModeInfo)o;
-
- return mode.equals(modeInfo.mode);
-
- }
-
- public int hashCode()
- {
- return mode.hashCode();
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPortletInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPortletInfo.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPortletInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,139 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.portlet.container.PortletApplicationImpl;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.info.CacheInfo;
-import org.jboss.portal.portlet.info.CapabilitiesInfo;
-import org.jboss.portal.portlet.info.MetaInfo;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.info.PreferencesInfo;
-import org.jboss.portal.portlet.info.SecurityInfo;
-import org.jboss.portal.portlet.info.SessionInfo;
-import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-
-import java.util.HashSet;
-import java.util.Locale;
-
-/**
- * For now implementation that use the portlet container directly.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class ContainerPortletInfo implements PortletInfo
-{
-
- private PortletContainer container;
- private ContainerCapabilities capabilities;
- private ContainerPreferencesInfo preferences;
- private ContainerMetaInfo meta;
- private ContainerSecurityInfo security;
- private ContainerCacheInfo cache;
- private ContainerSessionInfo session;
- private Boolean remotable;
-
- public ContainerPortletInfo(
- PortletContainer container,
- PortletResourceBundleManager bundleMgr,
- ContentTypes contentTypes)
- throws Exception
- {
- PortletMetaData portletMD = container.getMetaData();
- JBossPortletMetaData jbossPortletMD = container.getJBossMetaData();
- PortletApplicationImpl pwa = (PortletApplicationImpl)container.getApplication();
- JBossApplicationMetaData jbossAppMD = pwa.getJBossMetaData();
-
- //
- this.container = container;
-
- // Add Locale.ENGLISH to supported locales if no locales was provided
- // todo: should we always include it (i.e. even when other locales are present)?
- HashSet supportedLocales = new HashSet(container.getMetaData().getLanguages().getSupportedLocales());
- if (supportedLocales.isEmpty())
- {
- supportedLocales.add(Locale.ENGLISH);
- }
-
- this.capabilities = new ContainerCapabilities(supportedLocales, bundleMgr, contentTypes);
- this.preferences = portletMD.getPreferences() != null ? new ContainerPreferencesInfo(portletMD, bundleMgr) : new ContainerPreferencesInfo();
- this.meta = new ContainerMetaInfo(portletMD, bundleMgr);
- this.security = new ContainerSecurityInfo(portletMD);
- this.cache = new ContainerCacheInfo(portletMD, jbossPortletMD);
- this.session = new ContainerSessionInfo(container);
-
- if (jbossPortletMD != null)
- {
- this.remotable = jbossPortletMD.getRemotable();
- }
- if (this.remotable == null && jbossAppMD != null)
- {
- this.remotable = jbossAppMD.getRemotable();
- }
-
- }
-
- public PortletContainer getContainer()
- {
- return container;
- }
-
- public CapabilitiesInfo getCapabilities()
- {
- return capabilities;
- }
-
- public PreferencesInfo getPreferences()
- {
- return preferences;
- }
-
- public MetaInfo getMeta()
- {
- return meta;
- }
-
- public SecurityInfo getSecurity()
- {
- return security;
- }
-
- public CacheInfo getCache()
- {
- return cache;
- }
-
- public SessionInfo getSession()
- {
- return session;
- }
-
- public Boolean isRemotable()
- {
- return remotable;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferenceInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferenceInfo.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferenceInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,80 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.portlet.info.PreferenceInfo;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ContainerPreferenceInfo implements PreferenceInfo
-{
-
- private String key;
- private LocalizedString displayName;
- private LocalizedString description;
- private Boolean readOnly;
- private Value value;
-
- public ContainerPreferenceInfo(String key, LocalizedString displayName, LocalizedString description, boolean readOnly, Value value)
- {
- this.key = key;
- this.displayName = displayName;
- this.description = description;
- this.readOnly = Boolean.valueOf(readOnly);
- this.value = value;
- }
-
- public String getKey()
- {
- return key;
- }
-
- public LocalizedString getDisplayName()
- {
- return displayName;
- }
-
- public LocalizedString getDescription()
- {
- return description;
- }
-
- public Boolean isReadOnly()
- {
- return readOnly;
- }
-
- /**
- * Return the value provided by the portlet.xml deployment descriptor.
- *
- * @return the preference value associated with this preference meta data
- */
- public Value getDefaultValue()
- {
- return value;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferencesInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferencesInfo.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferencesInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,88 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PreferenceMetaData;
-import org.jboss.portal.portlet.info.PreferenceInfo;
-import org.jboss.portal.portlet.info.PreferencesInfo;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class ContainerPreferencesInfo implements PreferencesInfo
-{
-
- /** The cached container preference info. */
- private Map content;
-
- public ContainerPreferencesInfo()
- {
- content = new HashMap();
- }
-
- public ContainerPreferencesInfo(PortletMetaData portletMD, PortletResourceBundleManager bundleMgr)
- {
- content = new HashMap();
-
- for (Iterator i = portletMD.getPreferences().iterator(); i.hasNext();)
- {
- PreferenceMetaData prefMD = (PreferenceMetaData)i.next();
- Value value = new StringValue(prefMD.getValues());
- LocalizedString displayName = bundleMgr.getLocalizedValue("javax.portlet.preference.name." + prefMD.getName(), prefMD.getName());
- LocalizedString description = bundleMgr.getLocalizedValue("javax.portlet.preference.description." + prefMD.getName(), prefMD.getName());
- ContainerPreferenceInfo pref = new ContainerPreferenceInfo(prefMD.getName(), displayName, description, prefMD.isReadOnly(), value);
- content.put(pref.getKey(), pref);
- }
- }
-
- public ContainerPreferenceInfo getContainerPreference(String key)
- {
- if (key == null)
- {
- throw new IllegalArgumentException("Preference key must not be null");
- }
- return (ContainerPreferenceInfo)content.get(key);
- }
-
- public Set getKeys()
- {
- return Collections.unmodifiableSet(content.keySet());
- }
-
- public PreferenceInfo getPreference(String key)
- {
- return getContainerPreference(key);
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSecurityInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSecurityInfo.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSecurityInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,75 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.portlet.TransportGuarantee;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.TransportGuaranteesMetaData;
-import org.jboss.portal.portlet.info.SecurityInfo;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ContainerSecurityInfo implements SecurityInfo
-{
-
- /** . */
- private Set tgs;
-
- public ContainerSecurityInfo(PortletMetaData portletMD)
- {
- tgs = new HashSet();
- tgs.add(TransportGuarantee.NONE);
-
- //
- TransportGuaranteesMetaData tgMD = portletMD.getTransportGuarantees();
- if (tgMD != null)
- {
- for (Iterator i = tgMD.iterator(); i.hasNext();)
- {
- TransportGuarantee tg = (TransportGuarantee)i.next();
- tgs.add(tg);
- }
- }
-
- //
- tgs = Collections.unmodifiableSet(tgs);
- }
-
-
- public boolean containsTransportGuarantee(TransportGuarantee transportGuarantee)
- {
- return tgs.contains(transportGuarantee);
- }
-
- public Set getTransportGuarantees()
- {
- return tgs;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSessionInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSessionInfo.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSessionInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,55 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.info.SessionInfo;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ContainerSessionInfo implements SessionInfo
-{
-
- private Boolean distributed;
-
- ContainerSessionInfo(PortletContainer portletContainer)
- {
- JBossPortletMetaData md = portletContainer.getJBossMetaData();
- if (md != null)
- {
- distributed = md.getDistributed();
- }
- if (distributed == null)
- {
- distributed = Boolean.FALSE;
- }
- }
-
- public Boolean getDistributed()
- {
- return distributed;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerWindowStateInfo.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerWindowStateInfo.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerWindowStateInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,83 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.portlet.info.WindowStateInfo;
-
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.4
- */
-class ContainerWindowStateInfo implements WindowStateInfo
-{
- private final WindowState windowState;
- private static final LocalizedString DEFAULT_DESCRIPTION = new LocalizedString("Default window state description.", Locale.ENGLISH);
-
- public ContainerWindowStateInfo(WindowState windowState)
- {
- this.windowState = windowState;
- }
-
- public LocalizedString getDescription()
- {
- return DEFAULT_DESCRIPTION; //fix-me
- }
-
- public WindowState getWindowState()
- {
- return windowState;
- }
-
- public String getWindowStateName()
- {
- return windowState.toString();
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o == null || getClass() != o.getClass())
- {
- return false;
- }
-
- final ContainerWindowStateInfo that = (ContainerWindowStateInfo)o;
-
- return windowState.equals(that.windowState);
-
- }
-
- public int hashCode()
- {
- return windowState.hashCode();
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContentTypes.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContentTypes.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContentTypes.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,351 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.portlet.impl.jsr168.metadata.ContentTypeMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.ContentTypesMetaData;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This object holds the content type and mode capabilities.
- * <p/>
- * Todo : use the media type object ?
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class ContentTypes
-{
- /** Maps MIME Type (String) -> Modes (Set), excluding multiple MIME Types ("*", "* / *", "type / *"). */
- protected final Map singleTypeToPortletModes;
- /** Maps MIME Type (String) -> Modes (Set), including multiple MIME Types ("*", "* / *", "type / *"). */
- protected final Map allTypeToPortletModes;
-
- protected final Set allModes;
-
- protected ContentTypesMetaData metadata;
- protected boolean isStarted = false;
-
- private static final String ALL = "*";
- private static final String ALL_ALL = "*/*";
- private static final char SLASH = '/';
-
- // case-insensitive
- // CONTENT TYPE = TYPE / SUBTYPE
- // SUBTYPE = any char except a TSPECIALS or SPACE or CTLS (??)
- // TSPECIALS ( ) < > @ , ; : \ " / [ ] ? . =
-
- public ContentTypes()
- {
- singleTypeToPortletModes = new HashMap();
- allTypeToPortletModes = new HashMap(); // Including *
- allModes = new HashSet();
- metadata = null;
- }
-
- public ContentTypesMetaData getMetadata()
- {
- return metadata;
- }
-
- public void setMetadata(ContentTypesMetaData metadata)
- {
- isStarted = false;
- initFromMetadata(metadata);
- this.metadata = metadata;
- }
-
- public void start() throws Exception
- {
- initFromMetadata(metadata);
- }
-
- /**
- * Process all the supported content types.
- *
- * @param metadata
- */
- private void initFromMetadata(ContentTypesMetaData metadata)
- {
- if (!isStarted)
- {
- if (metadata == null)
- {
- throw new IllegalArgumentException("Must pass non-null metadata.");
- }
-
- // Reset the collections
- singleTypeToPortletModes.clear();
- allTypeToPortletModes.clear();
- allModes.clear();
-
- // Build info from metadata
- for (Iterator i = metadata.iterator(); i.hasNext();)
- {
- ContentTypeMetaData contentTypeMD = (ContentTypeMetaData)i.next();
-
- // Get the content type
- String contentType = contentTypeMD.getContentType().toLowerCase();
-
- // Add the content type to the view mode
- // because each content type must handle this view
- add(contentType, Mode.VIEW);
-
- // Then process each mode
- Set modes = contentTypeMD.getModes();
- for (Iterator j = modes.iterator(); j.hasNext();)
- {
- Mode mode = (Mode)j.next();
- add(contentType, mode);
- }
- }
- isStarted = true;
- }
- }
-
- public void stop()
- {
-
- }
-
- private void add(String contentType, Mode mode)
- {
- // Determines which map and key to store the mode under
- String key;
- if (ALL.equals(contentType) || ALL_ALL.equals(contentType))
- {
- key = ALL;
- }
- else
- {
- int index = contentType.indexOf(SLASH);
- if (index == -1)
- {
- System.out.println("'" + contentType + "' is not a valid MIME type: ignoring!");
- return;
- }
-
- String type = contentType.substring(0, index);
- String subtype = contentType.substring(index + 1);
-
- if (ALL.equals(subtype))
- {
- key = type;
- }
- else
- {
- key = contentType;
- // This is a single content type so we need to add it to the single mappings in addition to all
- addMode(singleTypeToPortletModes, key, mode);
- }
- }
-
- // Store the mode in the complete mapping
- addMode(allTypeToPortletModes, key, mode);
-
- // Add the mode to the known modes
- allModes.add(mode);
- }
-
- private void addMode(Map map, String key, Mode mode)
- {
- Set modes = (Set)map.get(key);
- if (modes == null)
- {
- modes = new HashSet();
- map.put(key, modes);
- }
- modes.add(mode);
- }
-
- /** Return all modes. */
- public Collection getAllModes()
- {
- return Collections.unmodifiableCollection(allModes);
- }
-
- /** Return all content types. */
- public Collection getAllContentTypes()
- {
- return Collections.unmodifiableCollection(allTypeToPortletModes.keySet());
- }
-
- /**
- * Return true if the mode is supported
- *
- * @throws IllegalArgumentException if the mode is null
- */
- public boolean isModeSupported(Mode mode)
- {
- if (mode == null)
- {
- throw new IllegalArgumentException("Mode must not be null");
- }
- return allModes.contains(mode);
- }
-
- /**
- * Return all the supported modes for this content type.
- *
- * @throws IllegalArgumentException if the content type is null
- */
- public Set getSupportedModes(String contentType)
- {
- if (contentType == null)
- {
- throw new IllegalArgumentException("Content type must not be null");
- }
-
- int index = contentType.indexOf(SLASH);
- if (index == -1)
- {
- // Not valid content type so return empty set
- return Collections.EMPTY_SET;
- }
-
- //
- Set set = new HashSet();
-
- //
- Set contentTypeModes = (Set)singleTypeToPortletModes.get(contentType.toLowerCase());
- if (contentTypeModes != null)
- {
- set.addAll(contentTypeModes);
- }
-
- //
- Set typeModes = (Set)allTypeToPortletModes.get(contentType.substring(0, index).toLowerCase());
- if (typeModes != null)
- {
- set.addAll(typeModes);
- }
-
- Set wildcardModes = (Set)allTypeToPortletModes.get(ALL);
- if (wildcardModes != null)
- {
- set.addAll(wildcardModes);
- }
-
- return set;
- }
-
- /**
- * Return true if the content type is supported.
- *
- * @throws IllegalArgumentException if the content type is null
- */
- public boolean isContentTypeSupported(String contentType)
- {
- Collection allContentTypes = getAllContentTypes();
- if (contentType == null)
- {
- throw new IllegalArgumentException("Content type must not be null");
- }
-
- int index = contentType.indexOf(SLASH);
- if (index == -1)
- {
- // Not valid content type so return false
- return false;
- }
-
- // Try the content type, * or */*
- if (allContentTypes.contains(contentType) |
- allContentTypes.contains(contentType.toLowerCase()) |
- allContentTypes.contains(ALL) |
- allContentTypes.contains(ALL_ALL))
- {
- return true;
- }
-
- // Try xxx/*
- String wildcard = contentType.substring(0, index) + "/*";
- return allContentTypes.contains(wildcard) | allContentTypes.contains(wildcard.toLowerCase());
- }
-
- /**
- * Return true if the given content type is supported for the given mode.
- *
- * @throws IllegalArgumentException if the content type or the mode is null
- */
- public boolean isSupported(Mode mode, String contentType)
- {
- if (mode == null)
- {
- throw new IllegalArgumentException("Mode must not be null");
- }
- if (contentType == null)
- {
- throw new IllegalArgumentException("Content type must not be null");
- }
-
- int index = contentType.indexOf(SLASH);
- if (index == -1)
- {
- // Not valid content type so return false
- return false;
- }
-
- // Try full name matching
- Set contentTypeModes = (Set)singleTypeToPortletModes.get(contentType);
- if (contentTypeModes != null && contentTypeModes.contains(mode))
- {
- return true;
- }
-
- // Try full name lowercase matching
- Set lowercaseContentTypeModes = (Set)singleTypeToPortletModes.get(contentType.toLowerCase());
- if (lowercaseContentTypeModes != null && lowercaseContentTypeModes.contains(mode))
- {
- return true;
- }
-
- // Try type matching
- String type = contentType.substring(0, index);
- Set typeMode = (Set)allTypeToPortletModes.get(type);
- if (typeMode != null && typeMode.contains(mode))
- {
- return true;
- }
-
- // Try type matching
- Set lowercaseTypeMode = (Set)allTypeToPortletModes.get(type.toLowerCase());
- if (lowercaseTypeMode != null && lowercaseTypeMode.contains(mode))
- {
- return true;
- }
-
- // Try wildcard matching
- Set wildcardMode = (Set)allTypeToPortletModes.get(ALL);
- return wildcardMode != null && wildcardMode.contains(mode);
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/InfoBundle.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/InfoBundle.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/InfoBundle.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,93 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.portlet.impl.jsr168.APIConstants;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListResourceBundle;
-import java.util.Locale;
-
-/**
- * A resource bundle that contains the inline information defined by the portlet specification.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class InfoBundle extends ListResourceBundle
-{
-
- private static final Logger log = Logger.getLogger(InfoBundle.class);
-
- /** . */
- private final Object[][] content;
-
- public InfoBundle(LanguagesMetaData.InfoMetaData metaData)
- {
- log.debug("Creates the parent bundle");
-
- //
- List list = new ArrayList(3);
-
- //
- String title = metaData.getTitle();
- if (title == null)
- {
- throw new IllegalArgumentException("Title must be provided");
- }
- list.add(new Object[]{APIConstants.JAVAX_PORTLET_TITLE, title});
-
- //
- if (metaData.getShortTitle() != null)
- {
- list.add(new Object[]{APIConstants.JAVAX_PORTLET_SHORT_TITLE, metaData.getShortTitle()});
- }
-
- //
- if (metaData.getKeywords() != null)
- {
- list.add(new Object[]{APIConstants.JAVAX_PORTLET_KEYWORDS, metaData.getKeywords()});
- }
-
- //
- content = (Object[][])list.toArray(new Object[list.size()][]);
- }
-
- protected Object[][] getContents()
- {
- return content;
- }
-
- /**
- * This is the english locale.
- *
- * @return the english locale
- */
- public Locale getLocale()
- {
- return Locale.ENGLISH;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/PortletResourceBundleManager.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/PortletResourceBundleManager.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/PortletResourceBundleManager.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,194 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.common.util.EmptyResourceBundle;
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.common.util.ParentChildResourceBundle;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Manage resource bundles for a portlet.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class PortletResourceBundleManager
-{
-
- private Logger log = Logger.getLogger(PortletResourceBundleManager.class);
-
- /** */
- private Map localeBundles;
-
- /** */
- private String baseName;
-
- /** */
- private ClassLoader classLoader;
-
- /** */
- private ResourceBundle infoBundle;
-
- /** */
- private Collection supportedLocales;
-
- public PortletResourceBundleManager(ClassLoader classLoader, LanguagesMetaData metaData)
- {
- if (classLoader == null)
- {
- throw new IllegalArgumentException("Need a non null classloader");
- }
- if (metaData == null)
- {
- throw new IllegalArgumentException("Need non null meta data");
- }
- this.classLoader = classLoader;
- this.baseName = metaData.getResourceBundle();
- this.localeBundles = new HashMap();
- this.supportedLocales = metaData.getSupportedLocales();
-
- // Get the resource bundle containing the portlet info
- LanguagesMetaData.InfoMetaData infoMD = metaData.getInfo();
- if (infoMD != null)
- {
- infoBundle = new InfoBundle(infoMD);
- }
- else
- {
- infoBundle = new EmptyResourceBundle();
- }
- }
-
- /**
- * Return a localized value constructed from the various resource bundles. The supported locales of the manager are
- * used in combination with the specified key. The default value is used if no value is found for the
- * <code>Locale.ENGLISH</code>.
- *
- * @param key the key to lookup in the bundles
- * @param defaultValue
- * @return the localized string
- * @throws IllegalArgumentException if the key of the default value is null
- */
- public LocalizedString getLocalizedValue(String key, String defaultValue) throws IllegalArgumentException
- {
- if (key == null)
- {
- throw new IllegalArgumentException("No null key accepted");
- }
- if (defaultValue == null)
- {
- throw new IllegalArgumentException("No null default value accepted");
- }
- Map m = new HashMap();
- for (Iterator j = supportedLocales.iterator(); j.hasNext();)
- {
- try
- {
- Locale locale = (Locale)j.next();
- ResourceBundle bundle = getResourceBundle(locale);
- String localizedDisplayName = bundle.getString(key);
- m.put(locale, localizedDisplayName);
- }
- catch (MissingResourceException ignore)
- {
- }
- }
- if (!m.containsKey(Locale.ENGLISH))
- {
- m.put(Locale.ENGLISH, defaultValue);
- }
- return new LocalizedString(m, Locale.ENGLISH);
- }
-
- /**
- * Return a bundle for the given locale. If the complete locale (language + country + variant) does not exist then it
- * falls back to (language + country) or (language) or the default file.
- * <p/>
- * When the resource bundle object is found and was not in the global map, it put it in that map with a copy on
- * write.
- *
- * @throws IllegalArgumentException if the locale is null
- */
- public ResourceBundle getResourceBundle(Locale locale) throws IllegalArgumentException
- {
- // Arg check
- if (locale == null)
- {
- throw new IllegalArgumentException("Locale cannot be null");
- }
-
- // Try to get the bundle if the map
- ResourceBundle bundle = (ResourceBundle)localeBundles.get(locale);
- if (bundle != null)
- {
- return bundle;
- }
-
- //
- log.debug("Want to load bundle " + baseName + " for locale " + locale);
-
- if (baseName == null)
- {
- bundle = infoBundle;
- }
- else
- {
- try
- {
- bundle = ResourceBundle.getBundle(baseName, locale, classLoader);
- if (infoBundle != null)
- {
- bundle = new ParentChildResourceBundle(infoBundle, bundle);
- }
- log.debug("Created bundle " + baseName + " for locale " + locale);
- }
- catch (MissingResourceException e)
- {
- log.warn("Bundle " + baseName + " for locale " + locale + " not found");
- bundle = infoBundle;
- }
- }
-
- // Cache the bundle
- if (bundle != null)
- {
- Map copy = new HashMap(localeBundles);
- copy.put(locale, bundle);
- localeBundles = copy;
- }
-
- //
- return bundle;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/container/info/Utils.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/info/Utils.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/info/Utils.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,57 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.container.info;
-
-import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LocalizedStringMetaData;
-import org.jboss.portal.portlet.impl.jsr168.metadata.LocalizedValueMetaData;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class Utils
-{
-
- private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
-
- public static LocalizedString getLocalizedDescription(LocalizedStringMetaData describable)
- {
- Map m = new HashMap();
- for (int i = 0; i < describable.getValues().size(); i++)
- {
- LocalizedValueMetaData descriptionMD = (LocalizedValueMetaData)describable.getValues().get(i);
- Locale locale = descriptionMD.getLocale();
- if (locale == null)
- {
- locale = DEFAULT_LOCALE;
- }
- m.put(locale, descriptionMD.getValue());
- }
- return new LocalizedString(m, DEFAULT_LOCALE);
- }
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/JBossApplicationMetaDataFactory.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/JBossApplicationMetaDataFactory.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/JBossApplicationMetaDataFactory.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -23,7 +23,7 @@
package org.jboss.portal.portlet.deployment;
import org.jboss.portal.common.transaction.Transactions;
-import org.jboss.portal.portlet.container.info.ContainerCacheInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerCacheInfo;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
import org.jboss.portal.portlet.metadata.PolicyPermissionMetaData;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -35,7 +35,7 @@
import org.jboss.portal.common.xml.NullEntityResolver;
import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
import org.jboss.portal.portlet.container.PortletApplicationRegistry;
-import org.jboss.portal.portlet.container.PortletContainerAdapter;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerAdapter;
import org.jboss.portal.portlet.deployment.JBossApplicationMetaDataFactory;
import org.jboss.portal.portlet.deployment.PortletApplicationMetaDataFactory;
import org.jboss.portal.portlet.impl.jsr168.APIFactory;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactory.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactory.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactory.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -24,6 +24,10 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactoryImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactoryImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/APIFactoryImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -24,6 +24,10 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,130 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.portlet.PortletParameters;
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.spi.ActionContext;
-
-import javax.portlet.ActionRequest;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ActionRequestImpl extends PortletRequestImpl implements ActionRequest
-{
-
- /** . */
- protected final ActionContext actionContext;
-
- public ActionRequestImpl(ActionInvocation invocation)
- {
- super(invocation);
- this.actionContext = (ActionContext)invocation.getPortletContext();
-
- // Get the possibly null interaction state
- StateString interactionState = actionContext.getInteractionState();
-
- // Take care of the interaction state if any
- if (interactionState != null)
- {
- // Unserialize the interaction state if necessary
- PortletParametersStateString parametersState = null;
- if (interactionState instanceof PortletParametersStateString)
- {
- parametersState = (PortletParametersStateString)interactionState;
- }
- else
- {
- parametersState = new PortletParametersStateString(interactionState.getStringValue());
- }
-
- //
- parameters = parametersState.getParameters();
- }
-
- //
- PortletParameters form = actionContext.getForm();
- if (form != null)
- {
- if (parameters == null)
- {
- parameters = form;
- }
- else
- {
- parameters = new PortletParameters(parameters);
- parameters.append(form);
- }
- }
- }
-
- //
-
- public InputStream getPortletInputStream() throws IOException
- {
- if ("application/x-www-form-urlencoded".equals(actionContext.getContentType()))
- {
- throw new IllegalStateException();
- }
- return actionContext.getInputStream();
- }
-
- public void setCharacterEncoding(String s) throws UnsupportedEncodingException
- {
- // This method is frankly stupid
- throw new IllegalStateException("called after the body has been read");
- // req.setCharacterEncoding(s);
- }
-
- public BufferedReader getReader() throws UnsupportedEncodingException, IOException
- {
- if ("application/x-www-form-urlencoded".equals(actionContext.getContentType()))
- {
- throw new IllegalStateException();
- }
- return actionContext.getReader();
- }
-
- public String getCharacterEncoding()
- {
- return actionContext.getCharacterEncoding();
- }
-
- public String getContentType()
- {
- return actionContext.getContentType();
- }
-
- public int getContentLength()
- {
- return actionContext.getContentLength();
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,200 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.RedirectionResponse;
-import org.jboss.portal.portlet.invocation.response.RenderResponse;
-
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletModeException;
-import javax.portlet.WindowState;
-import javax.portlet.WindowStateException;
-import java.io.IOException;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ActionResponseImpl extends PortletResponseImpl implements ActionResponse
-{
-
- private static final Logger log = Logger.getLogger(ActionResponseImpl.class);
-
- protected static final int WANT_NOTHING = 0;
- protected static final int WANT_RENDER = 1;
- protected static final int WANT_REDIRECT = 2;
-
- protected PortletInvocationResponse response;
- protected int decision;
-
- public ActionResponseImpl(ActionInvocation invocation, PortletRequestImpl preq)
- {
- super(invocation, preq);
-
- //
- RenderResponse rr = new RenderResponse();
- rr.setNavigationalState(new PortletParametersStateString());
-
- //
- this.response = rr;
- this.decision = WANT_NOTHING;
- }
-
- public PortletInvocationResponse getResult()
- {
- return response;
- }
-
- public void setWindowState(WindowState windowState) throws WindowStateException
- {
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
- {
- if (!preq.isWindowStateAllowed(windowState))
- {
- throw new WindowStateException("Not supported", windowState);
- }
- ((RenderResponse)response).setWindowState(org.jboss.portal.WindowState.create(windowState.toString()));
- decision = WANT_RENDER;
- }
- else
- {
- throw new IllegalStateException("Window state cannot be set after redirect");
- }
- }
-
- public void setPortletMode(PortletMode portletMode) throws PortletModeException
- {
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
- {
- if (portletMode == null)
- {
- // The spec does not define that case
- // we just issue a warn
- log.warn("Set null portlet mode");
- }
- else
- {
- if (!preq.isPortletModeAllowed(portletMode))
- {
- throw new PortletModeException("Not supported", portletMode);
- }
- Mode mode = Mode.create(portletMode.toString());
- ((RenderResponse)response).setMode(mode);
- }
- decision = WANT_RENDER;
- }
- else
- {
- throw new IllegalStateException("Portlet mode cannot be set after redirect");
- }
- }
-
- public void sendRedirect(String location) throws IOException
- {
- if (location == null)
- {
- // do something more clever than simply returning
- return;
- }
- URLTools.enforceAbsoluteURL(location);
- sendRedirect(new HTTPRedirectionResponse(location));
- }
-
- /**
- * Generic send redirect.
- *
- * @param redirect
- * @throws IllegalStateException implement jsr168 behavior if the portlet as already commited stuff
- */
- protected final void sendRedirect(RedirectionResponse redirect) throws IllegalStateException
- {
- if (decision == WANT_NOTHING || decision == WANT_REDIRECT)
- {
- response = redirect;
- decision = WANT_REDIRECT;
- }
- else
- {
- throw new IllegalStateException("sendRedirect cannot be called after " +
- "setPortletMode/setWindowState/setRenderParameter/setRenderParameters " +
- "has been called previously");
- }
- }
-
- public void setRenderParameters(Map map)
- {
- PortletUtils.checkPortletParameterMapValidity(map);
-
- //
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
- {
- ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).replace(map);
- decision = WANT_RENDER;
- }
- else
- {
- throw new IllegalStateException("setRenderParameters cannot be called after redirect");
- }
- }
-
- public void setRenderParameter(String name, String value)
- {
- PortletUtils.checkPortletParameterValidity(name, value);
-
- //
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
- {
- ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).setValue(name, value);
- decision = WANT_RENDER;
- }
- else
- {
- throw new IllegalStateException("setRenderParameter cannot be called after redirect");
- }
- }
-
- public void setRenderParameter(String name, String[] values)
- {
- PortletUtils.checkPortletParameterValidity(name, values);
-
- //
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
- {
- ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).setValues(name, values);
- decision = WANT_RENDER;
- }
- else
- {
- throw new IllegalStateException("setRenderParameter cannot be called after redirect");
- }
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortalContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortalContextImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortalContextImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,108 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.spi.PortalContext;
-import org.jboss.portal.server.PortalConstants;
-
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * todo : does not provide customizable values for portlet modes and window states.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalContextImpl implements javax.portlet.PortalContext
-{
-
- private PortalContext portal;
- private Map properties;
- private Set supportedPortletModes;
- private Set supportedWindowStates;
-
- public PortalContextImpl(PortalContext portal)
- {
- if (portal == null)
- {
- throw new IllegalArgumentException("Must provide a non-null PortalContext!");
- }
- this.portal = portal;
- this.properties = portal.getProperties();
- }
-
- public String getPortalInfo()
- {
- return PortalConstants.VERSION.toString();
- }
-
- public String getProperty(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("Must provide a non-null property name");
- }
- return (String)properties.get(name);
- }
-
- public Enumeration getPropertyNames()
- {
- return Tools.toEnumeration(properties.keySet().iterator());
- }
-
- public Enumeration getSupportedPortletModes()
- {
- if (supportedPortletModes == null)
- {
- Set tmp = portal.getModes();
- supportedPortletModes = new HashSet(tmp.size());
- for (Iterator i = tmp.iterator(); i.hasNext();)
- {
- Mode mode = (Mode)i.next();
- supportedPortletModes.add(PortletUtils.decodePortletMode(mode.toString()));
- }
- }
- return Tools.toEnumeration(supportedPortletModes.iterator());
- }
-
- public Enumeration getSupportedWindowStates()
- {
- if (supportedWindowStates == null)
- {
- Set tmp = portal.getWindowStates();
- supportedWindowStates = new HashSet(tmp.size());
- for (Iterator i = tmp.iterator(); i.hasNext();)
- {
- org.jboss.portal.WindowState windowState = (org.jboss.portal.WindowState)i.next();
- supportedWindowStates.add(PortletUtils.decodeWindowState(windowState.toString()));
- }
- }
- return Tools.toEnumeration(supportedWindowStates.iterator());
- }
-}
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,214 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.portlet.impl.jsr168.APIFactory;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletContextImpl;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
+import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
+import org.jboss.portal.portlet.container.PortletApplicationRegistrationContext;
+import org.jboss.portal.portlet.container.PortletContainer;
+
+import javax.portlet.PortletContext;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletApplicationImpl extends AbstractJBossService implements PortletApplication
+{
+
+ /** . */
+ protected LinkedHashMap portlets;
+
+ /** . */
+ protected PortletApplicationMetaData metaData;
+
+ /** . */
+ protected JBossApplicationMetaData jbossMetaData;
+
+ /** . */
+ protected PortletApplicationContext context;
+
+ /** . */
+ protected PortletContext portletContext;
+
+ /** . */
+ protected String version;
+
+ /** . */
+ protected Map portletModes;
+
+ /** . */
+ protected Map windowStates;
+
+ /** . */
+ protected APIFactory apiFactory;
+
+ /** . */
+ protected PortletApplicationRegistrationContext registrationContext;
+
+ public PortletApplicationImpl(
+ PortletApplicationMetaData metaData,
+ JBossApplicationMetaData jbossMetaData,
+ PortletApplicationContext context)
+ {
+ this.metaData = metaData;
+ this.jbossMetaData = jbossMetaData;
+ this.portlets = new LinkedHashMap();
+ this.context = context;
+ }
+
+ public String getId()
+ {
+ return metaData.getId();
+ }
+
+ public PortletApplicationRegistrationContext getRegistrationContext()
+ {
+ return registrationContext;
+ }
+
+ public void setRegistrationContext(PortletApplicationRegistrationContext registrationContext)
+ {
+ this.registrationContext = registrationContext;
+ }
+
+ public APIFactory getAPIFactory()
+ {
+ return apiFactory;
+ }
+
+ public void setAPIFactory(APIFactory apiFactory)
+ {
+ this.apiFactory = apiFactory;
+ }
+
+ public PortletApplicationMetaData getMetaData()
+ {
+ return metaData;
+ }
+
+ public JBossApplicationMetaData getJBossMetaData()
+ {
+ return jbossMetaData;
+ }
+
+ public void addContainer(PortletContainer container)
+ {
+ portlets.put(container.getId(), container);
+ registrationContext.registerPortlet(container);
+ }
+
+ public void removeContainer(PortletContainer container)
+ {
+ registrationContext.unregisterPortlet(container);
+ portlets.remove(container.getId());
+ }
+
+ //
+
+ public void startService() throws Exception
+ {
+ super.startService();
+
+ //
+ version = metaData.getVersion();
+ portletModes = metaData.getPortletModes();
+ windowStates = metaData.getWindowStates();
+ portletContext = new PortletContextImpl(context.getServletContext());
+ }
+
+ public void stopService() throws Exception
+ {
+ //
+ version = null;
+ portletModes = null;
+ windowStates = null;
+ portletContext = null;
+
+ //
+ super.stopService();
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public PortletContext getPortletContext()
+ {
+ return portletContext;
+ }
+
+ public Map getPortletModes()
+ {
+ return portletModes;
+ }
+
+ public Map getWindowStates()
+ {
+ return windowStates;
+ }
+
+ public void start(String portletName) throws Exception
+ {
+ context.startPortlet(portletName);
+ }
+
+ public void stop(String portletName) throws Exception
+ {
+ context.stopPortlet(portletName);
+ }
+
+ // WebApp implementation ********************************************************************************************
+
+ public Set getPortletContainers()
+ {
+ return new HashSet(portlets.values());
+ }
+
+ public PortletContainer getPortletContainer(String name)
+ {
+ return (PortletContainer)portlets.get(name);
+ }
+
+ public PortletApplicationContext getContext()
+ {
+ return context;
+ }
+
+ // Container implementation *****************************************************************************************
+
+ public String toString()
+ {
+ return "PortletWebApp[" + metaData.getId() + "]";
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletConfigImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletConfigImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletConfigImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,87 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.portlet.container.info.PortletResourceBundleManager;
-
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletContext;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletConfigImpl implements PortletConfig
-{
-
- private String portletName;
- private PortletContext portletContext;
- private Map initParameters;
- private PortletResourceBundleManager bundleMgr;
-
- public PortletConfigImpl(String portletName,
- PortletContext portletContext,
- Map initParameters,
- PortletResourceBundleManager bundleMgr)
- {
- this.portletName = portletName;
- this.portletContext = portletContext;
- this.initParameters = initParameters;
- this.bundleMgr = bundleMgr;
- }
-
- public String getPortletName()
- {
- return portletName;
- }
-
- public PortletContext getPortletContext()
- {
- return portletContext;
- }
-
- /** May return null ? the spec does not specify what happens when the bundle is not found for the locale. */
- public ResourceBundle getResourceBundle(Locale locale)
- {
- return bundleMgr.getResourceBundle(locale);
- }
-
- public String getInitParameter(String s)
- {
- if (s == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
- return (String)initParameters.get(s);
- }
-
- public Enumeration getInitParameterNames()
- {
- return Collections.enumeration(initParameters.keySet());
- }
-}
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainerAdapter.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,85 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.container.PortletApplicationContextImpl;
+import org.jboss.portal.portlet.container.PortletContainer;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletContainerAdapter
+{
+
+ /** . */
+ private PortletMetaData portletMD;
+
+ /** . */
+ private JBossPortletMetaData jbossPortletMD;
+
+ /** . */
+ private PortletApplicationContextImpl portletApplicationContext;
+
+ /** . */
+ private PortletContainerImpl portletContainer;
+
+ public PortletContainerAdapter(PortletMetaData portletMD, JBossPortletMetaData jbossPortletMD)
+ {
+ this.portletMD = portletMD;
+ this.jbossPortletMD = jbossPortletMD;
+ }
+
+ public PortletApplicationContextImpl getPortletApplicationContext()
+ {
+ return portletApplicationContext;
+ }
+
+ public void setPortletWebAppAdapter(PortletApplicationContextImpl portletApplicationContext)
+ {
+ this.portletApplicationContext = portletApplicationContext;
+ }
+
+ public PortletContainer getPortletContainer()
+ {
+ return portletContainer;
+ }
+
+ public void start() throws Exception
+ {
+ PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
+ portletContainer = new PortletContainerImpl(portletApp, portletMD, jbossPortletMD);
+ portletContainer.start();
+ portletApp.addContainer(portletContainer);
+ }
+
+ public void stop()
+ {
+ PortletApplicationImpl portletApp = portletApplicationContext.getPortletApplication();
+ portletApp.removeContainer(portletContainer);
+ portletContainer.stop();
+ portletContainer = null;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerAdapter.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,517 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletConfigImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.info.PortletResourceBundleManager;
+import org.jboss.portal.portlet.container.PortletInitializationException;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.impl.jsr168.info.ContentTypes;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletPreferencesMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.SecurityRoleRefMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.ParameterMetaData;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.SecurityErrorResponse;
+import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
+import org.jboss.portal.common.concurrent.Valve;
+import org.jboss.portal.common.invocation.InvocationException;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.Portlet;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.UnavailableException;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Collections;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6365 $
+ */
+public class PortletContainerImpl implements PortletContainer
+{
+
+ /** Logger. */
+ protected final Logger log;
+
+ /** . */
+ protected PortletApplicationImpl application;
+
+ /** . */
+ protected PortletMetaData metaData;
+
+ /** . */
+ protected JBossPortletMetaData jbossMetaData;
+
+ /** The portlet implementation class name. */
+ protected String className;
+
+ /** The portlet config. */
+ protected PortletConfig config;
+
+ /** The portlet instance. */
+ protected Portlet portlet;
+
+ /** . */
+ protected ContentTypes contentTypes;
+
+ /** . */
+ protected PortletResourceBundleManager bundleMgr;
+
+ /** The invocation valve. */
+ protected final Valve valve;
+
+ /** Give the correspondance between role name and role link. */
+ protected Map securityRoleRefsMap;
+
+ /** Are we started or not. */
+ protected boolean started;
+
+ /** User data constraint. */
+ protected Set userDataConstraints;
+
+ /** Return info. */
+ protected PortletInfo info;
+
+ /**
+ * The preference validator, this is not exposed as runtime meta data as it is only used by the JSR 168 portlet
+ * container implementation.
+ */
+ protected PreferencesValidator preferencesValidator;
+
+ public PortletContainerImpl(PortletApplicationImpl application, PortletMetaData metaData, JBossPortletMetaData jbossMetaData)
+ {
+ this.application = application;
+ this.metaData = metaData;
+ this.jbossMetaData = jbossMetaData;
+ this.valve = new Valve();
+ this.log = Logger.getLogger("org.jboss.portal.portlet.container." + metaData.getClassName().replace('.', '_'));
+ this.started = false;
+ }
+
+ public PortletInfo getInfo()
+ {
+ return info;
+ }
+
+ public String getId()
+ {
+ return metaData.getName();
+ }
+
+ public PortletMetaData getMetaData()
+ {
+ return metaData;
+ }
+
+ public JBossPortletMetaData getJBossMetaData()
+ {
+ return jbossMetaData;
+ }
+
+ public boolean isStarted()
+ {
+ return valve.getState() == Valve.OPEN;
+ }
+
+ public void start() throws Exception, PortletInitializationException
+ {
+ // Set class name
+ this.className = metaData.getClassName();
+
+ //
+ PortletPreferencesMetaData preferences = metaData.getPreferences();
+ if (preferences != null)
+ {
+ String validatorClassName = preferences.getValidator();
+ if (validatorClassName != null)
+ {
+ try
+ {
+ ClassLoader loader = application.getContext().getClassLoader();
+
+ //
+ if (validatorClassName != null)
+ {
+ // Load the class
+ Class preferencesValidatorClass = loader.loadClass(validatorClassName);
+ preferencesValidator = (PreferencesValidator)preferencesValidatorClass.newInstance();
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.error("Class for preference validator not found", e);
+ }
+ catch (InstantiationException e)
+ {
+ log.error("Cannot instantiate preference validator", e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new Error();
+ }
+ }
+ }
+
+ // Security role ref
+ Map securityRoleRefsMap = new HashMap();
+ for (Iterator i = metaData.getSecurityRoleRefs().iterator(); i.hasNext();)
+ {
+ SecurityRoleRefMetaData securityRoleRefMD = (SecurityRoleRefMetaData)i.next();
+ securityRoleRefsMap.put(securityRoleRefMD.getRoleName(), securityRoleRefMD.getRoleLink());
+ }
+
+ // Init parameters
+ Map initParameters = new HashMap();
+ for (Iterator i = metaData.getParameters().values().iterator(); i.hasNext();)
+ {
+ ParameterMetaData parameterMD = (ParameterMetaData)i.next();
+ initParameters.put(parameterMD.getName(), parameterMD.getValue());
+ }
+
+ // Portlet config object
+ PortletResourceBundleManager bundleMgr = new PortletResourceBundleManager(application.getContext().getClassLoader(), metaData.getLanguages());
+
+ //
+ PortletConfig config = new PortletConfigImpl(
+ metaData.getName(),
+ application.getPortletContext(),
+ initParameters,
+ bundleMgr);
+
+ //
+ ContentTypes contentTypes = new ContentTypes();
+ contentTypes.setMetadata(metaData.getContentTypes());
+ contentTypes.start();
+
+ //
+ PortletInfo info = new ContainerPortletInfo(this, bundleMgr, contentTypes);
+
+ // Finally initialize the porlet instance
+ try
+ {
+ log.debug("Loading portlet class " + className);
+ Class portletClass = application.getContext().getClassLoader().loadClass(className);
+ log.debug("Creating portlet object " + className);
+ Portlet portlet = (Portlet)portletClass.newInstance();
+ log.debug("Created portlet object " + className);
+ initPortlet(portlet, config);
+ log.debug("Initialized portlet object " + className);
+
+ // We are safe, update state
+ this.portlet = portlet;
+ this.config = config;
+ this.securityRoleRefsMap = Collections.unmodifiableMap(securityRoleRefsMap);
+ this.contentTypes = contentTypes;
+ this.bundleMgr = bundleMgr;
+ this.info = info;
+ this.started = true;
+
+ // Let invocation flow in
+ valve.open();
+
+ // Register
+ // webApp.addContainer(this);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new PortletInitializationException("Portlet class not accessible " + className, e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new PortletInitializationException("Portlet class not found " + className, e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new PortletInitializationException("Portlet class cannot be instantiated " + className, e);
+ }
+ catch (PortletException e)
+ {
+ throw new PortletInitializationException("The portlet " + getId() + " threw a portlet exception during init", e);
+ }
+ catch (RuntimeException e)
+ {
+ throw new PortletInitializationException("The portlet " + getId() + " threw a runtime exception during init", e);
+ }
+ catch (Error e)
+ {
+ throw new PortletInitializationException("The portlet " + getId() + " threw an error during init", e);
+ }
+ }
+
+ public void stop()
+ {
+ //
+ // webApp.removeContainer(this);
+
+ // Wait at most 60 seconds before all invocations are done
+ log.debug("Trying to close the valve");
+ boolean done = valve.closing(60000);
+ if (!done)
+ {
+ log.warn("The valve is still holding invocations, continue anyway");
+ }
+
+ //
+ valve.closed();
+
+ //
+ if (started)
+ {
+ //
+ started = false;
+
+ // Destroy the portlet object
+ destroyPortlet(portlet);
+
+ // Stop the plugins (static)
+ contentTypes.stop();
+
+ // Update state
+ preferencesValidator = null;
+ className = null;
+ portlet = null;
+ securityRoleRefsMap = null;
+ config = null;
+ contentTypes = null;
+ userDataConstraints = null;
+ info = null;
+ }
+ }
+
+ public PortletConfig getConfig()
+ {
+ return config;
+ }
+
+ public Portlet getPortlet()
+ {
+ return portlet;
+ }
+
+ public ContentTypes getContentTypes()
+ {
+ return contentTypes;
+ }
+
+ public Map getSecurityRoleRefsMap()
+ {
+ return securityRoleRefsMap;
+ }
+
+ public PortletApplication getApplication()
+ {
+ return application;
+ }
+
+ public Valve getValve()
+ {
+ return valve;
+ }
+
+ public Set getUserDataConstraints()
+ {
+ return userDataConstraints;
+ }
+
+ public PreferencesValidator getPreferencesValidator()
+ {
+ return preferencesValidator;
+ }
+
+ public String toString()
+ {
+ return "PortletContainer[name=" + getId() + ",+application=" + application.getId() + "]";
+ }
+
+ /** Initialize the portlet. */
+ private void initPortlet(Portlet portlet, PortletConfig config) throws PortletException
+ {
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ // Set the war loader for the request
+ ClassLoader newLoader = application.getContext().getClassLoader();
+ Thread.currentThread().setContextClassLoader(newLoader);
+ portlet.init(config);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ /** Destroy the portlet. */
+ private void destroyPortlet(Portlet portlet)
+ {
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ // Set the war loader for the request
+ ClassLoader newLoader = application.getContext().getClassLoader();
+ Thread.currentThread().setContextClassLoader(newLoader);
+ if (portlet != null)
+ {
+ portlet.destroy();
+ }
+ else
+ {
+ log.debug("Cannot call destroy, portlet was null");
+ }
+ }
+ catch (RuntimeException e)
+ {
+ log.error("The portlet threw a runtime exception", e);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
+ public PortletInvocationResponse dispatch(PortletInvocation invocation) throws PortletInvokerException, InvocationException
+ {
+ try
+ {
+ if (invocation instanceof ActionInvocation)
+ {
+ return invokeAction((ActionInvocation)invocation);
+ }
+ else if (invocation instanceof RenderInvocation)
+ {
+ return invokeRender((RenderInvocation)invocation);
+ }
+ else
+ {
+ throw new InvocationException("Unexpected invocation " + invocation);
+ }
+ }
+ catch (NoClassDefFoundError e)
+ {
+ //
+ return new ErrorResponse(e);
+ }
+ catch (Exception e)
+ {
+ log.error("The portlet threw an exception", e);
+
+ //
+ if (e instanceof PortletSecurityException)
+ {
+ return new SecurityErrorResponse(e);
+ }
+ else if (e instanceof UnavailableException)
+ {
+ UnavailableException ue = (UnavailableException)e;
+ if (ue.isPermanent())
+ {
+ return new UnavailableResponse();
+ }
+ else
+ {
+ return new UnavailableResponse(ue.getUnavailableSeconds());
+ }
+ }
+ else
+ {
+ // The exception is either a PortletException, an IOException or a RuntimeException
+ return new ErrorResponse(e);
+ }
+ }
+ }
+
+ protected PortletInvocationResponse invokeAction(ActionInvocation invocation) throws IOException, PortletException
+ {
+ APIFactory factory = application.getAPIFactory();
+ ActionRequestImpl areq = factory.createActionRequest(invocation);
+ ActionResponseImpl aresp = factory.createActionResponse(invocation, areq);
+ HttpServletRequest dreq = invocation.getDispatchedRequest();
+ try
+ {
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, areq);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, aresp);
+ dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
+ portlet.processAction(areq, aresp);
+ }
+ finally
+ {
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
+ dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ }
+
+ return aresp.getResult();
+ }
+
+ protected PortletInvocationResponse invokeRender(RenderInvocation invocation) throws IOException, PortletException
+ {
+ APIFactory factory = application.getAPIFactory();
+ RenderRequestImpl rreq = factory.createRenderRequest(invocation);
+ RenderResponseImpl rresp = factory.createRenderResponse(invocation, rreq);
+ HttpServletRequest dreq = invocation.getDispatchedRequest();
+ try
+ {
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, rreq);
+ dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, rresp);
+ dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
+ portlet.render(rreq, rresp);
+ }
+ finally
+ {
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
+ dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
+ dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ }
+
+ return rresp.getResult();
+ }
+
+
+}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContextImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContextImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,186 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.server.PortalConstants;
-
-import javax.portlet.PortletContext;
-import javax.portlet.PortletRequestDispatcher;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletContext;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletContextImpl implements PortletContext
-{
-
- private ServletContext servletContext;
-
- public PortletContextImpl(ServletContext servletContext)
- {
- this.servletContext = servletContext;
- }
-
- public String getServerInfo()
- {
- return "JBossPortal/" + PortalConstants.VERSION.getMajor() + "." + PortalConstants.VERSION.getMinor();
- }
-
- public PortletRequestDispatcher getRequestDispatcher(String path)
- {
- if (path == null || !path.startsWith("/"))
- {
- return null;
- }
- RequestDispatcher rd = servletContext.getRequestDispatcher(path);
- if (rd != null)
- {
- return new PortletRequestDispatcherImpl(rd, path);
- }
- else
- {
- return null;
- }
- }
-
- public PortletRequestDispatcher getNamedDispatcher(String name)
- {
- if (name == null)
- {
- return null;
- }
- RequestDispatcher rd = servletContext.getNamedDispatcher(name);
- if (rd != null)
- {
- return new PortletRequestDispatcherImpl(rd);
- }
- else
- {
- return null;
- }
- }
-
- public InputStream getResourceAsStream(String s)
- {
- return servletContext.getResourceAsStream(s);
- }
-
- public int getMajorVersion()
- {
- return 1;
- }
-
- public int getMinorVersion()
- {
- return 0;
- }
-
- public String getMimeType(String s)
- {
- return servletContext.getMimeType(s);
- }
-
- public String getRealPath(String s)
- {
- return servletContext.getRealPath(s);
- }
-
- public Set getResourcePaths(String s)
- {
- return servletContext.getResourcePaths(s);
- }
-
- public URL getResource(String s) throws MalformedURLException
- {
- if (s == null || !s.startsWith("/"))
- {
- throw new MalformedURLException("invalid resource");
- }
- URL resource = servletContext.getResource(s);
- return resource;
- }
-
- public Object getAttribute(String s)
- {
- if (s == null)
- {
- throw new IllegalArgumentException("attribute name must not be null");
- }
- return servletContext.getAttribute(s);
- }
-
- public Enumeration getAttributeNames()
- {
- return servletContext.getAttributeNames();
- }
-
- public String getInitParameter(String s)
- {
- if (s == null)
- {
- throw new IllegalArgumentException("init parameter name must not be null");
- }
- return servletContext.getInitParameter(s);
- }
-
- public Enumeration getInitParameterNames()
- {
- return servletContext.getInitParameterNames();
- }
-
- public void log(String s)
- {
- servletContext.log(s);
- }
-
- public void log(String s, Throwable throwable)
- {
- servletContext.log(s, throwable);
- }
-
- public void removeAttribute(String s)
- {
- if (s == null)
- {
- throw new IllegalArgumentException("attribute name must not be null");
- }
- servletContext.removeAttribute(s);
- }
-
- public void setAttribute(String s, Object o)
- {
- servletContext.setAttribute(s, o);
- }
-
- public String getPortletContextName()
- {
- return servletContext.getServletContextName();
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletPreferencesImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletPreferencesImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletPreferencesImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,398 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.portlet.state.PropertyChange;
-import org.jboss.portal.portlet.state.PropertyContext;
-import org.jboss.portal.portlet.container.info.ContainerPreferenceInfo;
-import org.jboss.portal.portlet.container.info.ContainerPreferencesInfo;
-
-import javax.portlet.PortletPreferences;
-import javax.portlet.PreferencesValidator;
-import javax.portlet.ReadOnlyException;
-import javax.portlet.ValidatorException;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletPreferencesImpl implements PortletPreferences
-{
-
- /** The logger. */
- protected static final Logger log = Logger.getLogger(PortletPreferencesImpl.class);
-
- /** Indicates the object is used during a action phase. */
- public static final int ACTION = 1;
-
- /** Indicates the object is used during a render phase. */
- public static final int RENDER = 0;
-
- /** . */
- protected final PropertyContext prefs;
-
- /** . */
- protected final PreferencesValidator validator;
-
- /** . */
- protected final ContainerPreferencesInfo containerPrefs;
-
- /** . */
- protected final int mode;
-
- /** Keep track of updates */
- protected final Map updates;
-
- public PortletPreferencesImpl(
- PropertyContext prefs,
- ContainerPreferencesInfo containerPrefs,
- PreferencesValidator validator,
- int mode)
- {
- this.prefs = prefs;
- this.validator = validator;
- this.containerPrefs = containerPrefs;
- this.mode = mode;
- this.updates = new HashMap();
- }
-
- public Map getMap()
- {
- return new PreferencesMap();
- }
-
- public Enumeration getNames()
- {
- // Clone the system names
- Set names = new HashSet(prefs.getPortletKeys());
-
- // Add the user
- names.addAll(prefs.getKeys());
-
- // Add the transient updates
- for (Iterator i = updates.values().iterator(); i.hasNext();)
- {
- PropertyChange change = (PropertyChange)i.next();
- if (change.getType() == PropertyChange.PREF_UPDATE)
- {
- names.add(change.getKey());
- }
- else
- {
- names.remove(change.getKey());
- }
- }
-
- // Convert to enumeration
- return Collections.enumeration(names);
- }
-
- private Value getValue(String key)
- {
- Value value = null;
- PropertyChange change = (PropertyChange)updates.get(key);
- if (change != null)
- {
- if (change.getType() == PropertyChange.PREF_UPDATE)
- {
- value = change.getValue();
- }
- else
- {
- ContainerPreferenceInfo containerPref = containerPrefs.getContainerPreference(key);
- if (containerPref != null)
- {
- value = containerPref.getDefaultValue();
- }
- }
- }
- else
- {
- // Get user
- value = prefs.getValue(key);
-
- // If does not exist or read only use what the default one
- if (value == null || isReadOnly(key))
- {
- ContainerPreferenceInfo containerPref = containerPrefs.getContainerPreference(key);
- if (containerPref != null)
- {
- value = containerPref.getDefaultValue();
- }
- }
- }
- return value;
- }
-
- public String getValue(String key, String def) throws IllegalArgumentException
- {
- if (key == null)
- {
- throw new IllegalArgumentException("key must not be null");
- }
- Value value = getValue(key);
- if (value == null || value.isEmpty())
- {
- return def;
- }
- else
- {
- return value.asString();
- }
- }
-
- public String[] getValues(String key, String[] def) throws IllegalArgumentException
- {
- if (key == null)
- {
- throw new IllegalArgumentException("key must not be null");
- }
- Value value = getValue(key);
- if (value != null)
- {
- return value.asStringArray();
- }
- else
- {
- return def;
- }
- }
-
- public boolean isReadOnly(String key) throws IllegalArgumentException, IllegalArgumentException
- {
- if (key == null)
- {
- throw new IllegalArgumentException("key must not be null");
- }
- if (mode == ACTION)
- {
- // The accurate value is to combine what the portlet developer and the consumer specifies
- return prefs.isReadOnly() || prefs.isReadOnly(key);
- }
- else
- {
- // During render we cannot be aware of the consumer
- // intent with respect to the access mode of the current state
- return prefs.isReadOnly(key);
- }
- }
-
- public void reset(String key) throws IllegalArgumentException, ReadOnlyException
- {
- if (key == null)
- {
- throw new IllegalArgumentException("key must not be null");
- }
- if (isReadOnly(key))
- {
- throw new ReadOnlyException("Key " + key + " cannot be written");
- }
- updates.put(key, PropertyChange.newReset(key));
- }
-
- public void setValue(String key, String value) throws IllegalArgumentException, ReadOnlyException
- {
- if (key == null)
- {
- throw new IllegalArgumentException("key must not be null");
- }
- if (isReadOnly(key))
- {
- throw new ReadOnlyException("Key " + key + " cannot be written");
- }
- Value value_ = new StringValue(value);
- updates.put(key, PropertyChange.newUpdate(key, value_));
- }
-
- public void setValues(String key, String[] values) throws IllegalArgumentException, ReadOnlyException
- {
- if (key == null)
- {
- throw new IllegalArgumentException("key must not be null");
- }
- if (isReadOnly(key))
- {
- throw new ReadOnlyException("Key " + key + " cannot be written");
- }
- if (values == null)
- {
- values = new String[1];
- }
- Value value_ = new StringValue(values);
- updates.put(key, PropertyChange.newUpdate(key, value_));
- }
-
- public void store() throws IOException, ValidatorException
- {
- // Check we are in the right mode
- if (mode != ACTION)
- {
- throw new IllegalStateException("Store must be called within the scope of an action request");
- }
-
- // Copy the transient set to the persistent set if the consumer allows it
- if (prefs.isReadOnly())
- {
- throw new IOException("Should not happen");
- }
-
- // If the optional validator is present validate
- if (validator != null)
- {
- validator.validate(this);
- }
-
- //
- PropertyChange[] changes = (PropertyChange[])updates.values().toArray(new PropertyChange[updates.size()]);
- prefs.update(changes);
-
- // Clear the updates
- updates.clear();
- }
-
- private class PreferencesMap extends HashMap
- {
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 6969583304804836926L;
-
- public PreferencesMap()
- {
- super(10);
-
- //
- for (Iterator i = containerPrefs.getKeys().iterator(); i.hasNext();)
- {
- String key = (String)i.next();
- String[] value = containerPrefs.getContainerPreference(key).getDefaultValue().asStringArray();
- String[] clone = new String[value.length];
- System.arraycopy(value, 0, clone, 0, value.length);
- super.put(key, clone);
- }
-
- //
- for (Iterator i = prefs.getKeys().iterator(); i.hasNext();)
- {
- String key = (String)i.next();
- String[] value = prefs.getValue(key).asStringArray();
- String[] clone = new String[value.length];
- System.arraycopy(value, 0, clone, 0, value.length);
- super.put(key, clone);
- }
-
- //
- for (Iterator i = updates.values().iterator(); i.hasNext();)
- {
- PropertyChange change = (PropertyChange)i.next();
- String key = change.getKey();
-
- if (change.getType() == PropertyChange.PREF_RESET)
- {
- super.remove(key);
- }
- else
- {
- String[] value = change.getValue().asStringArray();
- String[] clone = new String[value.length];
- System.arraycopy(value, 0, clone, 0, value.length);
- super.put(key, clone);
- }
- }
- }
-
- public boolean containsValue(Object value)
- {
- if (value instanceof String[])
- {
- String[] strings = (String[])value;
- for (Iterator i = super.values().iterator(); i.hasNext();)
- {
- String[] other = (String[])i.next();
- if (Arrays.equals(strings, other))
- {
- return true;
- }
- }
- }
- return false;
- }
-
- public Object get(Object key)
- {
- return (String[])super.get(key); // Should be cloned here to ensure immutability
- }
-
- public Collection values()
- {
- return super.values(); // String[] should be cloned here to ensure immutability
- }
-
- public Set entrySet()
- {
- return super.entrySet();
- }
-
- /**
- * Do not change state.
- *
- * @return null
- */
- public Object put(Object key, Object value)
- {
- return null;
- }
-
- /**
- * Do not change state.
- *
- * @return null
- */
- public Object remove(Object key)
- {
- return null;
- }
-
- /** Do not change state. */
- public void putAll(Map t)
- {
- }
-
- /** Do not change state. */
- public void clear()
- {
- }
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestDispatcherImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestDispatcherImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestDispatcherImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,92 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.server.servlet.FilterCommand;
-
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletRequestDispatcherImpl
- implements PortletRequestDispatcher
-{
-
- /** The servlet request dispatcher. */
- private final RequestDispatcher dispatcher;
-
- /** . */
- private final String path;
-
- PortletRequestDispatcherImpl(RequestDispatcher dispatcher)
- {
- this(dispatcher, null);
- }
-
- PortletRequestDispatcherImpl(RequestDispatcher dispatcher, String path)
- {
- this.dispatcher = dispatcher;
- this.path = path;
- }
-
- public void include(RenderRequest req, RenderResponse resp) throws PortletException, IOException
- {
- try
- {
- // Get the invocation that is still in the request
- PortletInvocation invocation = (PortletInvocation)req.getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
-
- //
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- HttpServletResponse dresp = invocation.getDispatchedResponse();
-
- // It was set by the PortletContainerInvoker before diving into the portlet, so let's just reuse them
- RenderRequest rreq = (RenderRequest)req.getAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- RenderResponse rresp = (RenderResponse)req.getAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
-
- //
- DispatchedHttpServletRequest direq = new DispatchedHttpServletRequest(rreq, dreq, path);
- DispatchedHttpServletResponse diresp = new DispatchedHttpServletResponse(rresp, dresp);
-
- //
- dispatcher.include(direq, diresp);
- }
- catch (ServletException e)
- {
- // We must translate the servlet exception into a portlet exception for the calling portlet
- throw new PortletException(e);
- }
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,559 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.apache.log4j.Logger;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.PortletParameters;
-import org.jboss.portal.portlet.container.PortletApplicationImpl;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.container.info.ContentTypes;
-import org.jboss.portal.portlet.container.info.ContainerPreferencesInfo;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.spi.InstanceContext;
-import org.jboss.portal.portlet.spi.RequestContext;
-import org.jboss.portal.portlet.spi.SecurityContext;
-import org.jboss.portal.portlet.spi.UserContext;
-import org.jboss.portal.portlet.state.PropertyContext;
-
-import javax.portlet.PortalContext;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletPreferences;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletSession;
-import javax.portlet.PreferencesValidator;
-import javax.portlet.RenderRequest;
-import javax.portlet.WindowState;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.security.Principal;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-import java.util.Collection;
-
-/**
- * PortletRequest implemention. The parameter implementation is left to subclasses that can implement it differently.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision$
- */
-public abstract class PortletRequestImpl implements PortletRequest
-{
-
- /** Constant object to mark that a request attribute is removed. */
- protected static final Object REMOVED_ATTRIBUTE = new Object();
-
- protected static final Logger log = Logger.getLogger(PortletRequestImpl.class);
-
- protected PortletInvocation invocation;
- protected UserContext userContext;
- protected SecurityContext securityContext;
- protected RequestContext requestContext;
- protected InstanceContext instanceContext;
- protected PortletPreferences preferences;
-
- protected PortletContainer container;
- protected ContentTypes contentTypes;
- protected HttpServletRequest dreq;
- protected PortalContext portalContext;
- protected PortletSessionImpl psession;
-
- protected int sessionStatus;
-
- /** . */
- protected PortletParameters parameters;
-
- /** The lazy request attributes map added or removed during the request of the portlet. */
- protected Map attributes;
-
- public PortletRequestImpl(PortletInvocation invocation)
- {
- //
- this.invocation = invocation;
- this.userContext = invocation.getUserContext();
- this.securityContext = invocation.getSecurityContext();
- this.requestContext = invocation.getRequestContext();
- this.instanceContext = invocation.getInstanceContext();
- this.container = ((ContainerPortletInfo)invocation.getInfo()).getContainer();
- this.contentTypes = container.getContentTypes();
- this.dreq = invocation.getDispatchedRequest();
- this.portalContext = new PortalContextImpl(invocation.getPortalContext());
- this.parameters = null;
-
- //
- int mode = this instanceof RenderRequest ? PortletPreferencesImpl.RENDER : PortletPreferencesImpl.ACTION;
- PropertyContext prefs = (PropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
- PreferencesValidator validator = container.getPreferencesValidator();
- ContainerPreferencesInfo containerPrefs = (ContainerPreferencesInfo)container.getInfo().getPreferences();
- this.preferences = new PortletPreferencesImpl(prefs, containerPrefs, validator, mode);
- }
-
- // PLT.11.1.1
-
- public String getParameter(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
- if (parameters != null)
- {
- return parameters.getValue(name);
- }
- else
- {
- return null;
- }
- }
-
- public Enumeration getParameterNames()
- {
- if (parameters != null)
- {
- return Collections.enumeration(parameters.keySet());
- }
- else
- {
- return Tools.EMPTY_ENUMERATION;
- }
- }
-
- public String[] getParameterValues(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
- if (parameters != null)
- {
- return parameters.getValues(name);
- }
- else
- {
- return null;
- }
- }
-
- public Map getParameterMap()
- {
- if (parameters != null)
- {
- return Collections.unmodifiableMap(parameters);
- }
- else
- {
- return Collections.EMPTY_MAP;
- }
- }
-
- public WindowState getWindowState()
- {
- String s = invocation.getPortletContext().getWindowState().toString();
- return PortletUtils.decodeWindowState(s);
- }
-
- public PortletMode getPortletMode()
- {
- String s = invocation.getPortletContext().getMode().toString();
- return PortletUtils.decodePortletMode(s);
- }
-
- // PLT.11.1.3
-
- public Object getAttribute(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
- if (PortletRequest.USER_INFO.equals(name))
- {
- Map infos = userContext.getInformations();
-
- //
- if (infos != null)
- {
- // Get portlet application metadata
- PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
- PortletApplicationMetaData pamd = portletApp.getMetaData();
- Map uaMD = pamd.getUserAttributes();
-
- // Clone the map
- infos = new HashMap(infos);
-
- // Keep only what is of interest with respect to what the portlet app defines
- infos.keySet().retainAll(uaMD.keySet());
-
- // Make it immutable
- infos = Collections.unmodifiableMap(infos);
- }
-
- //
- return infos;
- }
- else
- {
- Object value = null;
- if (attributes != null)
- {
- value = attributes.get(name);
- }
- if (value == null)
- {
- value = requestContext.getAttribute(name);
- }
- else if (value == REMOVED_ATTRIBUTE)
- {
- value = null;
- }
- return value;
- }
- }
-
- public Enumeration getAttributeNames()
- {
- // Copy the attribute names to avoid ConcurrentModificationException
- // one test in the TCK getPortalObjectContext the Enumeration then dispatch the call to a
- // servlet where it use the Enumeration and it throws a CME if we don't copy
- Set names = new HashSet();
- for (Enumeration e = requestContext.getAttributeNames(); e.hasMoreElements();)
- {
- names.add(e.nextElement());
- }
- if (attributes != null)
- {
- for (Iterator i = attributes.entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
- Object value = entry.getValue();
- if (value == REMOVED_ATTRIBUTE)
- {
- names.remove(name);
- }
- else
- {
- names.add(name);
- }
- }
- }
- names.add(PortletRequest.USER_INFO);
- return Tools.toEnumeration(names.iterator());
- }
-
- public void setAttribute(String name, Object value)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
- if (!PortletRequest.USER_INFO.equals(name))
- {
- if (value == null)
- {
- value = REMOVED_ATTRIBUTE;
- }
- if (attributes == null)
- {
- attributes = new HashMap();
- }
- attributes.put(name, value);
- }
- }
-
- public void removeAttribute(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
- setAttribute(name, null);
- }
-
- // PLT.11.1.4
-
- public String getProperty(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
-
- //
- Object prop = invocation.getAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, name);
- if (prop instanceof Collection)
- {
- Iterator iterator = ((Collection)prop).iterator();
- if (iterator.hasNext())
- {
- prop = iterator.next();
- }
- }
-
- //
- if (prop == null)
- {
- // Otherwise the request header
- prop = dreq.getHeader(name);
- }
-
- return (String)prop;
- }
-
- public Enumeration getProperties(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
-
- //
- Object prop = invocation.getAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, name);
- if (prop == null)
- {
- // Otherwise the request headers
- return dreq.getHeaders(name);
- }
- else if (prop instanceof Collection)
- {
- return Collections.enumeration(((Collection)prop));
- }
- else
- {
- return Tools.toEnumeration(prop);
- }
- }
-
- public Enumeration getPropertyNames()
- {
- // First the properties
- Set names = new HashSet(invocation.getContext().getAttributeResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE).getKeys());
-
- // Then put the headers
- for (Enumeration e = dreq.getHeaderNames();e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
- names.add(name);
- }
-
- //
- return Collections.enumeration(names);
- }
-
- // PLT.11.1.5
-
- public String getContextPath()
- {
- return (String)dreq.getAttribute("javax.servlet.include.context_path");
- }
-
- // PLT.11.1.6
-
- public String getAuthType()
- {
- return securityContext.getAuthType();
- }
-
- public String getRemoteUser()
- {
- return securityContext.getRemoteUser();
- }
-
- public Principal getUserPrincipal()
- {
- return securityContext.getUserPrincipal();
- }
-
- public boolean isUserInRole(String roleName)
- {
- // Get the map role name to role link
- Map securityRoleRefsMap = ((ContainerPortletInfo)invocation.getInfo()).getContainer().getSecurityRoleRefsMap();
-
- // Process the role link
- String roleLink = (String)securityRoleRefsMap.get(roleName);
- if (roleLink == null)
- {
- if (securityRoleRefsMap.containsKey(roleName))
- {
- // The role name exist without a role link value
- return securityContext.isUserInRole(roleName);
- }
- else
- {
- // No role name is defined
- return false;
- }
- }
- else
- {
- // We have the role link value
- return securityContext.isUserInRole(roleLink);
- }
- }
-
- public boolean isSecure()
- {
- return securityContext.isSecure();
- }
-
- // PLT.11.1.7
-
- public String getResponseContentType()
- {
- return invocation.getPortletContext().getStreamInfo().getContentType().toString();
- }
-
- public Enumeration getResponseContentTypes()
- {
- Vector v = new Vector();
- v.add(getResponseContentType());
- return v.elements();
- }
-
- // PLT.11.1.8
-
- public Locale getLocale()
- {
- return userContext.getLocale();
- }
-
- // PLT.11.1.9
-
- public boolean isPortletModeAllowed(PortletMode portletMode)
- {
- if (portletMode == null)
- {
- // The spec does not give way to handle that case properly
- log.warn("Try to test a null portlet mode");
- return false;
- }
- else
- {
- return invocation.getSupportedModes().contains(org.jboss.portal.Mode.create(portletMode.toString()));
- }
- }
-
- // PLT.11.1.10
-
- public boolean isWindowStateAllowed(WindowState windowState)
- {
- return invocation.getSupportedWindowStates().contains(org.jboss.portal.WindowState.create(windowState.toString()));
- }
-
- //
-
- public PortletSession getPortletSession()
- {
- return getPortletSession(true);
- }
-
- public PortletSession getPortletSession(boolean create)
- {
- //
- if (create)
- {
- // Create the session with the dispatched request
- HttpSession hsession = dreq.getSession(true);
-
- // Create portlet session
- PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
- psession = new PortletSessionImpl(
- hsession,
- instanceContext.getId(),
- portletApp.getPortletContext());
- }
- else if (psession == null)
- {
- HttpSession hsession = dreq.getSession(false);
-
- //
- if (hsession != null)
- {
- // Create portlet session
- PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
- psession = new PortletSessionImpl(
- hsession,
- instanceContext.getId(),
- portletApp.getPortletContext());
- }
- }
- else if (!psession.isValid())
- {
- // If we don't create and the underlying http session is not valid we return null
- psession = null;
- }
-
- //
- return psession;
- }
-
- public PortalContext getPortalContext()
- {
- return portalContext;
- }
-
- public String getRequestedSessionId()
- {
- return dreq.getRequestedSessionId();
- }
-
- public boolean isRequestedSessionIdValid()
- {
- return dreq.isRequestedSessionIdValid();
- }
-
- public Enumeration getLocales()
- {
- return Collections.enumeration(userContext.getLocales());
- }
-
- public String getScheme()
- {
- return requestContext.getScheme();
- }
-
- public String getServerName()
- {
- return requestContext.getServerName();
- }
-
- public int getServerPort()
- {
- return requestContext.getServerPort();
- }
-
- public PortletPreferences getPreferences()
- {
- return preferences;
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,105 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.common.invocation.AttributeResolver;
-
-import javax.portlet.PortletResponse;
-import java.util.Collection;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class PortletResponseImpl implements PortletResponse
-{
-
- /** . */
- protected final PortletInvocation invocation;
-
- /** . */
- protected final PortletRequestImpl preq;
-
- protected PortletResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
- {
- this.invocation = invocation;
- this.preq = preq;
- }
-
- public String encodeURL(String url)
- {
- if (url == null)
- {
- throw new IllegalArgumentException("URL must not be null");
- }
- return invocation.getPortletContext().encodeResourceURL(url);
- }
-
- public void addProperty(String key, String value) throws IllegalArgumentException
- {
- if (key == null)
- {
- throw new IllegalArgumentException("Name cannot be null");
- }
- if (value == null)
- {
- throw new IllegalArgumentException("Value cannot be null");
- }
-
- //
- AttributeResolver resolver = invocation.getContext().getAttributeResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE);
- Object prop = resolver.getAttribute(key);
- if (prop == null)
- {
- resolver.setAttribute(key, prop);
- }
- else if (prop instanceof Collection)
- {
- ((Collection)prop).add(value);
- }
- else
- {
- Collection c = new ArrayList();
- c.add(prop);
- c.add(value);
- resolver.setAttribute(key, c);
- }
- }
-
- public void setProperty(String key, String value) throws IllegalArgumentException
- {
- if (key == null)
- {
- throw new IllegalArgumentException("Name cannot be null");
- }
- if (value == null)
- {
- throw new IllegalArgumentException("Value cannot be null");
- }
-
- //
- invocation.setAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, key, value);
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletSessionImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletSessionImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletSessionImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,218 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import javax.portlet.PortletContext;
-import javax.portlet.PortletSession;
-import javax.servlet.http.HttpSession;
-import java.util.Enumeration;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletSessionImpl implements PortletSession
-{
-
- private HttpSession session;
- private String prefix;
- private PortletContext context;
-
- public PortletSessionImpl(HttpSession session, String id, PortletContext context)
- {
- this.session = session;
- this.prefix = "javax.portlet.p." + id + "?";
- this.context = context;
- }
-
- public Object getAttribute(String s)
- {
- return getAttribute(s, PORTLET_SCOPE);
- }
-
- public Object getAttribute(String s, int i)
- {
- if (s == null)
- {
- throw new IllegalArgumentException("Name must not be null");
- }
- if (i == PORTLET_SCOPE)
- {
- s = prefix + s;
- }
- return session.getAttribute(s);
- }
-
- public Enumeration getAttributeNames()
- {
- return getAttributeNames(PORTLET_SCOPE);
- }
-
- public Enumeration getAttributeNames(int scope)
- {
- final boolean app = scope == APPLICATION_SCOPE;
- return new Enumeration()
- {
- private Enumeration e;
- private String next;
-
- {
- e = session.getAttributeNames();
- next = null;
- next();
- }
-
- public boolean hasMoreElements()
- {
- return next != null;
- }
-
- public Object nextElement()
- {
- String result = next;
- next = null;
- next();
- return result;
- }
-
- private void next()
- {
- while (e.hasMoreElements())
- {
- String attribute = (String)e.nextElement();
- if (app && !attribute.startsWith("javax.portlet."))
- {
- next = attribute;
- break;
- }
- else if (!app && attribute.startsWith(prefix))
- {
- next = attribute.substring(prefix.length());
- break;
- }
- }
- }
- };
- }
-
- public long getCreationTime()
- {
- return session.getCreationTime();
- }
-
- public String getId()
- {
- return session.getId();
- }
-
- public long getLastAccessedTime()
- {
- return session.getLastAccessedTime();
- }
-
- public int getMaxInactiveInterval()
- {
- return session.getMaxInactiveInterval();
- }
-
- public void invalidate()
- {
- // Invalidate the underlying HTTP session
- session.invalidate();
-
- // Mark the session as invalid
- // valid = false;
- }
-
- public boolean isNew()
- {
- return session.isNew();
- }
-
- public void removeAttribute(String s)
- {
- removeAttribute(s, PORTLET_SCOPE);
- }
-
- public void removeAttribute(String s, int i)
- {
- if (s == null)
- {
- throw new IllegalArgumentException("Name must not be null");
- }
- if (i == PORTLET_SCOPE)
- {
- s = prefix + s;
- }
- session.removeAttribute(s);
- }
-
- public void setAttribute(String s, Object o)
- {
- setAttribute(s, o, PORTLET_SCOPE);
- }
-
- public void setAttribute(String s, Object o, int i)
- {
- if (s == null)
- {
- throw new IllegalArgumentException("Name must not be null");
- }
- if (i == PORTLET_SCOPE)
- {
- s = prefix + s;
- }
- session.setAttribute(s, o);
- }
-
- public void setMaxInactiveInterval(int i)
- {
- session.setMaxInactiveInterval(i);
- }
-
- public PortletContext getPortletContext()
- {
- return context;
- }
-
- /** Return the underlying session. */
- HttpSession getHttpSession()
- {
- return session;
- }
-
- /** Detect validity of the session based on the underlying session. */
- boolean isValid()
- {
- try
- {
- session.isNew();
- return true;
- }
- catch (IllegalStateException e)
- {
- return false;
- }
- }
-
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,200 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.Mode;
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.PortletParameters;
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-
-import javax.portlet.PortletMode;
-import javax.portlet.PortletModeException;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.PortletURL;
-import javax.portlet.WindowState;
-import javax.portlet.WindowStateException;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletURLImpl implements PortletURL
-{
-
- private PortletInvocation inv;
- private PortletRequest preq;
-
- //
- private Boolean secure;
- private InternalPortletURL url;
-
- public PortletURLImpl(PortletInvocation invocation, PortletRequest preq, InternalPortletURL url)
- {
- this.inv = invocation;
- this.preq = preq;
- this.url = url;
- }
-
- public void setWindowState(WindowState windowState) throws WindowStateException
- {
- if (!preq.isWindowStateAllowed(windowState))
- {
- throw new WindowStateException("Not supported", windowState);
- }
- url.windowState = windowState;
- }
-
- public void setPortletMode(PortletMode portletMode) throws PortletModeException
- {
- if (portletMode == null)
- {
- // The spec does not say the behaviour with null argument
- // we suppose it clear the current mode
- url.portletMode = null;
- }
- else
- {
- // Check possible
- if (!preq.isPortletModeAllowed(portletMode))
- {
- throw new PortletModeException("Not supported", portletMode);
- }
-
- // Set mode
- url.portletMode = portletMode;
- }
- }
-
- /** @throws IllegalArgumentException if the name is null */
- public void setParameter(String name, String value)
- {
- PortletUtils.checkPortletParameterValidity(name, value);
-
- //
- url.getInternalParameters().setValue(name, value);
- }
-
- public void setParameter(String name, String[] values)
- {
- PortletUtils.checkPortletParameterValidity(name, values);
-
- //
- url.getInternalParameters().setValues(name, values);
- }
-
- public void setParameters(Map parameters)
- {
- PortletUtils.checkPortletParameterMapValidity(parameters);
-
- //
- url.getInternalParameters().replace(parameters);
- }
-
- public void setSecure(boolean secure) throws PortletSecurityException
- {
- this.secure = Boolean.valueOf(secure);
- }
-
- public String toString()
- {
- PortletInvocationContext responseContext = inv.getPortletContext();
- String s = responseContext.renderURL(url, secure, null, true);
- return s;
- }
-
- static abstract class InternalPortletURL implements org.jboss.portal.portlet.PortletURL
- {
-
- /** . */
- private WindowState windowState;
-
- /** . */
- private PortletMode portletMode;
-
- public Mode getMode()
- {
- if (portletMode != null)
- {
- return Mode.create(portletMode.toString());
- }
- return null;
- }
-
- public org.jboss.portal.WindowState getWindowState()
- {
- if (windowState != null)
- {
- return org.jboss.portal.WindowState.create(windowState.toString());
- }
- return null;
- }
-
- protected abstract PortletParameters getInternalParameters();
- }
-
- static class InternalActionURL extends InternalPortletURL implements ActionURL
- {
-
- /** . */
- private PortletParametersStateString parameters = new PortletParametersStateString();
-
- protected PortletParameters getInternalParameters()
- {
- return parameters.getParameters();
- }
-
- public StateString getInteractionState()
- {
- return parameters;
- }
-
- /** The portlet container does not need to have the navigational state provided. */
- public StateString getNavigationalState()
- {
- return null;
- }
- }
-
- static class InternalRenderURL extends InternalPortletURL implements RenderURL
- {
-
- /** . */
- private PortletParametersStateString navigationalState = new PortletParametersStateString();
-
- protected PortletParameters getInternalParameters()
- {
- return navigationalState.getParameters();
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
- }
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.impl.jsr168;
import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletURLImpl;
import javax.portlet.PortletMode;
import javax.portlet.PortletRequest;
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,68 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.spi.RenderContext;
-
-import javax.portlet.RenderRequest;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision$
- */
-public class RenderRequestImpl extends PortletRequestImpl implements RenderRequest
-{
-
- /** . */
- protected RenderContext renderContext;
-
- public RenderRequestImpl(RenderInvocation invocation)
- {
- super(invocation);
-
- // Get the render context
- renderContext = (RenderContext)invocation.getPortletContext();
-
- // Get the possibly null navigational state
- StateString navigationalState = renderContext.getNavigationalState();
-
- //
- if (navigationalState == null)
- {
-
- }
- else if (navigationalState instanceof PortletParametersStateString)
- {
- parameters = ((PortletParametersStateString)navigationalState).getParameters();
- }
- else
- {
- PortletParametersStateString parametersState = new PortletParametersStateString(navigationalState.getStringValue());
- parameters = parametersState.getParameters();
- }
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -1,192 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import org.jboss.portal.common.MediaType;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.server.util.HTTPStreamInfo;
-
-import javax.activation.MimeTypeParseException;
-import javax.portlet.PortletURL;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Locale;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class RenderResponseImpl extends PortletResponseImpl implements RenderResponse
-{
-
- /** The fragment result. */
- protected FragmentResponse result;
-
- /** The namespace. */
- protected String namespace;
-
- /** Not really used but we need it to memorize what the client set optionally. */
- protected int bufferSize;
-
- public RenderResponseImpl(RenderInvocation invocation, PortletRequestImpl preq)
- {
- super(invocation, preq);
-
- // 0 means no buffering - we say no buffering
- this.bufferSize = 0;
- this.result = new FragmentResponse();
- }
-
- public PortletInvocationResponse getResult()
- {
- return result;
- }
-
- public void setTitle(String s)
- {
- result.setTitle(s);
- }
-
- public String getContentType()
- {
- return result.getContentType();
- }
-
- public void setContentType(String contentType)
- {
- try
- {
- // Remove the unused appended charset first
- int index = contentType.indexOf(';');
- if (index != -1)
- {
- contentType = contentType.substring(0, index);
- }
-
- // Find the content type among the media type we know
- MediaType requestedMediaType = MediaType.parseMimeType(contentType);
-
- // Get the response media type
- HTTPStreamInfo info = invocation.getPortletContext().getStreamInfo();
- MediaType responseMediaType = info.getContentType();
-
- // Check if the requested media type is allowed as a subtype of the main response
- if (!responseMediaType.isAllowedSubType(requestedMediaType))
- {
- throw new IllegalArgumentException("Content type not accepted");
- }
-
- // Set the content type
- result.setContentType(contentType);
- }
- catch (MimeTypeParseException e)
- {
- IllegalArgumentException ex = new IllegalArgumentException("Content type not accepted");
- ex.initCause(e);
- throw ex;
- }
- }
-
- public PrintWriter getWriter() throws IOException
- {
- return result.getWriter();
- }
-
- public OutputStream getPortletOutputStream() throws IOException
- {
- return result.getOutputStream();
- }
-
- public PortletURL createRenderURL()
- {
- return PortletUtils.createRenderURL(invocation, preq);
- }
-
- public PortletURL createActionURL()
- {
- return PortletUtils.createActionURL(invocation, preq);
- }
-
- public String getNamespace()
- {
- if (namespace == null)
- {
- String windowId = invocation.getWindowContext().getId();
- namespace = PortletUtils.generateNamespaceFrom(windowId);
- }
- return namespace;
- }
-
- public String getCharacterEncoding()
- {
- return invocation.getPortletContext().getStreamInfo().getCharset();
- }
-
- public Locale getLocale()
- {
- return invocation.getUserContext().getLocale();
- }
-
- public void setBufferSize(int bufferSize)
- {
- if (bufferSize > -0)
- {
- this.bufferSize = bufferSize;
- }
- }
-
- public int getBufferSize()
- {
- return bufferSize;
- }
-
- public void flushBuffer() throws IOException
- {
- }
-
- public void resetBuffer()
- {
- // Clear the buffer
- result.resetBuffer();
- }
-
- public void reset()
- {
- // Clear the buffer
- resetBuffer();
-
- // And properties
- invocation.getContext().getAttributeResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE).getKeys().clear();
- }
-
- public boolean isCommitted()
- {
- // Never afterCommit
- return false;
- }
-}
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,130 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.spi.ActionContext;
+
+import javax.portlet.ActionRequest;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ActionRequestImpl extends PortletRequestImpl implements ActionRequest
+{
+
+ /** . */
+ protected final ActionContext actionContext;
+
+ public ActionRequestImpl(ActionInvocation invocation)
+ {
+ super(invocation);
+ this.actionContext = (ActionContext)invocation.getPortletContext();
+
+ // Get the possibly null interaction state
+ StateString interactionState = actionContext.getInteractionState();
+
+ // Take care of the interaction state if any
+ if (interactionState != null)
+ {
+ // Unserialize the interaction state if necessary
+ PortletParametersStateString parametersState = null;
+ if (interactionState instanceof PortletParametersStateString)
+ {
+ parametersState = (PortletParametersStateString)interactionState;
+ }
+ else
+ {
+ parametersState = new PortletParametersStateString(interactionState.getStringValue());
+ }
+
+ //
+ parameters = parametersState.getParameters();
+ }
+
+ //
+ PortletParameters form = actionContext.getForm();
+ if (form != null)
+ {
+ if (parameters == null)
+ {
+ parameters = form;
+ }
+ else
+ {
+ parameters = new PortletParameters(parameters);
+ parameters.append(form);
+ }
+ }
+ }
+
+ //
+
+ public InputStream getPortletInputStream() throws IOException
+ {
+ if ("application/x-www-form-urlencoded".equals(actionContext.getContentType()))
+ {
+ throw new IllegalStateException();
+ }
+ return actionContext.getInputStream();
+ }
+
+ public void setCharacterEncoding(String s) throws UnsupportedEncodingException
+ {
+ // This method is frankly stupid
+ throw new IllegalStateException("called after the body has been read");
+ // req.setCharacterEncoding(s);
+ }
+
+ public BufferedReader getReader() throws UnsupportedEncodingException, IOException
+ {
+ if ("application/x-www-form-urlencoded".equals(actionContext.getContentType()))
+ {
+ throw new IllegalStateException();
+ }
+ return actionContext.getReader();
+ }
+
+ public String getCharacterEncoding()
+ {
+ return actionContext.getCharacterEncoding();
+ }
+
+ public String getContentType()
+ {
+ return actionContext.getContentType();
+ }
+
+ public int getContentLength()
+ {
+ return actionContext.getContentLength();
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,201 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.URLTools;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.RedirectionResponse;
+import org.jboss.portal.portlet.invocation.response.RenderResponse;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ActionResponseImpl extends PortletResponseImpl implements ActionResponse
+{
+
+ private static final Logger log = Logger.getLogger(ActionResponseImpl.class);
+
+ protected static final int WANT_NOTHING = 0;
+ protected static final int WANT_RENDER = 1;
+ protected static final int WANT_REDIRECT = 2;
+
+ protected PortletInvocationResponse response;
+ protected int decision;
+
+ public ActionResponseImpl(ActionInvocation invocation, PortletRequestImpl preq)
+ {
+ super(invocation, preq);
+
+ //
+ RenderResponse rr = new RenderResponse();
+ rr.setNavigationalState(new PortletParametersStateString());
+
+ //
+ this.response = rr;
+ this.decision = WANT_NOTHING;
+ }
+
+ public PortletInvocationResponse getResult()
+ {
+ return response;
+ }
+
+ public void setWindowState(WindowState windowState) throws WindowStateException
+ {
+ if (decision == WANT_NOTHING || decision == WANT_RENDER)
+ {
+ if (!preq.isWindowStateAllowed(windowState))
+ {
+ throw new WindowStateException("Not supported", windowState);
+ }
+ ((RenderResponse)response).setWindowState(org.jboss.portal.WindowState.create(windowState.toString()));
+ decision = WANT_RENDER;
+ }
+ else
+ {
+ throw new IllegalStateException("Window state cannot be set after redirect");
+ }
+ }
+
+ public void setPortletMode(PortletMode portletMode) throws PortletModeException
+ {
+ if (decision == WANT_NOTHING || decision == WANT_RENDER)
+ {
+ if (portletMode == null)
+ {
+ // The spec does not define that case
+ // we just issue a warn
+ log.warn("Set null portlet mode");
+ }
+ else
+ {
+ if (!preq.isPortletModeAllowed(portletMode))
+ {
+ throw new PortletModeException("Not supported", portletMode);
+ }
+ Mode mode = Mode.create(portletMode.toString());
+ ((RenderResponse)response).setMode(mode);
+ }
+ decision = WANT_RENDER;
+ }
+ else
+ {
+ throw new IllegalStateException("Portlet mode cannot be set after redirect");
+ }
+ }
+
+ public void sendRedirect(String location) throws IOException
+ {
+ if (location == null)
+ {
+ // do something more clever than simply returning
+ return;
+ }
+ URLTools.enforceAbsoluteURL(location);
+ sendRedirect(new HTTPRedirectionResponse(location));
+ }
+
+ /**
+ * Generic send redirect.
+ *
+ * @param redirect
+ * @throws IllegalStateException implement jsr168 behavior if the portlet as already commited stuff
+ */
+ protected final void sendRedirect(RedirectionResponse redirect) throws IllegalStateException
+ {
+ if (decision == WANT_NOTHING || decision == WANT_REDIRECT)
+ {
+ response = redirect;
+ decision = WANT_REDIRECT;
+ }
+ else
+ {
+ throw new IllegalStateException("sendRedirect cannot be called after " +
+ "setPortletMode/setWindowState/setRenderParameter/setRenderParameters " +
+ "has been called previously");
+ }
+ }
+
+ public void setRenderParameters(Map map)
+ {
+ PortletUtils.checkPortletParameterMapValidity(map);
+
+ //
+ if (decision == WANT_NOTHING || decision == WANT_RENDER)
+ {
+ ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).replace(map);
+ decision = WANT_RENDER;
+ }
+ else
+ {
+ throw new IllegalStateException("setRenderParameters cannot be called after redirect");
+ }
+ }
+
+ public void setRenderParameter(String name, String value)
+ {
+ PortletUtils.checkPortletParameterValidity(name, value);
+
+ //
+ if (decision == WANT_NOTHING || decision == WANT_RENDER)
+ {
+ ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).setValue(name, value);
+ decision = WANT_RENDER;
+ }
+ else
+ {
+ throw new IllegalStateException("setRenderParameter cannot be called after redirect");
+ }
+ }
+
+ public void setRenderParameter(String name, String[] values)
+ {
+ PortletUtils.checkPortletParameterValidity(name, values);
+
+ //
+ if (decision == WANT_NOTHING || decision == WANT_RENDER)
+ {
+ ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).setValues(name, values);
+ decision = WANT_RENDER;
+ }
+ else
+ {
+ throw new IllegalStateException("setRenderParameter cannot be called after redirect");
+ }
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortalContextImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortalContextImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortalContextImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortalContextImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,109 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
+import org.jboss.portal.server.PortalConstants;
+
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * todo : does not provide customizable values for portlet modes and window states.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalContextImpl implements javax.portlet.PortalContext
+{
+
+ private PortalContext portal;
+ private Map properties;
+ private Set supportedPortletModes;
+ private Set supportedWindowStates;
+
+ public PortalContextImpl(PortalContext portal)
+ {
+ if (portal == null)
+ {
+ throw new IllegalArgumentException("Must provide a non-null PortalContext!");
+ }
+ this.portal = portal;
+ this.properties = portal.getProperties();
+ }
+
+ public String getPortalInfo()
+ {
+ return PortalConstants.VERSION.toString();
+ }
+
+ public String getProperty(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("Must provide a non-null property name");
+ }
+ return (String)properties.get(name);
+ }
+
+ public Enumeration getPropertyNames()
+ {
+ return Tools.toEnumeration(properties.keySet().iterator());
+ }
+
+ public Enumeration getSupportedPortletModes()
+ {
+ if (supportedPortletModes == null)
+ {
+ Set tmp = portal.getModes();
+ supportedPortletModes = new HashSet(tmp.size());
+ for (Iterator i = tmp.iterator(); i.hasNext();)
+ {
+ Mode mode = (Mode)i.next();
+ supportedPortletModes.add(PortletUtils.decodePortletMode(mode.toString()));
+ }
+ }
+ return Tools.toEnumeration(supportedPortletModes.iterator());
+ }
+
+ public Enumeration getSupportedWindowStates()
+ {
+ if (supportedWindowStates == null)
+ {
+ Set tmp = portal.getWindowStates();
+ supportedWindowStates = new HashSet(tmp.size());
+ for (Iterator i = tmp.iterator(); i.hasNext();)
+ {
+ org.jboss.portal.WindowState windowState = (org.jboss.portal.WindowState)i.next();
+ supportedWindowStates.add(PortletUtils.decodeWindowState(windowState.toString()));
+ }
+ }
+ return Tools.toEnumeration(supportedWindowStates.iterator());
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortalContextImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletConfigImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.portlet.impl.jsr168.info.PortletResourceBundleManager;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletConfigImpl implements PortletConfig
+{
+
+ private String portletName;
+ private PortletContext portletContext;
+ private Map initParameters;
+ private PortletResourceBundleManager bundleMgr;
+
+ public PortletConfigImpl(String portletName,
+ PortletContext portletContext,
+ Map initParameters,
+ PortletResourceBundleManager bundleMgr)
+ {
+ this.portletName = portletName;
+ this.portletContext = portletContext;
+ this.initParameters = initParameters;
+ this.bundleMgr = bundleMgr;
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public PortletContext getPortletContext()
+ {
+ return portletContext;
+ }
+
+ /** May return null ? the spec does not specify what happens when the bundle is not found for the locale. */
+ public ResourceBundle getResourceBundle(Locale locale)
+ {
+ return bundleMgr.getResourceBundle(locale);
+ }
+
+ public String getInitParameter(String s)
+ {
+ if (s == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ return (String)initParameters.get(s);
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ return Collections.enumeration(initParameters.keySet());
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletContextImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,186 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.server.PortalConstants;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletContextImpl implements PortletContext
+{
+
+ private ServletContext servletContext;
+
+ public PortletContextImpl(ServletContext servletContext)
+ {
+ this.servletContext = servletContext;
+ }
+
+ public String getServerInfo()
+ {
+ return "JBossPortal/" + PortalConstants.VERSION.getMajor() + "." + PortalConstants.VERSION.getMinor();
+ }
+
+ public PortletRequestDispatcher getRequestDispatcher(String path)
+ {
+ if (path == null || !path.startsWith("/"))
+ {
+ return null;
+ }
+ RequestDispatcher rd = servletContext.getRequestDispatcher(path);
+ if (rd != null)
+ {
+ return new PortletRequestDispatcherImpl(rd, path);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public PortletRequestDispatcher getNamedDispatcher(String name)
+ {
+ if (name == null)
+ {
+ return null;
+ }
+ RequestDispatcher rd = servletContext.getNamedDispatcher(name);
+ if (rd != null)
+ {
+ return new PortletRequestDispatcherImpl(rd);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public InputStream getResourceAsStream(String s)
+ {
+ return servletContext.getResourceAsStream(s);
+ }
+
+ public int getMajorVersion()
+ {
+ return 1;
+ }
+
+ public int getMinorVersion()
+ {
+ return 0;
+ }
+
+ public String getMimeType(String s)
+ {
+ return servletContext.getMimeType(s);
+ }
+
+ public String getRealPath(String s)
+ {
+ return servletContext.getRealPath(s);
+ }
+
+ public Set getResourcePaths(String s)
+ {
+ return servletContext.getResourcePaths(s);
+ }
+
+ public URL getResource(String s) throws MalformedURLException
+ {
+ if (s == null || !s.startsWith("/"))
+ {
+ throw new MalformedURLException("invalid resource");
+ }
+ URL resource = servletContext.getResource(s);
+ return resource;
+ }
+
+ public Object getAttribute(String s)
+ {
+ if (s == null)
+ {
+ throw new IllegalArgumentException("attribute name must not be null");
+ }
+ return servletContext.getAttribute(s);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return servletContext.getAttributeNames();
+ }
+
+ public String getInitParameter(String s)
+ {
+ if (s == null)
+ {
+ throw new IllegalArgumentException("init parameter name must not be null");
+ }
+ return servletContext.getInitParameter(s);
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ return servletContext.getInitParameterNames();
+ }
+
+ public void log(String s)
+ {
+ servletContext.log(s);
+ }
+
+ public void log(String s, Throwable throwable)
+ {
+ servletContext.log(s, throwable);
+ }
+
+ public void removeAttribute(String s)
+ {
+ if (s == null)
+ {
+ throw new IllegalArgumentException("attribute name must not be null");
+ }
+ servletContext.removeAttribute(s);
+ }
+
+ public void setAttribute(String s, Object o)
+ {
+ servletContext.setAttribute(s, o);
+ }
+
+ public String getPortletContextName()
+ {
+ return servletContext.getServletContextName();
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletPreferencesImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletPreferencesImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletPreferencesImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletPreferencesImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,398 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyContext;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferenceInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferencesInfo;
+
+import javax.portlet.PortletPreferences;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.ValidatorException;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletPreferencesImpl implements PortletPreferences
+{
+
+ /** The logger. */
+ protected static final Logger log = Logger.getLogger(PortletPreferencesImpl.class);
+
+ /** Indicates the object is used during a action phase. */
+ public static final int ACTION = 1;
+
+ /** Indicates the object is used during a render phase. */
+ public static final int RENDER = 0;
+
+ /** . */
+ protected final PropertyContext prefs;
+
+ /** . */
+ protected final PreferencesValidator validator;
+
+ /** . */
+ protected final ContainerPreferencesInfo containerPrefs;
+
+ /** . */
+ protected final int mode;
+
+ /** Keep track of updates */
+ protected final Map updates;
+
+ public PortletPreferencesImpl(
+ PropertyContext prefs,
+ ContainerPreferencesInfo containerPrefs,
+ PreferencesValidator validator,
+ int mode)
+ {
+ this.prefs = prefs;
+ this.validator = validator;
+ this.containerPrefs = containerPrefs;
+ this.mode = mode;
+ this.updates = new HashMap();
+ }
+
+ public Map getMap()
+ {
+ return new PreferencesMap();
+ }
+
+ public Enumeration getNames()
+ {
+ // Clone the system names
+ Set names = new HashSet(prefs.getPortletKeys());
+
+ // Add the user
+ names.addAll(prefs.getKeys());
+
+ // Add the transient updates
+ for (Iterator i = updates.values().iterator(); i.hasNext();)
+ {
+ PropertyChange change = (PropertyChange)i.next();
+ if (change.getType() == PropertyChange.PREF_UPDATE)
+ {
+ names.add(change.getKey());
+ }
+ else
+ {
+ names.remove(change.getKey());
+ }
+ }
+
+ // Convert to enumeration
+ return Collections.enumeration(names);
+ }
+
+ private Value getValue(String key)
+ {
+ Value value = null;
+ PropertyChange change = (PropertyChange)updates.get(key);
+ if (change != null)
+ {
+ if (change.getType() == PropertyChange.PREF_UPDATE)
+ {
+ value = change.getValue();
+ }
+ else
+ {
+ ContainerPreferenceInfo containerPref = containerPrefs.getContainerPreference(key);
+ if (containerPref != null)
+ {
+ value = containerPref.getDefaultValue();
+ }
+ }
+ }
+ else
+ {
+ // Get user
+ value = prefs.getValue(key);
+
+ // If does not exist or read only use what the default one
+ if (value == null || isReadOnly(key))
+ {
+ ContainerPreferenceInfo containerPref = containerPrefs.getContainerPreference(key);
+ if (containerPref != null)
+ {
+ value = containerPref.getDefaultValue();
+ }
+ }
+ }
+ return value;
+ }
+
+ public String getValue(String key, String def) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key must not be null");
+ }
+ Value value = getValue(key);
+ if (value == null || value.isEmpty())
+ {
+ return def;
+ }
+ else
+ {
+ return value.asString();
+ }
+ }
+
+ public String[] getValues(String key, String[] def) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key must not be null");
+ }
+ Value value = getValue(key);
+ if (value != null)
+ {
+ return value.asStringArray();
+ }
+ else
+ {
+ return def;
+ }
+ }
+
+ public boolean isReadOnly(String key) throws IllegalArgumentException, IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key must not be null");
+ }
+ if (mode == ACTION)
+ {
+ // The accurate value is to combine what the portlet developer and the consumer specifies
+ return prefs.isReadOnly() || prefs.isReadOnly(key);
+ }
+ else
+ {
+ // During render we cannot be aware of the consumer
+ // intent with respect to the access mode of the current state
+ return prefs.isReadOnly(key);
+ }
+ }
+
+ public void reset(String key) throws IllegalArgumentException, ReadOnlyException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key must not be null");
+ }
+ if (isReadOnly(key))
+ {
+ throw new ReadOnlyException("Key " + key + " cannot be written");
+ }
+ updates.put(key, PropertyChange.newReset(key));
+ }
+
+ public void setValue(String key, String value) throws IllegalArgumentException, ReadOnlyException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key must not be null");
+ }
+ if (isReadOnly(key))
+ {
+ throw new ReadOnlyException("Key " + key + " cannot be written");
+ }
+ Value value_ = new StringValue(value);
+ updates.put(key, PropertyChange.newUpdate(key, value_));
+ }
+
+ public void setValues(String key, String[] values) throws IllegalArgumentException, ReadOnlyException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key must not be null");
+ }
+ if (isReadOnly(key))
+ {
+ throw new ReadOnlyException("Key " + key + " cannot be written");
+ }
+ if (values == null)
+ {
+ values = new String[1];
+ }
+ Value value_ = new StringValue(values);
+ updates.put(key, PropertyChange.newUpdate(key, value_));
+ }
+
+ public void store() throws IOException, ValidatorException
+ {
+ // Check we are in the right mode
+ if (mode != ACTION)
+ {
+ throw new IllegalStateException("Store must be called within the scope of an action request");
+ }
+
+ // Copy the transient set to the persistent set if the consumer allows it
+ if (prefs.isReadOnly())
+ {
+ throw new IOException("Should not happen");
+ }
+
+ // If the optional validator is present validate
+ if (validator != null)
+ {
+ validator.validate(this);
+ }
+
+ //
+ PropertyChange[] changes = (PropertyChange[])updates.values().toArray(new PropertyChange[updates.size()]);
+ prefs.update(changes);
+
+ // Clear the updates
+ updates.clear();
+ }
+
+ private class PreferencesMap extends HashMap
+ {
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6969583304804836926L;
+
+ public PreferencesMap()
+ {
+ super(10);
+
+ //
+ for (Iterator i = containerPrefs.getKeys().iterator(); i.hasNext();)
+ {
+ String key = (String)i.next();
+ String[] value = containerPrefs.getContainerPreference(key).getDefaultValue().asStringArray();
+ String[] clone = new String[value.length];
+ System.arraycopy(value, 0, clone, 0, value.length);
+ super.put(key, clone);
+ }
+
+ //
+ for (Iterator i = prefs.getKeys().iterator(); i.hasNext();)
+ {
+ String key = (String)i.next();
+ String[] value = prefs.getValue(key).asStringArray();
+ String[] clone = new String[value.length];
+ System.arraycopy(value, 0, clone, 0, value.length);
+ super.put(key, clone);
+ }
+
+ //
+ for (Iterator i = updates.values().iterator(); i.hasNext();)
+ {
+ PropertyChange change = (PropertyChange)i.next();
+ String key = change.getKey();
+
+ if (change.getType() == PropertyChange.PREF_RESET)
+ {
+ super.remove(key);
+ }
+ else
+ {
+ String[] value = change.getValue().asStringArray();
+ String[] clone = new String[value.length];
+ System.arraycopy(value, 0, clone, 0, value.length);
+ super.put(key, clone);
+ }
+ }
+ }
+
+ public boolean containsValue(Object value)
+ {
+ if (value instanceof String[])
+ {
+ String[] strings = (String[])value;
+ for (Iterator i = super.values().iterator(); i.hasNext();)
+ {
+ String[] other = (String[])i.next();
+ if (Arrays.equals(strings, other))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public Object get(Object key)
+ {
+ return (String[])super.get(key); // Should be cloned here to ensure immutability
+ }
+
+ public Collection values()
+ {
+ return super.values(); // String[] should be cloned here to ensure immutability
+ }
+
+ public Set entrySet()
+ {
+ return super.entrySet();
+ }
+
+ /**
+ * Do not change state.
+ *
+ * @return null
+ */
+ public Object put(Object key, Object value)
+ {
+ return null;
+ }
+
+ /**
+ * Do not change state.
+ *
+ * @return null
+ */
+ public Object remove(Object key)
+ {
+ return null;
+ }
+
+ /** Do not change state. */
+ public void putAll(Map t)
+ {
+ }
+
+ /** Do not change state. */
+ public void clear()
+ {
+ }
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletPreferencesImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestDispatcherImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.impl.jsr168.APIConstants;
+import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletRequest;
+import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletResponse;
+import org.jboss.portal.server.servlet.FilterCommand;
+
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletRequestDispatcherImpl
+ implements PortletRequestDispatcher
+{
+
+ /** The servlet request dispatcher. */
+ private final RequestDispatcher dispatcher;
+
+ /** . */
+ private final String path;
+
+ PortletRequestDispatcherImpl(RequestDispatcher dispatcher)
+ {
+ this(dispatcher, null);
+ }
+
+ PortletRequestDispatcherImpl(RequestDispatcher dispatcher, String path)
+ {
+ this.dispatcher = dispatcher;
+ this.path = path;
+ }
+
+ public void include(RenderRequest req, RenderResponse resp) throws PortletException, IOException
+ {
+ try
+ {
+ // Get the invocation that is still in the request
+ PortletInvocation invocation = (PortletInvocation)req.getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+
+ //
+ HttpServletRequest dreq = invocation.getDispatchedRequest();
+ HttpServletResponse dresp = invocation.getDispatchedResponse();
+
+ // It was set by the PortletContainerInvoker before diving into the portlet, so let's just reuse them
+ RenderRequest rreq = (RenderRequest)req.getAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
+ RenderResponse rresp = (RenderResponse)req.getAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
+
+ //
+ DispatchedHttpServletRequest direq = new DispatchedHttpServletRequest(rreq, dreq, path);
+ DispatchedHttpServletResponse diresp = new DispatchedHttpServletResponse(rresp, dresp);
+
+ //
+ dispatcher.include(direq, diresp);
+ }
+ catch (ServletException e)
+ {
+ // We must translate the servlet exception into a portlet exception for the calling portlet
+ throw new PortletException(e);
+ }
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java (from rev 6691, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,560 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferencesInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContentTypes;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.InstanceContext;
+import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.portlet.spi.SecurityContext;
+import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.portlet.state.PropertyContext;
+
+import javax.portlet.PortalContext;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.RenderRequest;
+import javax.portlet.WindowState;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.security.Principal;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+import java.util.Collection;
+
+/**
+ * PortletRequest implemention. The parameter implementation is left to subclasses that can implement it differently.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision$
+ */
+public abstract class PortletRequestImpl implements PortletRequest
+{
+
+ /** Constant object to mark that a request attribute is removed. */
+ protected static final Object REMOVED_ATTRIBUTE = new Object();
+
+ protected static final Logger log = Logger.getLogger(PortletRequestImpl.class);
+
+ protected PortletInvocation invocation;
+ protected UserContext userContext;
+ protected SecurityContext securityContext;
+ protected RequestContext requestContext;
+ protected InstanceContext instanceContext;
+ protected PortletPreferences preferences;
+
+ protected PortletContainerImpl container;
+ protected ContentTypes contentTypes;
+ protected HttpServletRequest dreq;
+ protected PortalContext portalContext;
+ protected PortletSessionImpl psession;
+
+ protected int sessionStatus;
+
+ /** . */
+ protected PortletParameters parameters;
+
+ /** The lazy request attributes map added or removed during the request of the portlet. */
+ protected Map attributes;
+
+ public PortletRequestImpl(PortletInvocation invocation)
+ {
+ //
+ this.invocation = invocation;
+ this.userContext = invocation.getUserContext();
+ this.securityContext = invocation.getSecurityContext();
+ this.requestContext = invocation.getRequestContext();
+ this.instanceContext = invocation.getInstanceContext();
+ this.container = (PortletContainerImpl)((ContainerPortletInfo)invocation.getInfo()).getContainer();
+ this.contentTypes = container.getContentTypes();
+ this.dreq = invocation.getDispatchedRequest();
+ this.portalContext = new PortalContextImpl(invocation.getPortalContext());
+ this.parameters = null;
+
+ //
+ int mode = this instanceof RenderRequest ? PortletPreferencesImpl.RENDER : PortletPreferencesImpl.ACTION;
+ PropertyContext prefs = (PropertyContext)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
+ PreferencesValidator validator = container.getPreferencesValidator();
+ ContainerPreferencesInfo containerPrefs = (ContainerPreferencesInfo)container.getInfo().getPreferences();
+ this.preferences = new PortletPreferencesImpl(prefs, containerPrefs, validator, mode);
+ }
+
+ // PLT.11.1.1
+
+ public String getParameter(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ if (parameters != null)
+ {
+ return parameters.getValue(name);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Enumeration getParameterNames()
+ {
+ if (parameters != null)
+ {
+ return Collections.enumeration(parameters.keySet());
+ }
+ else
+ {
+ return Tools.EMPTY_ENUMERATION;
+ }
+ }
+
+ public String[] getParameterValues(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ if (parameters != null)
+ {
+ return parameters.getValues(name);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Map getParameterMap()
+ {
+ if (parameters != null)
+ {
+ return Collections.unmodifiableMap(parameters);
+ }
+ else
+ {
+ return Collections.EMPTY_MAP;
+ }
+ }
+
+ public WindowState getWindowState()
+ {
+ String s = invocation.getPortletContext().getWindowState().toString();
+ return PortletUtils.decodeWindowState(s);
+ }
+
+ public PortletMode getPortletMode()
+ {
+ String s = invocation.getPortletContext().getMode().toString();
+ return PortletUtils.decodePortletMode(s);
+ }
+
+ // PLT.11.1.3
+
+ public Object getAttribute(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ if (PortletRequest.USER_INFO.equals(name))
+ {
+ Map infos = userContext.getInformations();
+
+ //
+ if (infos != null)
+ {
+ // Get portlet application metadata
+ PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
+ PortletApplicationMetaData pamd = portletApp.getMetaData();
+ Map uaMD = pamd.getUserAttributes();
+
+ // Clone the map
+ infos = new HashMap(infos);
+
+ // Keep only what is of interest with respect to what the portlet app defines
+ infos.keySet().retainAll(uaMD.keySet());
+
+ // Make it immutable
+ infos = Collections.unmodifiableMap(infos);
+ }
+
+ //
+ return infos;
+ }
+ else
+ {
+ Object value = null;
+ if (attributes != null)
+ {
+ value = attributes.get(name);
+ }
+ if (value == null)
+ {
+ value = requestContext.getAttribute(name);
+ }
+ else if (value == REMOVED_ATTRIBUTE)
+ {
+ value = null;
+ }
+ return value;
+ }
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ // Copy the attribute names to avoid ConcurrentModificationException
+ // one test in the TCK getPortalObjectContext the Enumeration then dispatch the call to a
+ // servlet where it use the Enumeration and it throws a CME if we don't copy
+ Set names = new HashSet();
+ for (Enumeration e = requestContext.getAttributeNames(); e.hasMoreElements();)
+ {
+ names.add(e.nextElement());
+ }
+ if (attributes != null)
+ {
+ for (Iterator i = attributes.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ Object value = entry.getValue();
+ if (value == REMOVED_ATTRIBUTE)
+ {
+ names.remove(name);
+ }
+ else
+ {
+ names.add(name);
+ }
+ }
+ }
+ names.add(PortletRequest.USER_INFO);
+ return Tools.toEnumeration(names.iterator());
+ }
+
+ public void setAttribute(String name, Object value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ if (!PortletRequest.USER_INFO.equals(name))
+ {
+ if (value == null)
+ {
+ value = REMOVED_ATTRIBUTE;
+ }
+ if (attributes == null)
+ {
+ attributes = new HashMap();
+ }
+ attributes.put(name, value);
+ }
+ }
+
+ public void removeAttribute(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ setAttribute(name, null);
+ }
+
+ // PLT.11.1.4
+
+ public String getProperty(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+
+ //
+ Object prop = invocation.getAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, name);
+ if (prop instanceof Collection)
+ {
+ Iterator iterator = ((Collection)prop).iterator();
+ if (iterator.hasNext())
+ {
+ prop = iterator.next();
+ }
+ }
+
+ //
+ if (prop == null)
+ {
+ // Otherwise the request header
+ prop = dreq.getHeader(name);
+ }
+
+ return (String)prop;
+ }
+
+ public Enumeration getProperties(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+
+ //
+ Object prop = invocation.getAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, name);
+ if (prop == null)
+ {
+ // Otherwise the request headers
+ return dreq.getHeaders(name);
+ }
+ else if (prop instanceof Collection)
+ {
+ return Collections.enumeration(((Collection)prop));
+ }
+ else
+ {
+ return Tools.toEnumeration(prop);
+ }
+ }
+
+ public Enumeration getPropertyNames()
+ {
+ // First the properties
+ Set names = new HashSet(invocation.getContext().getAttributeResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE).getKeys());
+
+ // Then put the headers
+ for (Enumeration e = dreq.getHeaderNames();e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ names.add(name);
+ }
+
+ //
+ return Collections.enumeration(names);
+ }
+
+ // PLT.11.1.5
+
+ public String getContextPath()
+ {
+ return (String)dreq.getAttribute("javax.servlet.include.context_path");
+ }
+
+ // PLT.11.1.6
+
+ public String getAuthType()
+ {
+ return securityContext.getAuthType();
+ }
+
+ public String getRemoteUser()
+ {
+ return securityContext.getRemoteUser();
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return securityContext.getUserPrincipal();
+ }
+
+ public boolean isUserInRole(String roleName)
+ {
+ // Get the map role name to role link
+ Map securityRoleRefsMap = ((PortletContainerImpl)((ContainerPortletInfo)invocation.getInfo()).getContainer()).getSecurityRoleRefsMap();
+
+ // Process the role link
+ String roleLink = (String)securityRoleRefsMap.get(roleName);
+ if (roleLink == null)
+ {
+ if (securityRoleRefsMap.containsKey(roleName))
+ {
+ // The role name exist without a role link value
+ return securityContext.isUserInRole(roleName);
+ }
+ else
+ {
+ // No role name is defined
+ return false;
+ }
+ }
+ else
+ {
+ // We have the role link value
+ return securityContext.isUserInRole(roleLink);
+ }
+ }
+
+ public boolean isSecure()
+ {
+ return securityContext.isSecure();
+ }
+
+ // PLT.11.1.7
+
+ public String getResponseContentType()
+ {
+ return invocation.getPortletContext().getStreamInfo().getContentType().toString();
+ }
+
+ public Enumeration getResponseContentTypes()
+ {
+ Vector v = new Vector();
+ v.add(getResponseContentType());
+ return v.elements();
+ }
+
+ // PLT.11.1.8
+
+ public Locale getLocale()
+ {
+ return userContext.getLocale();
+ }
+
+ // PLT.11.1.9
+
+ public boolean isPortletModeAllowed(PortletMode portletMode)
+ {
+ if (portletMode == null)
+ {
+ // The spec does not give way to handle that case properly
+ log.warn("Try to test a null portlet mode");
+ return false;
+ }
+ else
+ {
+ return invocation.getSupportedModes().contains(org.jboss.portal.Mode.create(portletMode.toString()));
+ }
+ }
+
+ // PLT.11.1.10
+
+ public boolean isWindowStateAllowed(WindowState windowState)
+ {
+ return invocation.getSupportedWindowStates().contains(org.jboss.portal.WindowState.create(windowState.toString()));
+ }
+
+ //
+
+ public PortletSession getPortletSession()
+ {
+ return getPortletSession(true);
+ }
+
+ public PortletSession getPortletSession(boolean create)
+ {
+ //
+ if (create)
+ {
+ // Create the session with the dispatched request
+ HttpSession hsession = dreq.getSession(true);
+
+ // Create portlet session
+ PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
+ psession = new PortletSessionImpl(
+ hsession,
+ instanceContext.getId(),
+ portletApp.getPortletContext());
+ }
+ else if (psession == null)
+ {
+ HttpSession hsession = dreq.getSession(false);
+
+ //
+ if (hsession != null)
+ {
+ // Create portlet session
+ PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
+ psession = new PortletSessionImpl(
+ hsession,
+ instanceContext.getId(),
+ portletApp.getPortletContext());
+ }
+ }
+ else if (!psession.isValid())
+ {
+ // If we don't create and the underlying http session is not valid we return null
+ psession = null;
+ }
+
+ //
+ return psession;
+ }
+
+ public PortalContext getPortalContext()
+ {
+ return portalContext;
+ }
+
+ public String getRequestedSessionId()
+ {
+ return dreq.getRequestedSessionId();
+ }
+
+ public boolean isRequestedSessionIdValid()
+ {
+ return dreq.isRequestedSessionIdValid();
+ }
+
+ public Enumeration getLocales()
+ {
+ return Collections.enumeration(userContext.getLocales());
+ }
+
+ public String getScheme()
+ {
+ return requestContext.getScheme();
+ }
+
+ public String getServerName()
+ {
+ return requestContext.getServerName();
+ }
+
+ public int getServerPort()
+ {
+ return requestContext.getServerPort();
+ }
+
+ public PortletPreferences getPreferences()
+ {
+ return preferences;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+import javax.portlet.PortletResponse;
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class PortletResponseImpl implements PortletResponse
+{
+
+ /** . */
+ protected final PortletInvocation invocation;
+
+ /** . */
+ protected final PortletRequestImpl preq;
+
+ protected PortletResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
+ {
+ this.invocation = invocation;
+ this.preq = preq;
+ }
+
+ public String encodeURL(String url)
+ {
+ if (url == null)
+ {
+ throw new IllegalArgumentException("URL must not be null");
+ }
+ return invocation.getPortletContext().encodeResourceURL(url);
+ }
+
+ public void addProperty(String key, String value) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("Name cannot be null");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("Value cannot be null");
+ }
+
+ //
+ AttributeResolver resolver = invocation.getContext().getAttributeResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE);
+ Object prop = resolver.getAttribute(key);
+ if (prop == null)
+ {
+ resolver.setAttribute(key, prop);
+ }
+ else if (prop instanceof Collection)
+ {
+ ((Collection)prop).add(value);
+ }
+ else
+ {
+ Collection c = new ArrayList();
+ c.add(prop);
+ c.add(value);
+ resolver.setAttribute(key, c);
+ }
+ }
+
+ public void setProperty(String key, String value) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("Name cannot be null");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("Value cannot be null");
+ }
+
+ //
+ invocation.setAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, key, value);
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletSessionImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,218 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletSession;
+import javax.servlet.http.HttpSession;
+import java.util.Enumeration;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletSessionImpl implements PortletSession
+{
+
+ private HttpSession session;
+ private String prefix;
+ private PortletContext context;
+
+ public PortletSessionImpl(HttpSession session, String id, PortletContext context)
+ {
+ this.session = session;
+ this.prefix = "javax.portlet.p." + id + "?";
+ this.context = context;
+ }
+
+ public Object getAttribute(String s)
+ {
+ return getAttribute(s, PORTLET_SCOPE);
+ }
+
+ public Object getAttribute(String s, int i)
+ {
+ if (s == null)
+ {
+ throw new IllegalArgumentException("Name must not be null");
+ }
+ if (i == PORTLET_SCOPE)
+ {
+ s = prefix + s;
+ }
+ return session.getAttribute(s);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return getAttributeNames(PORTLET_SCOPE);
+ }
+
+ public Enumeration getAttributeNames(int scope)
+ {
+ final boolean app = scope == APPLICATION_SCOPE;
+ return new Enumeration()
+ {
+ private Enumeration e;
+ private String next;
+
+ {
+ e = session.getAttributeNames();
+ next = null;
+ next();
+ }
+
+ public boolean hasMoreElements()
+ {
+ return next != null;
+ }
+
+ public Object nextElement()
+ {
+ String result = next;
+ next = null;
+ next();
+ return result;
+ }
+
+ private void next()
+ {
+ while (e.hasMoreElements())
+ {
+ String attribute = (String)e.nextElement();
+ if (app && !attribute.startsWith("javax.portlet."))
+ {
+ next = attribute;
+ break;
+ }
+ else if (!app && attribute.startsWith(prefix))
+ {
+ next = attribute.substring(prefix.length());
+ break;
+ }
+ }
+ }
+ };
+ }
+
+ public long getCreationTime()
+ {
+ return session.getCreationTime();
+ }
+
+ public String getId()
+ {
+ return session.getId();
+ }
+
+ public long getLastAccessedTime()
+ {
+ return session.getLastAccessedTime();
+ }
+
+ public int getMaxInactiveInterval()
+ {
+ return session.getMaxInactiveInterval();
+ }
+
+ public void invalidate()
+ {
+ // Invalidate the underlying HTTP session
+ session.invalidate();
+
+ // Mark the session as invalid
+ // valid = false;
+ }
+
+ public boolean isNew()
+ {
+ return session.isNew();
+ }
+
+ public void removeAttribute(String s)
+ {
+ removeAttribute(s, PORTLET_SCOPE);
+ }
+
+ public void removeAttribute(String s, int i)
+ {
+ if (s == null)
+ {
+ throw new IllegalArgumentException("Name must not be null");
+ }
+ if (i == PORTLET_SCOPE)
+ {
+ s = prefix + s;
+ }
+ session.removeAttribute(s);
+ }
+
+ public void setAttribute(String s, Object o)
+ {
+ setAttribute(s, o, PORTLET_SCOPE);
+ }
+
+ public void setAttribute(String s, Object o, int i)
+ {
+ if (s == null)
+ {
+ throw new IllegalArgumentException("Name must not be null");
+ }
+ if (i == PORTLET_SCOPE)
+ {
+ s = prefix + s;
+ }
+ session.setAttribute(s, o);
+ }
+
+ public void setMaxInactiveInterval(int i)
+ {
+ session.setMaxInactiveInterval(i);
+ }
+
+ public PortletContext getPortletContext()
+ {
+ return context;
+ }
+
+ /** Return the underlying session. */
+ HttpSession getHttpSession()
+ {
+ return session;
+ }
+
+ /** Detect validity of the session based on the underlying session. */
+ boolean isValid()
+ {
+ try
+ {
+ session.isNew();
+ return true;
+ }
+ catch (IllegalStateException e)
+ {
+ return false;
+ }
+ }
+
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,200 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletURLImpl implements PortletURL
+{
+
+ private PortletInvocation inv;
+ private PortletRequest preq;
+
+ //
+ private Boolean secure;
+ private InternalPortletURL url;
+
+ public PortletURLImpl(PortletInvocation invocation, PortletRequest preq, InternalPortletURL url)
+ {
+ this.inv = invocation;
+ this.preq = preq;
+ this.url = url;
+ }
+
+ public void setWindowState(WindowState windowState) throws WindowStateException
+ {
+ if (!preq.isWindowStateAllowed(windowState))
+ {
+ throw new WindowStateException("Not supported", windowState);
+ }
+ url.windowState = windowState;
+ }
+
+ public void setPortletMode(PortletMode portletMode) throws PortletModeException
+ {
+ if (portletMode == null)
+ {
+ // The spec does not say the behaviour with null argument
+ // we suppose it clear the current mode
+ url.portletMode = null;
+ }
+ else
+ {
+ // Check possible
+ if (!preq.isPortletModeAllowed(portletMode))
+ {
+ throw new PortletModeException("Not supported", portletMode);
+ }
+
+ // Set mode
+ url.portletMode = portletMode;
+ }
+ }
+
+ /** @throws IllegalArgumentException if the name is null */
+ public void setParameter(String name, String value)
+ {
+ PortletUtils.checkPortletParameterValidity(name, value);
+
+ //
+ url.getInternalParameters().setValue(name, value);
+ }
+
+ public void setParameter(String name, String[] values)
+ {
+ PortletUtils.checkPortletParameterValidity(name, values);
+
+ //
+ url.getInternalParameters().setValues(name, values);
+ }
+
+ public void setParameters(Map parameters)
+ {
+ PortletUtils.checkPortletParameterMapValidity(parameters);
+
+ //
+ url.getInternalParameters().replace(parameters);
+ }
+
+ public void setSecure(boolean secure) throws PortletSecurityException
+ {
+ this.secure = Boolean.valueOf(secure);
+ }
+
+ public String toString()
+ {
+ PortletInvocationContext responseContext = inv.getPortletContext();
+ return responseContext.renderURL(url, secure, null, true);
+ }
+
+ public static abstract class InternalPortletURL implements org.jboss.portal.portlet.PortletURL
+ {
+
+ /** . */
+ private WindowState windowState;
+
+ /** . */
+ private PortletMode portletMode;
+
+ public Mode getMode()
+ {
+ if (portletMode != null)
+ {
+ return Mode.create(portletMode.toString());
+ }
+ return null;
+ }
+
+ public org.jboss.portal.WindowState getWindowState()
+ {
+ if (windowState != null)
+ {
+ return org.jboss.portal.WindowState.create(windowState.toString());
+ }
+ return null;
+ }
+
+ protected abstract PortletParameters getInternalParameters();
+ }
+
+ public static class InternalActionURL extends InternalPortletURL implements ActionURL
+ {
+
+ /** . */
+ private PortletParametersStateString parameters = new PortletParametersStateString();
+
+ protected PortletParameters getInternalParameters()
+ {
+ return parameters.getParameters();
+ }
+
+ public StateString getInteractionState()
+ {
+ return parameters;
+ }
+
+ /** The portlet container does not need to have the navigational state provided. */
+ public StateString getNavigationalState()
+ {
+ return null;
+ }
+ }
+
+ public static class InternalRenderURL extends InternalPortletURL implements RenderURL
+ {
+
+ /** . */
+ private PortletParametersStateString navigationalState = new PortletParametersStateString();
+
+ protected PortletParameters getInternalParameters()
+ {
+ return navigationalState.getParameters();
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.spi.RenderContext;
+
+import javax.portlet.RenderRequest;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision$
+ */
+public class RenderRequestImpl extends PortletRequestImpl implements RenderRequest
+{
+
+ /** . */
+ protected RenderContext renderContext;
+
+ public RenderRequestImpl(RenderInvocation invocation)
+ {
+ super(invocation);
+
+ // Get the render context
+ renderContext = (RenderContext)invocation.getPortletContext();
+
+ // Get the possibly null navigational state
+ StateString navigationalState = renderContext.getNavigationalState();
+
+ //
+ if (navigationalState == null)
+ {
+
+ }
+ else if (navigationalState instanceof PortletParametersStateString)
+ {
+ parameters = ((PortletParametersStateString)navigationalState).getParameters();
+ }
+ else
+ {
+ PortletParametersStateString parametersState = new PortletParametersStateString(navigationalState.getStringValue());
+ parameters = parametersState.getParameters();
+ }
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,193 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.common.MediaType;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
+import org.jboss.portal.server.util.HTTPStreamInfo;
+
+import javax.activation.MimeTypeParseException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class RenderResponseImpl extends PortletResponseImpl implements RenderResponse
+{
+
+ /** The fragment result. */
+ protected FragmentResponse result;
+
+ /** The namespace. */
+ protected String namespace;
+
+ /** Not really used but we need it to memorize what the client set optionally. */
+ protected int bufferSize;
+
+ public RenderResponseImpl(RenderInvocation invocation, PortletRequestImpl preq)
+ {
+ super(invocation, preq);
+
+ // 0 means no buffering - we say no buffering
+ this.bufferSize = 0;
+ this.result = new FragmentResponse();
+ }
+
+ public PortletInvocationResponse getResult()
+ {
+ return result;
+ }
+
+ public void setTitle(String s)
+ {
+ result.setTitle(s);
+ }
+
+ public String getContentType()
+ {
+ return result.getContentType();
+ }
+
+ public void setContentType(String contentType)
+ {
+ try
+ {
+ // Remove the unused appended charset first
+ int index = contentType.indexOf(';');
+ if (index != -1)
+ {
+ contentType = contentType.substring(0, index);
+ }
+
+ // Find the content type among the media type we know
+ MediaType requestedMediaType = MediaType.parseMimeType(contentType);
+
+ // Get the response media type
+ HTTPStreamInfo info = invocation.getPortletContext().getStreamInfo();
+ MediaType responseMediaType = info.getContentType();
+
+ // Check if the requested media type is allowed as a subtype of the main response
+ if (!responseMediaType.isAllowedSubType(requestedMediaType))
+ {
+ throw new IllegalArgumentException("Content type not accepted");
+ }
+
+ // Set the content type
+ result.setContentType(contentType);
+ }
+ catch (MimeTypeParseException e)
+ {
+ IllegalArgumentException ex = new IllegalArgumentException("Content type not accepted");
+ ex.initCause(e);
+ throw ex;
+ }
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ return result.getWriter();
+ }
+
+ public OutputStream getPortletOutputStream() throws IOException
+ {
+ return result.getOutputStream();
+ }
+
+ public PortletURL createRenderURL()
+ {
+ return PortletUtils.createRenderURL(invocation, preq);
+ }
+
+ public PortletURL createActionURL()
+ {
+ return PortletUtils.createActionURL(invocation, preq);
+ }
+
+ public String getNamespace()
+ {
+ if (namespace == null)
+ {
+ String windowId = invocation.getWindowContext().getId();
+ namespace = PortletUtils.generateNamespaceFrom(windowId);
+ }
+ return namespace;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return invocation.getPortletContext().getStreamInfo().getCharset();
+ }
+
+ public Locale getLocale()
+ {
+ return invocation.getUserContext().getLocale();
+ }
+
+ public void setBufferSize(int bufferSize)
+ {
+ if (bufferSize > -0)
+ {
+ this.bufferSize = bufferSize;
+ }
+ }
+
+ public int getBufferSize()
+ {
+ return bufferSize;
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ }
+
+ public void resetBuffer()
+ {
+ // Clear the buffer
+ result.resetBuffer();
+ }
+
+ public void reset()
+ {
+ // Clear the buffer
+ resetBuffer();
+
+ // And properties
+ invocation.getContext().getAttributeResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE).getKeys().clear();
+ }
+
+ public boolean isCommitted()
+ {
+ // Never afterCommit
+ return false;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCacheInfo.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCacheInfo.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCacheInfo.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCacheInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.portlet.impl.jsr168.metadata.CacheConfigMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.info.CacheInfo;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ContainerCacheInfo implements CacheInfo
+{
+
+ /** Cache uses strong references. */
+ public static int REF_STRONG = 0;
+
+ /** Cache uses soft references. */
+ public static int REF_SOFT = 1;
+
+ /** . */
+ private static Logger log = Logger.getLogger(ContainerCacheInfo.class);
+
+ /** . */
+ private int expirationTimeSecs;
+
+ /** . */
+ private int referenceType;
+
+ public ContainerCacheInfo(PortletMetaData portletMD, JBossPortletMetaData jbossPortletMD)
+ {
+ CacheConfigMetaData cacheConfigMD = portletMD.getCacheConfig();
+ if (cacheConfigMD != null)
+ {
+ expirationTimeSecs = cacheConfigMD.getExpirationTime();
+ if (expirationTimeSecs < 0 && expirationTimeSecs != -1)
+ {
+ log.warn("Seen bad caching expiration value " + expirationTimeSecs + " disable caching instead");
+ expirationTimeSecs = 0;
+ }
+ }
+ else
+ {
+ expirationTimeSecs = 0;
+ }
+
+ referenceType = REF_STRONG;
+ if (jbossPortletMD != null)
+ {
+ referenceType = jbossPortletMD.getCacheRefType() == null ? REF_STRONG : jbossPortletMD.getCacheRefType().intValue();
+ }
+ }
+
+ public int getExpirationSecs()
+ {
+ return expirationTimeSecs;
+ }
+
+ public int getReferenceType()
+ {
+ return referenceType;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCacheInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerCapabilities.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,111 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.info.CapabilitiesInfo;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ContainerCapabilities implements CapabilitiesInfo
+{
+ private static Set WINDOW_STATES = new HashSet(3);
+
+ static
+ {
+ WINDOW_STATES.add(new ContainerWindowStateInfo(WindowState.MAXIMIZED));
+ WINDOW_STATES.add(new ContainerWindowStateInfo(WindowState.MINIMIZED));
+ WINDOW_STATES.add(new ContainerWindowStateInfo(WindowState.NORMAL));
+ WINDOW_STATES = Collections.unmodifiableSet(WINDOW_STATES);
+ }
+
+ private Set supportedLocales;
+ private ContentTypes contentTypes;
+ private PortletResourceBundleManager bundleMgr;
+
+ public ContainerCapabilities(Set supportedLocales, PortletResourceBundleManager bundleMgr, ContentTypes contentTypes) throws Exception
+ {
+ this.supportedLocales = supportedLocales;
+ this.contentTypes = contentTypes;
+ this.bundleMgr = bundleMgr;
+ }
+
+ public Set getMimeTypes()
+ {
+ return new HashSet(contentTypes.getAllContentTypes());
+ }
+
+ public Set getAllModes()
+ {
+ Set infos = new HashSet();
+ for (Iterator i = contentTypes.getAllModes().iterator(); i.hasNext();)
+ {
+ infos.add(new ContainerModeInfo((Mode)i.next()));
+ }
+ return infos;
+ }
+
+ public Set getModes(String mimeType)
+ {
+ Set infos = new HashSet();
+ for (Iterator i = contentTypes.getSupportedModes(mimeType).iterator(); i.hasNext();)
+ {
+ infos.add(new ContainerModeInfo((Mode)i.next()));
+ }
+ return infos;
+ }
+
+ public Set getAllWindowStates()
+ {
+ return WINDOW_STATES;
+ }
+
+ public Set getWindowStates(String mimeType)
+ {
+ if (contentTypes.isContentTypeSupported(mimeType))
+ {
+ return getAllWindowStates();
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ public Set getAllLocales()
+ {
+ return supportedLocales;
+ }
+
+ public Set getLocales(String mimeType)
+ {
+ return getAllLocales();
+ }
+
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerCapabilities.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerMetaInfo.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerMetaInfo.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerMetaInfo.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerMetaInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.info.MetaInfo;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ContainerMetaInfo implements MetaInfo
+{
+
+ private Map values;
+ private static final String JAVAX_PORTLET = "javax.portlet.";
+ private static final String[] KEYS = {TITLE, SHORT_TITLE, KEYWORDS};
+ private static final String[] BUNDLE_KEYS = {JAVAX_PORTLET + TITLE, JAVAX_PORTLET + SHORT_TITLE, JAVAX_PORTLET + KEYWORDS};
+
+ public ContainerMetaInfo(PortletMetaData metadata, PortletResourceBundleManager rb)
+ {
+ this.values = new HashMap();
+
+ // Construct info from resource bundle manager
+ if (rb != null)
+ {
+ for (int i = 0; i < KEYS.length; i++)
+ {
+ String key = KEYS[i];
+ Map tmp = new HashMap();
+ List locales = metadata.getLanguages().getSupportedLocales();
+
+ // Add english locale
+ locales.add(Locale.ENGLISH);
+
+ for (Iterator j = locales.iterator(); j.hasNext();)
+ {
+ Locale locale = (Locale)j.next();
+ ResourceBundle bundle = rb.getResourceBundle(locale);
+ try
+ {
+ String value = bundle.getString(BUNDLE_KEYS[i]);
+ tmp.put(locale, value);
+ }
+ catch (MissingResourceException ignore)
+ {
+ }
+ }
+ LocalizedString ls = new LocalizedString(tmp, Locale.ENGLISH);
+ values.put(key, ls);
+ }
+ }
+
+ // Add stuff coming from meta data
+ values.put(DESCRIPTION, Utils.getLocalizedDescription(metadata.getDescription()));
+ values.put(DISPLAY_NAME, Utils.getLocalizedDescription(metadata.getDisplayName()));
+ }
+
+ public LocalizedString getMetaValue(String key)
+ {
+ return (LocalizedString)values.get(key);
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerMetaInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerModeInfo.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerModeInfo.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerModeInfo.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerModeInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.info.ModeInfo;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.4
+ */
+class ContainerModeInfo implements ModeInfo
+{
+ private final Mode mode;
+ private static final LocalizedString DEFAULT_DESCRIPTION = new LocalizedString("Default Portlet mode description.", Locale.ENGLISH);
+
+ public ContainerModeInfo(Mode mode)
+ {
+ this.mode = mode;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return DEFAULT_DESCRIPTION; // fix-me
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public String getModeName()
+ {
+ return mode.toString();
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ final ContainerModeInfo modeInfo = (ContainerModeInfo)o;
+
+ return mode.equals(modeInfo.mode);
+
+ }
+
+ public int hashCode()
+ {
+ return mode.hashCode();
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerModeInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPortletInfo.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,140 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
+import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.info.CacheInfo;
+import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+import org.jboss.portal.portlet.info.SecurityInfo;
+import org.jboss.portal.portlet.info.SessionInfo;
+import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+
+import java.util.HashSet;
+import java.util.Locale;
+
+/**
+ * For now implementation that use the portlet container directly.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ContainerPortletInfo implements PortletInfo
+{
+
+ private PortletContainer container;
+ private ContainerCapabilities capabilities;
+ private ContainerPreferencesInfo preferences;
+ private ContainerMetaInfo meta;
+ private ContainerSecurityInfo security;
+ private ContainerCacheInfo cache;
+ private ContainerSessionInfo session;
+ private Boolean remotable;
+
+ public ContainerPortletInfo(
+ PortletContainerImpl container,
+ PortletResourceBundleManager bundleMgr,
+ ContentTypes contentTypes)
+ throws Exception
+ {
+ PortletMetaData portletMD = container.getMetaData();
+ JBossPortletMetaData jbossPortletMD = container.getJBossMetaData();
+ PortletApplicationImpl pwa = (PortletApplicationImpl)container.getApplication();
+ JBossApplicationMetaData jbossAppMD = pwa.getJBossMetaData();
+
+ //
+ this.container = container;
+
+ // Add Locale.ENGLISH to supported locales if no locales was provided
+ // todo: should we always include it (i.e. even when other locales are present)?
+ HashSet supportedLocales = new HashSet(container.getMetaData().getLanguages().getSupportedLocales());
+ if (supportedLocales.isEmpty())
+ {
+ supportedLocales.add(Locale.ENGLISH);
+ }
+
+ this.capabilities = new ContainerCapabilities(supportedLocales, bundleMgr, contentTypes);
+ this.preferences = portletMD.getPreferences() != null ? new ContainerPreferencesInfo(portletMD, bundleMgr) : new ContainerPreferencesInfo();
+ this.meta = new ContainerMetaInfo(portletMD, bundleMgr);
+ this.security = new ContainerSecurityInfo(portletMD);
+ this.cache = new ContainerCacheInfo(portletMD, jbossPortletMD);
+ this.session = new ContainerSessionInfo(container);
+
+ if (jbossPortletMD != null)
+ {
+ this.remotable = jbossPortletMD.getRemotable();
+ }
+ if (this.remotable == null && jbossAppMD != null)
+ {
+ this.remotable = jbossAppMD.getRemotable();
+ }
+
+ }
+
+ public PortletContainer getContainer()
+ {
+ return container;
+ }
+
+ public CapabilitiesInfo getCapabilities()
+ {
+ return capabilities;
+ }
+
+ public PreferencesInfo getPreferences()
+ {
+ return preferences;
+ }
+
+ public MetaInfo getMeta()
+ {
+ return meta;
+ }
+
+ public SecurityInfo getSecurity()
+ {
+ return security;
+ }
+
+ public CacheInfo getCache()
+ {
+ return cache;
+ }
+
+ public SessionInfo getSession()
+ {
+ return session;
+ }
+
+ public Boolean isRemotable()
+ {
+ return remotable;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPortletInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferenceInfo.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferenceInfo.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferenceInfo.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferenceInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.info.PreferenceInfo;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ContainerPreferenceInfo implements PreferenceInfo
+{
+
+ private String key;
+ private LocalizedString displayName;
+ private LocalizedString description;
+ private Boolean readOnly;
+ private Value value;
+
+ public ContainerPreferenceInfo(String key, LocalizedString displayName, LocalizedString description, boolean readOnly, Value value)
+ {
+ this.key = key;
+ this.displayName = displayName;
+ this.description = description;
+ this.readOnly = Boolean.valueOf(readOnly);
+ this.value = value;
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public Boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ /**
+ * Return the value provided by the portlet.xml deployment descriptor.
+ *
+ * @return the preference value associated with this preference meta data
+ */
+ public Value getDefaultValue()
+ {
+ return value;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferenceInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferencesInfo.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerPreferencesInfo.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferencesInfo.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferencesInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PreferenceMetaData;
+import org.jboss.portal.portlet.info.PreferenceInfo;
+import org.jboss.portal.portlet.info.PreferencesInfo;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ContainerPreferencesInfo implements PreferencesInfo
+{
+
+ /** The cached container preference info. */
+ private Map content;
+
+ public ContainerPreferencesInfo()
+ {
+ content = new HashMap();
+ }
+
+ public ContainerPreferencesInfo(PortletMetaData portletMD, PortletResourceBundleManager bundleMgr)
+ {
+ content = new HashMap();
+
+ for (Iterator i = portletMD.getPreferences().iterator(); i.hasNext();)
+ {
+ PreferenceMetaData prefMD = (PreferenceMetaData)i.next();
+ Value value = new StringValue(prefMD.getValues());
+ LocalizedString displayName = bundleMgr.getLocalizedValue("javax.portlet.preference.name." + prefMD.getName(), prefMD.getName());
+ LocalizedString description = bundleMgr.getLocalizedValue("javax.portlet.preference.description." + prefMD.getName(), prefMD.getName());
+ ContainerPreferenceInfo pref = new ContainerPreferenceInfo(prefMD.getName(), displayName, description, prefMD.isReadOnly(), value);
+ content.put(pref.getKey(), pref);
+ }
+ }
+
+ public ContainerPreferenceInfo getContainerPreference(String key)
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("Preference key must not be null");
+ }
+ return (ContainerPreferenceInfo)content.get(key);
+ }
+
+ public Set getKeys()
+ {
+ return Collections.unmodifiableSet(content.keySet());
+ }
+
+ public PreferenceInfo getPreference(String key)
+ {
+ return getContainerPreference(key);
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerPreferencesInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSecurityInfo.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSecurityInfo.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSecurityInfo.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSecurityInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.portlet.TransportGuarantee;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.TransportGuaranteesMetaData;
+import org.jboss.portal.portlet.info.SecurityInfo;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ContainerSecurityInfo implements SecurityInfo
+{
+
+ /** . */
+ private Set tgs;
+
+ public ContainerSecurityInfo(PortletMetaData portletMD)
+ {
+ tgs = new HashSet();
+ tgs.add(TransportGuarantee.NONE);
+
+ //
+ TransportGuaranteesMetaData tgMD = portletMD.getTransportGuarantees();
+ if (tgMD != null)
+ {
+ for (Iterator i = tgMD.iterator(); i.hasNext();)
+ {
+ TransportGuarantee tg = (TransportGuarantee)i.next();
+ tgs.add(tg);
+ }
+ }
+
+ //
+ tgs = Collections.unmodifiableSet(tgs);
+ }
+
+
+ public boolean containsTransportGuarantee(TransportGuarantee transportGuarantee)
+ {
+ return tgs.contains(transportGuarantee);
+ }
+
+ public Set getTransportGuarantees()
+ {
+ return tgs;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSecurityInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSessionInfo.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerSessionInfo.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSessionInfo.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSessionInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.info.SessionInfo;
+import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ContainerSessionInfo implements SessionInfo
+{
+
+ private Boolean distributed;
+
+ ContainerSessionInfo(PortletContainer portletContainer)
+ {
+ JBossPortletMetaData md = portletContainer.getJBossMetaData();
+ if (md != null)
+ {
+ distributed = md.getDistributed();
+ }
+ if (distributed == null)
+ {
+ distributed = Boolean.FALSE;
+ }
+ }
+
+ public Boolean getDistributed()
+ {
+ return distributed;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerSessionInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerWindowStateInfo.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContainerWindowStateInfo.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerWindowStateInfo.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerWindowStateInfo.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.info.WindowStateInfo;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.4
+ */
+class ContainerWindowStateInfo implements WindowStateInfo
+{
+ private final WindowState windowState;
+ private static final LocalizedString DEFAULT_DESCRIPTION = new LocalizedString("Default window state description.", Locale.ENGLISH);
+
+ public ContainerWindowStateInfo(WindowState windowState)
+ {
+ this.windowState = windowState;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return DEFAULT_DESCRIPTION; //fix-me
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public String getWindowStateName()
+ {
+ return windowState.toString();
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ final ContainerWindowStateInfo that = (ContainerWindowStateInfo)o;
+
+ return windowState.equals(that.windowState);
+
+ }
+
+ public int hashCode()
+ {
+ return windowState.hashCode();
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContainerWindowStateInfo.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/ContentTypes.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,351 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.portlet.impl.jsr168.metadata.ContentTypeMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.ContentTypesMetaData;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This object holds the content type and mode capabilities.
+ * <p/>
+ * Todo : use the media type object ?
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ContentTypes
+{
+ /** Maps MIME Type (String) -> Modes (Set), excluding multiple MIME Types ("*", "* / *", "type / *"). */
+ protected final Map singleTypeToPortletModes;
+ /** Maps MIME Type (String) -> Modes (Set), including multiple MIME Types ("*", "* / *", "type / *"). */
+ protected final Map allTypeToPortletModes;
+
+ protected final Set allModes;
+
+ protected ContentTypesMetaData metadata;
+ protected boolean isStarted = false;
+
+ private static final String ALL = "*";
+ private static final String ALL_ALL = "*/*";
+ private static final char SLASH = '/';
+
+ // case-insensitive
+ // CONTENT TYPE = TYPE / SUBTYPE
+ // SUBTYPE = any char except a TSPECIALS or SPACE or CTLS (??)
+ // TSPECIALS ( ) < > @ , ; : \ " / [ ] ? . =
+
+ public ContentTypes()
+ {
+ singleTypeToPortletModes = new HashMap();
+ allTypeToPortletModes = new HashMap(); // Including *
+ allModes = new HashSet();
+ metadata = null;
+ }
+
+ public ContentTypesMetaData getMetadata()
+ {
+ return metadata;
+ }
+
+ public void setMetadata(ContentTypesMetaData metadata)
+ {
+ isStarted = false;
+ initFromMetadata(metadata);
+ this.metadata = metadata;
+ }
+
+ public void start() throws Exception
+ {
+ initFromMetadata(metadata);
+ }
+
+ /**
+ * Process all the supported content types.
+ *
+ * @param metadata
+ */
+ private void initFromMetadata(ContentTypesMetaData metadata)
+ {
+ if (!isStarted)
+ {
+ if (metadata == null)
+ {
+ throw new IllegalArgumentException("Must pass non-null metadata.");
+ }
+
+ // Reset the collections
+ singleTypeToPortletModes.clear();
+ allTypeToPortletModes.clear();
+ allModes.clear();
+
+ // Build info from metadata
+ for (Iterator i = metadata.iterator(); i.hasNext();)
+ {
+ ContentTypeMetaData contentTypeMD = (ContentTypeMetaData)i.next();
+
+ // Get the content type
+ String contentType = contentTypeMD.getContentType().toLowerCase();
+
+ // Add the content type to the view mode
+ // because each content type must handle this view
+ add(contentType, Mode.VIEW);
+
+ // Then process each mode
+ Set modes = contentTypeMD.getModes();
+ for (Iterator j = modes.iterator(); j.hasNext();)
+ {
+ Mode mode = (Mode)j.next();
+ add(contentType, mode);
+ }
+ }
+ isStarted = true;
+ }
+ }
+
+ public void stop()
+ {
+
+ }
+
+ private void add(String contentType, Mode mode)
+ {
+ // Determines which map and key to store the mode under
+ String key;
+ if (ALL.equals(contentType) || ALL_ALL.equals(contentType))
+ {
+ key = ALL;
+ }
+ else
+ {
+ int index = contentType.indexOf(SLASH);
+ if (index == -1)
+ {
+ System.out.println("'" + contentType + "' is not a valid MIME type: ignoring!");
+ return;
+ }
+
+ String type = contentType.substring(0, index);
+ String subtype = contentType.substring(index + 1);
+
+ if (ALL.equals(subtype))
+ {
+ key = type;
+ }
+ else
+ {
+ key = contentType;
+ // This is a single content type so we need to add it to the single mappings in addition to all
+ addMode(singleTypeToPortletModes, key, mode);
+ }
+ }
+
+ // Store the mode in the complete mapping
+ addMode(allTypeToPortletModes, key, mode);
+
+ // Add the mode to the known modes
+ allModes.add(mode);
+ }
+
+ private void addMode(Map map, String key, Mode mode)
+ {
+ Set modes = (Set)map.get(key);
+ if (modes == null)
+ {
+ modes = new HashSet();
+ map.put(key, modes);
+ }
+ modes.add(mode);
+ }
+
+ /** Return all modes. */
+ public Collection getAllModes()
+ {
+ return Collections.unmodifiableCollection(allModes);
+ }
+
+ /** Return all content types. */
+ public Collection getAllContentTypes()
+ {
+ return Collections.unmodifiableCollection(allTypeToPortletModes.keySet());
+ }
+
+ /**
+ * Return true if the mode is supported
+ *
+ * @throws IllegalArgumentException if the mode is null
+ */
+ public boolean isModeSupported(Mode mode)
+ {
+ if (mode == null)
+ {
+ throw new IllegalArgumentException("Mode must not be null");
+ }
+ return allModes.contains(mode);
+ }
+
+ /**
+ * Return all the supported modes for this content type.
+ *
+ * @throws IllegalArgumentException if the content type is null
+ */
+ public Set getSupportedModes(String contentType)
+ {
+ if (contentType == null)
+ {
+ throw new IllegalArgumentException("Content type must not be null");
+ }
+
+ int index = contentType.indexOf(SLASH);
+ if (index == -1)
+ {
+ // Not valid content type so return empty set
+ return Collections.EMPTY_SET;
+ }
+
+ //
+ Set set = new HashSet();
+
+ //
+ Set contentTypeModes = (Set)singleTypeToPortletModes.get(contentType.toLowerCase());
+ if (contentTypeModes != null)
+ {
+ set.addAll(contentTypeModes);
+ }
+
+ //
+ Set typeModes = (Set)allTypeToPortletModes.get(contentType.substring(0, index).toLowerCase());
+ if (typeModes != null)
+ {
+ set.addAll(typeModes);
+ }
+
+ Set wildcardModes = (Set)allTypeToPortletModes.get(ALL);
+ if (wildcardModes != null)
+ {
+ set.addAll(wildcardModes);
+ }
+
+ return set;
+ }
+
+ /**
+ * Return true if the content type is supported.
+ *
+ * @throws IllegalArgumentException if the content type is null
+ */
+ public boolean isContentTypeSupported(String contentType)
+ {
+ Collection allContentTypes = getAllContentTypes();
+ if (contentType == null)
+ {
+ throw new IllegalArgumentException("Content type must not be null");
+ }
+
+ int index = contentType.indexOf(SLASH);
+ if (index == -1)
+ {
+ // Not valid content type so return false
+ return false;
+ }
+
+ // Try the content type, * or */*
+ if (allContentTypes.contains(contentType) |
+ allContentTypes.contains(contentType.toLowerCase()) |
+ allContentTypes.contains(ALL) |
+ allContentTypes.contains(ALL_ALL))
+ {
+ return true;
+ }
+
+ // Try xxx/*
+ String wildcard = contentType.substring(0, index) + "/*";
+ return allContentTypes.contains(wildcard) | allContentTypes.contains(wildcard.toLowerCase());
+ }
+
+ /**
+ * Return true if the given content type is supported for the given mode.
+ *
+ * @throws IllegalArgumentException if the content type or the mode is null
+ */
+ public boolean isSupported(Mode mode, String contentType)
+ {
+ if (mode == null)
+ {
+ throw new IllegalArgumentException("Mode must not be null");
+ }
+ if (contentType == null)
+ {
+ throw new IllegalArgumentException("Content type must not be null");
+ }
+
+ int index = contentType.indexOf(SLASH);
+ if (index == -1)
+ {
+ // Not valid content type so return false
+ return false;
+ }
+
+ // Try full name matching
+ Set contentTypeModes = (Set)singleTypeToPortletModes.get(contentType);
+ if (contentTypeModes != null && contentTypeModes.contains(mode))
+ {
+ return true;
+ }
+
+ // Try full name lowercase matching
+ Set lowercaseContentTypeModes = (Set)singleTypeToPortletModes.get(contentType.toLowerCase());
+ if (lowercaseContentTypeModes != null && lowercaseContentTypeModes.contains(mode))
+ {
+ return true;
+ }
+
+ // Try type matching
+ String type = contentType.substring(0, index);
+ Set typeMode = (Set)allTypeToPortletModes.get(type);
+ if (typeMode != null && typeMode.contains(mode))
+ {
+ return true;
+ }
+
+ // Try type matching
+ Set lowercaseTypeMode = (Set)allTypeToPortletModes.get(type.toLowerCase());
+ if (lowercaseTypeMode != null && lowercaseTypeMode.contains(mode))
+ {
+ return true;
+ }
+
+ // Try wildcard matching
+ Set wildcardMode = (Set)allTypeToPortletModes.get(ALL);
+ return wildcardMode != null && wildcardMode.contains(mode);
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/ContentTypes.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/InfoBundle.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/InfoBundle.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/InfoBundle.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/InfoBundle.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.portlet.impl.jsr168.APIConstants;
+import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListResourceBundle;
+import java.util.Locale;
+
+/**
+ * A resource bundle that contains the inline information defined by the portlet specification.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InfoBundle extends ListResourceBundle
+{
+
+ private static final Logger log = Logger.getLogger(InfoBundle.class);
+
+ /** . */
+ private final Object[][] content;
+
+ public InfoBundle(LanguagesMetaData.InfoMetaData metaData)
+ {
+ log.debug("Creates the parent bundle");
+
+ //
+ List list = new ArrayList(3);
+
+ //
+ String title = metaData.getTitle();
+ if (title == null)
+ {
+ throw new IllegalArgumentException("Title must be provided");
+ }
+ list.add(new Object[]{APIConstants.JAVAX_PORTLET_TITLE, title});
+
+ //
+ if (metaData.getShortTitle() != null)
+ {
+ list.add(new Object[]{APIConstants.JAVAX_PORTLET_SHORT_TITLE, metaData.getShortTitle()});
+ }
+
+ //
+ if (metaData.getKeywords() != null)
+ {
+ list.add(new Object[]{APIConstants.JAVAX_PORTLET_KEYWORDS, metaData.getKeywords()});
+ }
+
+ //
+ content = (Object[][])list.toArray(new Object[list.size()][]);
+ }
+
+ protected Object[][] getContents()
+ {
+ return content;
+ }
+
+ /**
+ * This is the english locale.
+ *
+ * @return the english locale
+ */
+ public Locale getLocale()
+ {
+ return Locale.ENGLISH;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/InfoBundle.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/PortletResourceBundleManager.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/PortletResourceBundleManager.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/PortletResourceBundleManager.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/PortletResourceBundleManager.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,194 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.util.EmptyResourceBundle;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.common.util.ParentChildResourceBundle;
+import org.jboss.portal.portlet.impl.jsr168.metadata.LanguagesMetaData;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Manage resource bundles for a portlet.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortletResourceBundleManager
+{
+
+ private Logger log = Logger.getLogger(PortletResourceBundleManager.class);
+
+ /** */
+ private Map localeBundles;
+
+ /** */
+ private String baseName;
+
+ /** */
+ private ClassLoader classLoader;
+
+ /** */
+ private ResourceBundle infoBundle;
+
+ /** */
+ private Collection supportedLocales;
+
+ public PortletResourceBundleManager(ClassLoader classLoader, LanguagesMetaData metaData)
+ {
+ if (classLoader == null)
+ {
+ throw new IllegalArgumentException("Need a non null classloader");
+ }
+ if (metaData == null)
+ {
+ throw new IllegalArgumentException("Need non null meta data");
+ }
+ this.classLoader = classLoader;
+ this.baseName = metaData.getResourceBundle();
+ this.localeBundles = new HashMap();
+ this.supportedLocales = metaData.getSupportedLocales();
+
+ // Get the resource bundle containing the portlet info
+ LanguagesMetaData.InfoMetaData infoMD = metaData.getInfo();
+ if (infoMD != null)
+ {
+ infoBundle = new InfoBundle(infoMD);
+ }
+ else
+ {
+ infoBundle = new EmptyResourceBundle();
+ }
+ }
+
+ /**
+ * Return a localized value constructed from the various resource bundles. The supported locales of the manager are
+ * used in combination with the specified key. The default value is used if no value is found for the
+ * <code>Locale.ENGLISH</code>.
+ *
+ * @param key the key to lookup in the bundles
+ * @param defaultValue
+ * @return the localized string
+ * @throws IllegalArgumentException if the key of the default value is null
+ */
+ public LocalizedString getLocalizedValue(String key, String defaultValue) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("No null key accepted");
+ }
+ if (defaultValue == null)
+ {
+ throw new IllegalArgumentException("No null default value accepted");
+ }
+ Map m = new HashMap();
+ for (Iterator j = supportedLocales.iterator(); j.hasNext();)
+ {
+ try
+ {
+ Locale locale = (Locale)j.next();
+ ResourceBundle bundle = getResourceBundle(locale);
+ String localizedDisplayName = bundle.getString(key);
+ m.put(locale, localizedDisplayName);
+ }
+ catch (MissingResourceException ignore)
+ {
+ }
+ }
+ if (!m.containsKey(Locale.ENGLISH))
+ {
+ m.put(Locale.ENGLISH, defaultValue);
+ }
+ return new LocalizedString(m, Locale.ENGLISH);
+ }
+
+ /**
+ * Return a bundle for the given locale. If the complete locale (language + country + variant) does not exist then it
+ * falls back to (language + country) or (language) or the default file.
+ * <p/>
+ * When the resource bundle object is found and was not in the global map, it put it in that map with a copy on
+ * write.
+ *
+ * @throws IllegalArgumentException if the locale is null
+ */
+ public ResourceBundle getResourceBundle(Locale locale) throws IllegalArgumentException
+ {
+ // Arg check
+ if (locale == null)
+ {
+ throw new IllegalArgumentException("Locale cannot be null");
+ }
+
+ // Try to get the bundle if the map
+ ResourceBundle bundle = (ResourceBundle)localeBundles.get(locale);
+ if (bundle != null)
+ {
+ return bundle;
+ }
+
+ //
+ log.debug("Want to load bundle " + baseName + " for locale " + locale);
+
+ if (baseName == null)
+ {
+ bundle = infoBundle;
+ }
+ else
+ {
+ try
+ {
+ bundle = ResourceBundle.getBundle(baseName, locale, classLoader);
+ if (infoBundle != null)
+ {
+ bundle = new ParentChildResourceBundle(infoBundle, bundle);
+ }
+ log.debug("Created bundle " + baseName + " for locale " + locale);
+ }
+ catch (MissingResourceException e)
+ {
+ log.warn("Bundle " + baseName + " for locale " + locale + " not found");
+ bundle = infoBundle;
+ }
+ }
+
+ // Cache the bundle
+ if (bundle != null)
+ {
+ Map copy = new HashMap(localeBundles);
+ copy.put(locale, bundle);
+ localeBundles = copy;
+ }
+
+ //
+ return bundle;
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/PortletResourceBundleManager.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/Utils.java (from rev 6689, trunk/portlet/src/main/org/jboss/portal/portlet/container/info/Utils.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/Utils.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/Utils.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.info;
+
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.impl.jsr168.metadata.LocalizedStringMetaData;
+import org.jboss.portal.portlet.impl.jsr168.metadata.LocalizedValueMetaData;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class Utils
+{
+
+ private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
+
+ public static LocalizedString getLocalizedDescription(LocalizedStringMetaData describable)
+ {
+ Map m = new HashMap();
+ for (int i = 0; i < describable.getValues().size(); i++)
+ {
+ LocalizedValueMetaData descriptionMD = (LocalizedValueMetaData)describable.getValues().get(i);
+ Locale locale = descriptionMD.getLocale();
+ if (locale == null)
+ {
+ locale = DEFAULT_LOCALE;
+ }
+ m.put(locale, descriptionMD.getValue());
+ }
+ return new LocalizedString(m, DEFAULT_LOCALE);
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/info/Utils.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/info/CacheInfoSupport.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.support.info;
-import org.jboss.portal.portlet.container.info.ContainerCacheInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerCacheInfo;
import org.jboss.portal.portlet.info.CacheInfo;
/**
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/info/PreferenceInfoTest.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/info/PreferenceInfoTest.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/info/PreferenceInfoTest.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -23,8 +23,8 @@
package org.jboss.portal.test.portlet.info;
import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.info.ContainerPreferencesInfo;
-import org.jboss.portal.portlet.container.info.ContainerPreferenceInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferencesInfo;
+import org.jboss.portal.portlet.impl.jsr168.info.ContainerPreferenceInfo;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.common.test.driver.response.EndTestResponse;
Modified: trunk/portlet/src/main/org/jboss/portal/test/server/ContentTypesTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/server/ContentTypesTestCase.java 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/main/org/jboss/portal/test/server/ContentTypesTestCase.java 2007-03-15 20:53:20 UTC (rev 6697)
@@ -25,7 +25,7 @@
import junit.framework.TestCase;
import org.jboss.portal.Mode;
-import org.jboss.portal.portlet.container.info.ContentTypes;
+import org.jboss.portal.portlet.impl.jsr168.info.ContentTypes;
import org.jboss.portal.portlet.impl.jsr168.metadata.ContentTypeMetaData;
import org.jboss.portal.portlet.impl.jsr168.metadata.ContentTypesMetaData;
Modified: trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml 2007-03-15 20:13:17 UTC (rev 6696)
+++ trunk/portlet/src/resources/test-sar/META-INF/jboss-service.xml 2007-03-15 20:53:20 UTC (rev 6697)
@@ -76,7 +76,6 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends-list optional-attribute-name="InterceptorNames">
- <depends-list-element>portal:service=Interceptor,type=Server,name=User</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=Locale</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=ContentType</depends-list-element>
</depends-list>
19 years, 1 month
JBoss Portal SVN: r6696 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-03-15 16:13:17 -0400 (Thu, 15 Mar 2007)
New Revision: 6696
Modified:
docs/trunk/referenceGuide/en/modules/ldap.xml
Log:
doc update
Modified: docs/trunk/referenceGuide/en/modules/ldap.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/ldap.xml 2007-03-15 20:07:47 UTC (rev 6695)
+++ docs/trunk/referenceGuide/en/modules/ldap.xml 2007-03-15 20:13:17 UTC (rev 6696)
@@ -151,7 +151,7 @@
</sect1>
<sect1 id="ldap.ldap_identity_modules">
<title>LDAP Identity Modules</title>
- <para>TODO:</para>
+ <para>JBoss Portal comes with base LDAP implementation of all identity modules.</para>
<sect2>
<title>Common settings</title>
<para>For all modules you can set two config options:
@@ -208,7 +208,6 @@
</para>
<sect3>
<title>LDAPUserModuleImpl</title>
- <para>TODO:</para>
<para>This is the base implementation of LDAP <emphasis>UserModule</emphasis>. It supports user creation, but will retreive users and create them
in strictly specified place in LDAP tree.</para>
<para>To enable it in your configuration you should have:
@@ -294,8 +293,8 @@
</sect3>
<sect3>
<title>LDAPExtUserModuleImpl</title>
- <para>TODO:</para>
- <para>This module doesn't support user creation and removal</para>
+ <para>Aim of this implementation is to give more flexibility for users retreival. You can specify LDAP filter
+ that will be used for searches. This module doesn't support user creation and removal</para>
<para>To enable it in your configuration you should have:
<programlisting>
<![CDATA[
@@ -390,8 +389,8 @@
</para>
<sect3>
<title>LDAPRoleModuleImpl</title>
- <para>TODO:</para>
- <para>This module doesn't support role creation and removal</para>
+ <para>This is the base implementation of LDAP <emphasis>RoleModule</emphasis>. It supports user creation, but will retreive roles and create them
+ in strictly specified place in LDAP tree.</para>
<para>To enable it in your configuration you should have:
<programlisting>
<![CDATA[
@@ -428,7 +427,9 @@
</sect3>
<sect3>
<title>LDAPExtRoleModuleImpl</title>
- <para>TODO:</para>
+ <para>Aim of this implementation is to give more flexibility for roless retreival. You can specify LDAP filter
+ that will be used for searches. This module doesn't support role creation and removal</para>
+ <para>This module doesn't support role creation and removal</para>
<para>To enable it in your configuration you should have:
<programlisting>
<![CDATA[
@@ -541,7 +542,6 @@
</para>
<sect3>
<title>LDAPStaticGroupMembershipModuleImpl</title>
- <para>TODO:</para>
<para>This module support tree shape where role entries keep information about users that are their members.</para>
<para>To enable it in your configuration you should have:
<programlisting>
@@ -575,7 +575,6 @@
</sect3>
<sect3>
<title>LDAPStaticRoleMembershipModuleImpl</title>
- <para>TODO:</para>
<para>This module support tree shape where user entries keep information about roles that they belong to.</para>
<para>To enable it in your configuration you should have:
<programlisting>
@@ -613,7 +612,7 @@
<title>UserProfileModule</title>
<sect3>
<title>LDAPUserProfileModuleImpl</title>
- <para>TODO:</para>
+ <para>This is standard implementation that enables to retreive user properties from atributes in LDAP entries.</para>
<para>To enable it in your configuration you should have:
<programlisting>
<![CDATA[
19 years, 1 month