You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by es...@apache.org on 2007/12/29 18:32:18 UTC

svn commit: r607450 [7/36] - in /portals/pluto/trunk: ./ assembly/src/main/assembly/ assembly/src/main/resources/ maven-pluto-plugin/ maven-pluto-plugin/src/main/java/org/apache/pluto/maven/ pluto-ant-tasks/ pluto-ant-tasks/src/assemble/ pluto-ant-task...

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java?rev=607450&r1=607449&r2=607450&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java Sat Dec 29 09:31:56 2007
@@ -1,280 +1,280 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Set;
-
-import javax.portlet.PortletContext;
-import javax.portlet.PortletRequestDispatcher;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.pluto.descriptors.portlet.PortletAppDD;
-import org.apache.pluto.internal.InternalPortletContext;
-
-/**
- * Pluto's Portlet Context Implementation. This class implements the
- * <code>InternalPortletContext</code> which provides container specific
- * information needed for processing.
- *
- * @version 1.1
- */
-public class PortletContextImpl
-    implements PortletContext, InternalPortletContext {
-
-    /**
-     * Logger.
-     */
-    private static final Log LOG = LogFactory.getLog(PortletContextImpl.class);
-
-
-    // Private Member Variables ------------------------------------------------
-
-    private final String applicationId;
-    private String applicationName;
-
-    private final PortletAppDD portletAppDD;
-    private final ServletContext servletContext;
-    private ClassLoader contextClassLoader;
-
-    // Constructor -------------------------------------------------------------
-
-    /**
-     * Constructs an instance.
-     *
-     * @param servletContext the servlet context in which we are contained.
-     * @param portletAppDD   the portlet application descriptor.
-     * @param portletApplicationId applicationId
-     */
-    public PortletContextImpl(String portletApplicationId,
-                              ServletContext servletContext,
-                              PortletAppDD portletAppDD) {
-        this.servletContext = servletContext;
-        this.portletAppDD = portletAppDD;
-        this.applicationId = portletApplicationId;
-        this.applicationName = servletContext.getServletContextName();
-
-        if(applicationName == null) {
-            applicationName = applicationId;
-        }
-        init();
-    }
-
-    private void init() {
-        setContextClassLoader(Thread.currentThread().getContextClassLoader());
-    }
-
-    public String getApplicationId() {
-        return applicationId;
-    }
-
-    public String getApplicationName() {
-        return applicationName;
-    }
-
-    /**
-     * ClassLoader associated with this context.
-     * @return
-     */
-    public ClassLoader getContextClassLoader() {
-        return contextClassLoader;
-    }
-
-    /**
-     * ClassLoader associated with this context.
-     * @param contextClassLoader
-     */
-    public void setContextClassLoader(ClassLoader contextClassLoader) {
-        this.contextClassLoader = contextClassLoader;
-    }
-
-    // PortletContext Impl -----------------------------------------------------
-
-    /**
-     * Retrieve the PortletContainer's server info.
-     *
-     * @return the server info in the form of <i>Server/Version</i>
-     * @see Environment#getServerInfo()
-     */
-    public String getServerInfo() {
-        return Environment.getServerInfo();
-    }
-
-    public PortletRequestDispatcher getRequestDispatcher(String path) {
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("PortletRequestDispatcher requested: " + path);
-        }
-
-        // Check if the path name is valid. A valid path name must not be null
-        //   and must start with a slash '/' as defined by the portlet spec.
-        if (path == null || !path.startsWith("/")) {
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Failed to retrieve PortletRequestDispatcher: "
-                    + "path name must begin with a slash '/'.");
-            }
-            return null;
-        }
-
-        // Extract query string which contains appended parameters.
-        String queryString = null;
-        int index = path.indexOf("?");
-        if (index > 0 && index < path.length() - 1) {
-            queryString = path.substring(index + 1);
-        }
-
-        // Construct PortletRequestDispatcher.
-        PortletRequestDispatcher portletRequestDispatcher = null;
-        try {
-            RequestDispatcher servletRequestDispatcher = servletContext
-                .getRequestDispatcher(path);
-            if (servletRequestDispatcher != null) {
-                portletRequestDispatcher = new PortletRequestDispatcherImpl(
-                    servletRequestDispatcher, queryString);
-            } else {
-                if (LOG.isInfoEnabled()) {
-                    LOG.info("No matching request dispatcher found for: " + path);
-                }
-            }
-        } catch (Exception ex) {
-            // We need to catch exception because of a Tomcat 4.x bug.
-            //   Tomcat throws an exception instead of return null if the path
-            //   was not found.
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Failed to retrieve PortletRequestDispatcher: "
-                    + ex.getMessage());
-            }
-            portletRequestDispatcher = null;
-        }
-        return portletRequestDispatcher;
-    }
-
-    public PortletRequestDispatcher getNamedDispatcher(String name) {
-        RequestDispatcher dispatcher = servletContext.getNamedDispatcher(name);
-        if (dispatcher != null) {
-            return new PortletRequestDispatcherImpl(dispatcher);
-        } else {
-            if (LOG.isInfoEnabled()) {
-                LOG.info("No matching request dispatcher found for name: "
-                    + name);
-            }
-        }
-        return null;
-    }
-
-    public InputStream getResourceAsStream(String path) {
-        return servletContext.getResourceAsStream(path);
-    }
-
-    public int getMajorVersion() {
-        return Environment.getMajorSpecificationVersion();
-    }
-
-    public int getMinorVersion() {
-        return Environment.getMinorSpecificationVersion();
-    }
-
-    public String getMimeType(String file) {
-        return servletContext.getMimeType(file);
-    }
-
-    public String getRealPath(String path) {
-        return servletContext.getRealPath(path);
-    }
-
-    public Set getResourcePaths(String path) {
-        return servletContext.getResourcePaths(path);
-    }
-
-    public URL getResource(String path)
-        throws java.net.MalformedURLException {
-        if (path == null || !path.startsWith("/")) {
-            throw new MalformedURLException("path must start with a '/'");
-        }
-        return servletContext.getResource(path);
-    }
-
-    public Object getAttribute(java.lang.String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Attribute name == null");
-        }
-
-        return servletContext.getAttribute(name);
-    }
-
-    public Enumeration getAttributeNames() {
-        return servletContext.getAttributeNames();
-    }
-
-    public String getInitParameter(java.lang.String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Parameter name == null");
-        }
-
-        return servletContext.getInitParameter(name);
-    }
-
-    public Enumeration getInitParameterNames() {
-        return servletContext.getInitParameterNames();
-    }
-
-    public void log(java.lang.String msg) {
-        servletContext.log(msg);
-    }
-
-    public void log(java.lang.String message, java.lang.Throwable throwable) {
-        servletContext.log(message, throwable);
-    }
-
-    public void removeAttribute(java.lang.String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Attribute name == null");
-        }
-
-        servletContext.removeAttribute(name);
-    }
-
-    public void setAttribute(java.lang.String name, java.lang.Object object) {
-        if (name == null) {
-            throw new IllegalArgumentException("Attribute name == null");
-        }
-
-        servletContext.setAttribute(name, object);
-    }
-
-    public String getPortletContextName() {
-        return servletContext.getServletContextName();
-    }
-
-    // org.apache.pluto.core.InternalPortletContext Impl -----------------------
-
-    public ServletContext getServletContext() {
-        return servletContext;
-    }
-
-    public PortletAppDD getPortletApplicationDefinition() {
-        return portletAppDD;
-    }
-
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.internal.impl;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Set;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.internal.InternalPortletContext;
+
+/**
+ * Pluto's Portlet Context Implementation. This class implements the
+ * <code>InternalPortletContext</code> which provides container specific
+ * information needed for processing.
+ *
+ * @version 1.1
+ */
+public class PortletContextImpl
+    implements PortletContext, InternalPortletContext {
+
+    /**
+     * Logger.
+     */
+    private static final Log LOG = LogFactory.getLog(PortletContextImpl.class);
+
+
+    // Private Member Variables ------------------------------------------------
+
+    private final String applicationId;
+    private String applicationName;
+
+    private final PortletAppDD portletAppDD;
+    private final ServletContext servletContext;
+    private ClassLoader contextClassLoader;
+
+    // Constructor -------------------------------------------------------------
+
+    /**
+     * Constructs an instance.
+     *
+     * @param servletContext the servlet context in which we are contained.
+     * @param portletAppDD   the portlet application descriptor.
+     * @param portletApplicationId applicationId
+     */
+    public PortletContextImpl(String portletApplicationId,
+                              ServletContext servletContext,
+                              PortletAppDD portletAppDD) {
+        this.servletContext = servletContext;
+        this.portletAppDD = portletAppDD;
+        this.applicationId = portletApplicationId;
+        this.applicationName = servletContext.getServletContextName();
+
+        if(applicationName == null) {
+            applicationName = applicationId;
+        }
+        init();
+    }
+
+    private void init() {
+        setContextClassLoader(Thread.currentThread().getContextClassLoader());
+    }
+
+    public String getApplicationId() {
+        return applicationId;
+    }
+
+    public String getApplicationName() {
+        return applicationName;
+    }
+
+    /**
+     * ClassLoader associated with this context.
+     * @return
+     */
+    public ClassLoader getContextClassLoader() {
+        return contextClassLoader;
+    }
+
+    /**
+     * ClassLoader associated with this context.
+     * @param contextClassLoader
+     */
+    public void setContextClassLoader(ClassLoader contextClassLoader) {
+        this.contextClassLoader = contextClassLoader;
+    }
+
+    // PortletContext Impl -----------------------------------------------------
+
+    /**
+     * Retrieve the PortletContainer's server info.
+     *
+     * @return the server info in the form of <i>Server/Version</i>
+     * @see Environment#getServerInfo()
+     */
+    public String getServerInfo() {
+        return Environment.getServerInfo();
+    }
+
+    public PortletRequestDispatcher getRequestDispatcher(String path) {
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("PortletRequestDispatcher requested: " + path);
+        }
+
+        // Check if the path name is valid. A valid path name must not be null
+        //   and must start with a slash '/' as defined by the portlet spec.
+        if (path == null || !path.startsWith("/")) {
+            if (LOG.isInfoEnabled()) {
+                LOG.info("Failed to retrieve PortletRequestDispatcher: "
+                    + "path name must begin with a slash '/'.");
+            }
+            return null;
+        }
+
+        // Extract query string which contains appended parameters.
+        String queryString = null;
+        int index = path.indexOf("?");
+        if (index > 0 && index < path.length() - 1) {
+            queryString = path.substring(index + 1);
+        }
+
+        // Construct PortletRequestDispatcher.
+        PortletRequestDispatcher portletRequestDispatcher = null;
+        try {
+            RequestDispatcher servletRequestDispatcher = servletContext
+                .getRequestDispatcher(path);
+            if (servletRequestDispatcher != null) {
+                portletRequestDispatcher = new PortletRequestDispatcherImpl(
+                    servletRequestDispatcher, queryString);
+            } else {
+                if (LOG.isInfoEnabled()) {
+                    LOG.info("No matching request dispatcher found for: " + path);
+                }
+            }
+        } catch (Exception ex) {
+            // We need to catch exception because of a Tomcat 4.x bug.
+            //   Tomcat throws an exception instead of return null if the path
+            //   was not found.
+            if (LOG.isInfoEnabled()) {
+                LOG.info("Failed to retrieve PortletRequestDispatcher: "
+                    + ex.getMessage());
+            }
+            portletRequestDispatcher = null;
+        }
+        return portletRequestDispatcher;
+    }
+
+    public PortletRequestDispatcher getNamedDispatcher(String name) {
+        RequestDispatcher dispatcher = servletContext.getNamedDispatcher(name);
+        if (dispatcher != null) {
+            return new PortletRequestDispatcherImpl(dispatcher);
+        } else {
+            if (LOG.isInfoEnabled()) {
+                LOG.info("No matching request dispatcher found for name: "
+                    + name);
+            }
+        }
+        return null;
+    }
+
+    public InputStream getResourceAsStream(String path) {
+        return servletContext.getResourceAsStream(path);
+    }
+
+    public int getMajorVersion() {
+        return Environment.getMajorSpecificationVersion();
+    }
+
+    public int getMinorVersion() {
+        return Environment.getMinorSpecificationVersion();
+    }
+
+    public String getMimeType(String file) {
+        return servletContext.getMimeType(file);
+    }
+
+    public String getRealPath(String path) {
+        return servletContext.getRealPath(path);
+    }
+
+    public Set getResourcePaths(String path) {
+        return servletContext.getResourcePaths(path);
+    }
+
+    public URL getResource(String path)
+        throws java.net.MalformedURLException {
+        if (path == null || !path.startsWith("/")) {
+            throw new MalformedURLException("path must start with a '/'");
+        }
+        return servletContext.getResource(path);
+    }
+
+    public Object getAttribute(java.lang.String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Attribute name == null");
+        }
+
+        return servletContext.getAttribute(name);
+    }
+
+    public Enumeration getAttributeNames() {
+        return servletContext.getAttributeNames();
+    }
+
+    public String getInitParameter(java.lang.String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Parameter name == null");
+        }
+
+        return servletContext.getInitParameter(name);
+    }
+
+    public Enumeration getInitParameterNames() {
+        return servletContext.getInitParameterNames();
+    }
+
+    public void log(java.lang.String msg) {
+        servletContext.log(msg);
+    }
+
+    public void log(java.lang.String message, java.lang.Throwable throwable) {
+        servletContext.log(message, throwable);
+    }
+
+    public void removeAttribute(java.lang.String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Attribute name == null");
+        }
+
+        servletContext.removeAttribute(name);
+    }
+
+    public void setAttribute(java.lang.String name, java.lang.Object object) {
+        if (name == null) {
+            throw new IllegalArgumentException("Attribute name == null");
+        }
+
+        servletContext.setAttribute(name, object);
+    }
+
+    public String getPortletContextName() {
+        return servletContext.getServletContextName();
+    }
+
+    // org.apache.pluto.core.InternalPortletContext Impl -----------------------
+
+    public ServletContext getServletContext() {
+        return servletContext;
+    }
+
+    public PortletAppDD getPortletApplicationDefinition() {
+        return portletAppDD;
+    }
+
+}
+

Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java?rev=607450&r1=607449&r2=607450&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java Sat Dec 29 09:31:56 2007
@@ -1,201 +1,201 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.portlet.PreferencesValidator;
-import javax.portlet.ValidatorException;
-import javax.servlet.ServletContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.pluto.PortletContainerException;
-import org.apache.pluto.descriptors.portlet.PortletAppDD;
-import org.apache.pluto.descriptors.portlet.PortletDD;
-import org.apache.pluto.descriptors.portlet.PortletPreferenceDD;
-import org.apache.pluto.descriptors.portlet.PortletPreferencesDD;
-import org.apache.pluto.descriptors.servlet.ServletDD;
-import org.apache.pluto.internal.InternalPortletPreference;
-import org.apache.pluto.internal.PortletDescriptorRegistry;
-import org.apache.pluto.internal.PortletEntity;
-import org.apache.pluto.internal.PreferencesValidatorRegistry;
-
-/**
- * The PortletEntity encapsulates all data pertaining to a single portlet
- * instance.  This instance may appear zero or more times per user. The
- * PortletEntity consists of two primary peices of information, the Portlet
- * Definition as defined by the {@link PortletDD} and the Wrapping Servlet
- * information as defined by the{@link ServletDD}
- *
- */
-public class PortletEntityImpl implements PortletEntity {
-
-	/** Logger. */
-    private static final Log LOG = LogFactory.getLog(PortletEntityImpl.class);
-
-    /** URI prefix of the portlet invoker servlet. */
-    private static final String PREFIX = "/PlutoInvoker/";
-
-
-    // Private Member Variables ------------------------------------------------
-
-    /** The servlet context. */
-    private final ServletContext servletContext;
-
-    /** The portlet window. */
-    private final String portletName;
-
-    /** The cached PortletDD retrieved from the portlet descriptor registry. */
-    private PortletDD portletDefinition;
-
-    /** Default portlet preferences defined for this portlet. */
-    private InternalPortletPreference[] defaultPreferences;
-
-
-    // Constructor -------------------------------------------------------------
-
-    PortletEntityImpl(ServletContext servletContext, String portletName) {
-        this.servletContext = servletContext;
-        this.portletName = portletName;
-    }
-
-
-    // PortletEntity Impl ------------------------------------------------------
-
-    /**
-     * Returns the URI to the controller servlet that wraps this portlet.
-     * @return the URI to the controller servlet that wraps this portlet.
-     * @deprecated
-     */
-    public String getControllerServletUri() {
-        // this method is deprecated as of pluto 1.1.2, so that
-        // we can remove it in the future.  The PortletInvokerService
-        // will be responsible for resolving the URI used to invoke
-        // the portlet.
-        return PREFIX + portletName;
-    }
-
-    /**
-     * Returns an array of default preferences of this portlet. The default
-     * preferences are retrieved from the portlet application descriptor.
-     * <p>
-     * Data retrieved from <code>portlet.xml</code> are injected into the domain
-     * object <code>PortletPreferenceDD</code>. This method converts the domain
-     * objects into <code>PortletPreference</code> objects.
-     * </p>
-     * <p>
-     * Note that if no value is bound to a given preference key,
-     * <code>PortletPreferenceDD.getValues()</code> will return an empty string
-     * list, but the value array of <code>PortletPreference</code> should be set
-     * to null (instead of an empty array).
-     * </p>
-     * <p>
-     * This method never returns null, but the values held by PortletPreference
-     * may be null.
-     * </p>
-     * @return the preference set
-     *
-     * @see org.apache.pluto.descriptors.portlet.PortletPreferenceDD
-     */
-    public InternalPortletPreference[] getDefaultPreferences() {
-        if (defaultPreferences == null) {
-            PortletDD portletDD = getPortletDefinition();
-            PortletPreferencesDD prefsDD = portletDD.getPortletPreferences();
-            if (prefsDD != null) {
-            	List prefs = new ArrayList();
-            	for (Iterator it = prefsDD.getPortletPreferences().iterator();
-            			it.hasNext(); ) {
-            		PortletPreferenceDD prefDD = (PortletPreferenceDD) it.next();
-            		String[] values = null;
-            		if (prefDD.getValues().size() > 0) {
-            			values = (String[]) prefDD.getValues().toArray(
-            					new String[prefDD.getValues().size()]);
-            		}
-            		PortletPreferenceImpl pref = new PortletPreferenceImpl(
-            				prefDD.getName(), values, prefDD.isReadOnly());
-            		prefs.add(pref);
-            	}
-            	defaultPreferences = (InternalPortletPreference[])
-            			prefs.toArray(new InternalPortletPreference[prefs.size()]);
-            }
-        }
-        return defaultPreferences;
-    }
-
-    /**
-     * Returns the portlet description. The return value cannot be NULL.
-     * @return the portlet description.
-     */
-    public PortletDD getPortletDefinition() {
-        if (portletDefinition == null) {
-            load();
-        }
-        return portletDefinition;
-    }
-
-    /**
-     * Returns the preferences validator instance for this portlet.
-     * One validator instance is created per portlet definition.
-     * @return the preferences validator instance for this portlet.
-     * @throws ValidatorException  if fail to instantiate the validator.
-     */
-    public PreferencesValidator getPreferencesValidator()
-    throws ValidatorException {
-    	PreferencesValidator validator = PreferencesValidatorRegistry
-    			.getRegistry()
-    			.getPreferencesValidator(getPortletDefinition());
-    	return validator;
-    }
-
-
-    // Private Methods ---------------------------------------------------------
-
-    /**
-     * Loads the portlet definition.
-     */
-    private void load() {
-
-    	// Retrieve the cross servlet context for the portlet.
-        ServletContext crossContext = servletContext;
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Retrieved cross context: " + crossContext);
-        }
-
-        // Load PortletAppDD and find out the portlet definition.
-        try {
-            PortletAppDD appDD = PortletDescriptorRegistry.getRegistry()
-            		.getPortletAppDD(crossContext);
-            for (Iterator it = appDD.getPortlets().iterator(); it.hasNext(); ) {
-                PortletDD portletDD = (PortletDD) it.next();
-                if (portletDD.getPortletName().equals(portletName)) {
-                	portletDefinition = portletDD;
-                	break;
-                }
-            }
-        } catch (PortletContainerException ex) {
-        	String message = "Unable to load Portlet App Deployment Descriptor:"
-        			+ ex.getMessage();
-        	LOG.error(message, ex);
-        	// FIXME: should this be a NullPointerException?
-            throw new NullPointerException(message);
-        }
-    }
-
-}
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.internal.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.portlet.PreferencesValidator;
+import javax.portlet.ValidatorException;
+import javax.servlet.ServletContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.descriptors.portlet.PortletAppDD;
+import org.apache.pluto.descriptors.portlet.PortletDD;
+import org.apache.pluto.descriptors.portlet.PortletPreferenceDD;
+import org.apache.pluto.descriptors.portlet.PortletPreferencesDD;
+import org.apache.pluto.descriptors.servlet.ServletDD;
+import org.apache.pluto.internal.InternalPortletPreference;
+import org.apache.pluto.internal.PortletDescriptorRegistry;
+import org.apache.pluto.internal.PortletEntity;
+import org.apache.pluto.internal.PreferencesValidatorRegistry;
+
+/**
+ * The PortletEntity encapsulates all data pertaining to a single portlet
+ * instance.  This instance may appear zero or more times per user. The
+ * PortletEntity consists of two primary peices of information, the Portlet
+ * Definition as defined by the {@link PortletDD} and the Wrapping Servlet
+ * information as defined by the{@link ServletDD}
+ *
+ */
+public class PortletEntityImpl implements PortletEntity {
+
+	/** Logger. */
+    private static final Log LOG = LogFactory.getLog(PortletEntityImpl.class);
+
+    /** URI prefix of the portlet invoker servlet. */
+    private static final String PREFIX = "/PlutoInvoker/";
+
+
+    // Private Member Variables ------------------------------------------------
+
+    /** The servlet context. */
+    private final ServletContext servletContext;
+
+    /** The portlet window. */
+    private final String portletName;
+
+    /** The cached PortletDD retrieved from the portlet descriptor registry. */
+    private PortletDD portletDefinition;
+
+    /** Default portlet preferences defined for this portlet. */
+    private InternalPortletPreference[] defaultPreferences;
+
+
+    // Constructor -------------------------------------------------------------
+
+    PortletEntityImpl(ServletContext servletContext, String portletName) {
+        this.servletContext = servletContext;
+        this.portletName = portletName;
+    }
+
+
+    // PortletEntity Impl ------------------------------------------------------
+
+    /**
+     * Returns the URI to the controller servlet that wraps this portlet.
+     * @return the URI to the controller servlet that wraps this portlet.
+     * @deprecated
+     */
+    public String getControllerServletUri() {
+        // this method is deprecated as of pluto 1.1.2, so that
+        // we can remove it in the future.  The PortletInvokerService
+        // will be responsible for resolving the URI used to invoke
+        // the portlet.
+        return PREFIX + portletName;
+    }
+
+    /**
+     * Returns an array of default preferences of this portlet. The default
+     * preferences are retrieved from the portlet application descriptor.
+     * <p>
+     * Data retrieved from <code>portlet.xml</code> are injected into the domain
+     * object <code>PortletPreferenceDD</code>. This method converts the domain
+     * objects into <code>PortletPreference</code> objects.
+     * </p>
+     * <p>
+     * Note that if no value is bound to a given preference key,
+     * <code>PortletPreferenceDD.getValues()</code> will return an empty string
+     * list, but the value array of <code>PortletPreference</code> should be set
+     * to null (instead of an empty array).
+     * </p>
+     * <p>
+     * This method never returns null, but the values held by PortletPreference
+     * may be null.
+     * </p>
+     * @return the preference set
+     *
+     * @see org.apache.pluto.descriptors.portlet.PortletPreferenceDD
+     */
+    public InternalPortletPreference[] getDefaultPreferences() {
+        if (defaultPreferences == null) {
+            PortletDD portletDD = getPortletDefinition();
+            PortletPreferencesDD prefsDD = portletDD.getPortletPreferences();
+            if (prefsDD != null) {
+            	List prefs = new ArrayList();
+            	for (Iterator it = prefsDD.getPortletPreferences().iterator();
+            			it.hasNext(); ) {
+            		PortletPreferenceDD prefDD = (PortletPreferenceDD) it.next();
+            		String[] values = null;
+            		if (prefDD.getValues().size() > 0) {
+            			values = (String[]) prefDD.getValues().toArray(
+            					new String[prefDD.getValues().size()]);
+            		}
+            		PortletPreferenceImpl pref = new PortletPreferenceImpl(
+            				prefDD.getName(), values, prefDD.isReadOnly());
+            		prefs.add(pref);
+            	}
+            	defaultPreferences = (InternalPortletPreference[])
+            			prefs.toArray(new InternalPortletPreference[prefs.size()]);
+            }
+        }
+        return defaultPreferences;
+    }
+
+    /**
+     * Returns the portlet description. The return value cannot be NULL.
+     * @return the portlet description.
+     */
+    public PortletDD getPortletDefinition() {
+        if (portletDefinition == null) {
+            load();
+        }
+        return portletDefinition;
+    }
+
+    /**
+     * Returns the preferences validator instance for this portlet.
+     * One validator instance is created per portlet definition.
+     * @return the preferences validator instance for this portlet.
+     * @throws ValidatorException  if fail to instantiate the validator.
+     */
+    public PreferencesValidator getPreferencesValidator()
+    throws ValidatorException {
+    	PreferencesValidator validator = PreferencesValidatorRegistry
+    			.getRegistry()
+    			.getPreferencesValidator(getPortletDefinition());
+    	return validator;
+    }
+
+
+    // Private Methods ---------------------------------------------------------
+
+    /**
+     * Loads the portlet definition.
+     */
+    private void load() {
+
+    	// Retrieve the cross servlet context for the portlet.
+        ServletContext crossContext = servletContext;
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Retrieved cross context: " + crossContext);
+        }
+
+        // Load PortletAppDD and find out the portlet definition.
+        try {
+            PortletAppDD appDD = PortletDescriptorRegistry.getRegistry()
+            		.getPortletAppDD(crossContext);
+            for (Iterator it = appDD.getPortlets().iterator(); it.hasNext(); ) {
+                PortletDD portletDD = (PortletDD) it.next();
+                if (portletDD.getPortletName().equals(portletName)) {
+                	portletDefinition = portletDD;
+                	break;
+                }
+            }
+        } catch (PortletContainerException ex) {
+        	String message = "Unable to load Portlet App Deployment Descriptor:"
+        			+ ex.getMessage();
+        	LOG.error(message, ex);
+        	// FIXME: should this be a NullPointerException?
+            throw new NullPointerException(message);
+        }
+    }
+
+}

Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java?rev=607450&r1=607449&r2=607450&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java Sat Dec 29 09:31:56 2007
@@ -1,126 +1,126 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import org.apache.pluto.internal.InternalPortletPreference;
-
-/**
- * TODO: javadoc
- * @version 1.0
- * @since Sep 20, 2004
- */
-public class PortletPreferenceImpl implements InternalPortletPreference {
-
-	// Private Member Variables ------------------------------------------------
-
-	/** The preference name. */
-    private String name;
-
-    /** The preference values. */
-    private String[] values;
-
-    /** Flag indicating if this preference is read-only. */
-    private boolean readOnly = false;
-
-
-    // Constructors ------------------------------------------------------------
-
-    public PortletPreferenceImpl(String name, String[] values) {
-        this.name = name;
-        this.values = values;
-        this.readOnly = false;
-    }
-
-    public PortletPreferenceImpl(String name,
-                                 String[] values,
-                                 boolean readOnly) {
-        this.name = name;
-        this.values = values;
-        this.readOnly = readOnly;
-    }
-
-    /**
-     * Private constructor that is used only within the <code>clone()</code>
-     * method.
-     * @see #clone()
-     */
-    private PortletPreferenceImpl() {
-    	// Do nothing.
-    }
-
-
-    // PortletPreference Impl --------------------------------------------------
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String[] getValues() {
-        return values;
-    }
-
-    public void setValues(String[] values) {
-        this.values = values;
-    }
-
-    public boolean isReadOnly() {
-        return readOnly;
-    }
-
-    public void setReadOnly(boolean readOnly) {
-        this.readOnly = readOnly;
-    }
-
-    public Object clone() {
-    	PortletPreferenceImpl copy = new PortletPreferenceImpl();
-    	copy.name = this.name;
-    	if (this.values != null) {
-    		copy.values = (String[]) this.values.clone();
-    	}
-    	copy.readOnly = this.readOnly;
-    	return copy;
-    }
-
-
-    // Object Methods ----------------------------------------------------------
-
-    /**
-     * Override of toString() that prints out name and values of fields.
-     * @see java.lang.Object#toString()
-     */
-    public String toString(){
-    	StringBuffer buffer = new StringBuffer();
-    	buffer.append(getClass().getName());
-    	buffer.append("[name=").append(name).append(";");
-    	if (values != null) {
-    		for (int i = 0; i < values.length; i++) {
-    			buffer.append("value[").append(i).append("]=")
-    					.append(values[i]).append(";");
-    		}
-    	} else {
-    		buffer.append("values=NULL;");
-    	}
-    	buffer.append("readOnly=").append(readOnly).append("]");
-    	return buffer.toString();
-    }
-
-}
-
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.internal.impl;
+
+import org.apache.pluto.internal.InternalPortletPreference;
+
+/**
+ * TODO: javadoc
+ * @version 1.0
+ * @since Sep 20, 2004
+ */
+public class PortletPreferenceImpl implements InternalPortletPreference {
+
+	// Private Member Variables ------------------------------------------------
+
+	/** The preference name. */
+    private String name;
+
+    /** The preference values. */
+    private String[] values;
+
+    /** Flag indicating if this preference is read-only. */
+    private boolean readOnly = false;
+
+
+    // Constructors ------------------------------------------------------------
+
+    public PortletPreferenceImpl(String name, String[] values) {
+        this.name = name;
+        this.values = values;
+        this.readOnly = false;
+    }
+
+    public PortletPreferenceImpl(String name,
+                                 String[] values,
+                                 boolean readOnly) {
+        this.name = name;
+        this.values = values;
+        this.readOnly = readOnly;
+    }
+
+    /**
+     * Private constructor that is used only within the <code>clone()</code>
+     * method.
+     * @see #clone()
+     */
+    private PortletPreferenceImpl() {
+    	// Do nothing.
+    }
+
+
+    // PortletPreference Impl --------------------------------------------------
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String[] getValues() {
+        return values;
+    }
+
+    public void setValues(String[] values) {
+        this.values = values;
+    }
+
+    public boolean isReadOnly() {
+        return readOnly;
+    }
+
+    public void setReadOnly(boolean readOnly) {
+        this.readOnly = readOnly;
+    }
+
+    public Object clone() {
+    	PortletPreferenceImpl copy = new PortletPreferenceImpl();
+    	copy.name = this.name;
+    	if (this.values != null) {
+    		copy.values = (String[]) this.values.clone();
+    	}
+    	copy.readOnly = this.readOnly;
+    	return copy;
+    }
+
+
+    // Object Methods ----------------------------------------------------------
+
+    /**
+     * Override of toString() that prints out name and values of fields.
+     * @see java.lang.Object#toString()
+     */
+    public String toString(){
+    	StringBuffer buffer = new StringBuffer();
+    	buffer.append(getClass().getName());
+    	buffer.append("[name=").append(name).append(";");
+    	if (values != null) {
+    		for (int i = 0; i < values.length; i++) {
+    			buffer.append("value[").append(i).append("]=")
+    					.append(values[i]).append(";");
+    		}
+    	} else {
+    		buffer.append("values=NULL;");
+    	}
+    	buffer.append("readOnly=").append(readOnly).append("]");
+    	return buffer.toString();
+    }
+
+}
+

Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferenceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferencesImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferencesImpl.java?rev=607450&r1=607449&r2=607450&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferencesImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferencesImpl.java Sat Dec 29 09:31:56 2007
@@ -1,360 +1,360 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
-
-import javax.portlet.PortletPreferences;
-import javax.portlet.PreferencesValidator;
-import javax.portlet.ReadOnlyException;
-import javax.portlet.ValidatorException;
-
-import org.apache.pluto.Constants;
-import org.apache.pluto.PortletContainer;
-import org.apache.pluto.PortletContainerException;
-import org.apache.pluto.util.StringManager;
-import org.apache.pluto.internal.InternalPortletPreference;
-import org.apache.pluto.internal.InternalPortletRequest;
-import org.apache.pluto.internal.InternalPortletWindow;
-import org.apache.pluto.internal.PortletEntity;
-import org.apache.pluto.spi.optional.PortletPreferencesService;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
-
-/**
- * Implementation of the <code>javax.portlet.PortletPreferences</code>
- * interface.
- *
- * @see PortletPreferences
- * @see PortletPreferenceImpl
- *
- */
-public class PortletPreferencesImpl implements PortletPreferences {
-
-	/** Logger. */
-    private static final Log LOG = LogFactory.getLog(PortletPreferencesImpl.class);
-
-    private static final StringManager EXCEPTIONS = StringManager.getManager(
-    		PortletPreferencesImpl.class.getPackage().getName());
-
-
-    // Private Member Variables ------------------------------------------------
-
-    /** The portlet preferences service provided by the portal. */
-    private PortletPreferencesService preferencesService;
-
-    private InternalPortletWindow window;
-
-    private InternalPortletRequest request;
-
-    /**
-     * Default portlet preferences retrieved from portlet.xml, and used for
-     * resetting portlet preferences.
-     */
-    private InternalPortletPreference[] defaultPreferences;
-
-    /**
-     * Current portlet preferences: key is the preference name as a string,
-     * value is the PortletPreference instance.
-     */
-    private final Map preferences = new HashMap();
-
-    /** Current method used for managing these preferences. */
-    private Integer methodId;
-
-
-    // Constructor -------------------------------------------------------------
-
-    /**
-     * Constructs an instance.
-     * @param container  the portlet container.
-     * @param window  the internal portlet window.
-     * @param request  the internal portlet request.
-     * @param methodId  the request method ID: render request or action request.
-     */
-    public PortletPreferencesImpl(PortletContainer container,
-                                  InternalPortletWindow window,
-                                  InternalPortletRequest request,
-                                  Integer methodId) {
-        this.window = window;
-        this.request = request;
-        this.methodId = methodId;
-
-        // Get the portlet preferences service from container.
-        preferencesService = container.getOptionalContainerServices()
-        		.getPortletPreferencesService();
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Using PortletPreferencesService: "
-            		+ preferencesService.getClass().getName());
-        }
-
-        // Put default portlet preferences into preferences map.
-        PortletEntity entity = window.getPortletEntity();
-        defaultPreferences = entity.getDefaultPreferences();
-        for (int i = 0; i < defaultPreferences.length; i++) {
-            preferences.put(defaultPreferences[i].getName(),
-                            defaultPreferences[i].clone());
-        }
-        if (LOG.isDebugEnabled()) {
-        	LOG.debug("Loaded default preferences: " + toString());
-        }
-
-        // Merge stored portlet preferences into preferences map.
-        try {
-        	InternalPortletPreference[] storedPreferences = preferencesService
-            		.getStoredPreferences(window, request);
-            for (int i = 0; i < storedPreferences.length; i++) {
-            	if (LOG.isDebugEnabled()) {
-            		LOG.debug("Merging stored preference: "
-            				+ storedPreferences[i].getName());
-            	}
-                preferences.put(storedPreferences[i].getName(),
-                                storedPreferences[i]);
-            }
-        	// Store the preferences retrieved from portlet.xml.
-            //   Portlet preferences are stored everytime when a
-            //   PortletPreferencesImpl instance is created.
-            //   So here we do not check the portlet request method ID.
-        	internalStore();
-
-        } catch (PortletContainerException ex) {
-            LOG.error("Error retrieving preferences.", ex);
-            //TODO: Rethrow up the stack????
-        } catch (IOException ex) {
-            LOG.error("Error retrieving preferences.", ex);
-            //TODO: Rethrow up the stack????
-        } catch (ValidatorException ex) {
-            LOG.warn("ValidatorException initializing portlet preferences. "
-            		+ "This is not illegal at this point "
-            		+ "since we are just retreiving from portlet.xml.", ex);
-        }
-        if (LOG.isDebugEnabled()) {
-        	LOG.debug("Merged stored preferences: " + toString());
-        }
-    }
-
-
-    // PortletPreferences Impl -------------------------------------------------
-
-    public boolean isReadOnly(String key) {
-        if (key == null) {
-            throw new IllegalArgumentException(
-            		EXCEPTIONS.getString("error.null", "Preference key "));
-        }
-        InternalPortletPreference pref = (InternalPortletPreference)
-        		preferences.get(key);
-        return (pref != null && pref.isReadOnly());
-    }
-
-    public String getValue(String key, String defaultValue) {
-        String[] values = getValues(key, new String[] { defaultValue });
-        String value = null;
-        if (values != null && values.length > 0) {
-        	value = values[0];
-        }
-        if (value == null) {
-        	value = defaultValue;
-        }
-        return value;
-    }
-
-    public String[] getValues(String key, String[] defaultValues) {
-        if (key == null) {
-            throw new IllegalArgumentException(
-            		EXCEPTIONS.getString("error.null", "Preference key "));
-        }
-        String[] values = null;
-        InternalPortletPreference pref = (InternalPortletPreference)
-        		preferences.get(key);
-        if (pref != null) {
-            values = pref.getValues();
-        }
-        if (values == null) {
-            values = defaultValues;
-        }
-        return values;
-    }
-
-    public void setValue(String key, String value) throws ReadOnlyException {
-        if (isReadOnly(key)) {
-            throw new ReadOnlyException(EXCEPTIONS.getString(
-            		"error.preference.readonly", key));
-        }
-        InternalPortletPreference pref = (InternalPortletPreference)
-        		preferences.get(key);
-        if (pref != null) {
-            pref.setValues(new String[] { value });
-        } else {
-            pref = new PortletPreferenceImpl(key, new String[] { value });
-            preferences.put(key, pref);
-        }
-    }
-
-    public void setValues(String key, String[] values) throws ReadOnlyException {
-        if (isReadOnly(key)) {
-            throw new ReadOnlyException(EXCEPTIONS.getString(
-            		"error.preference.readonly"));
-        }
-        InternalPortletPreference pref = (InternalPortletPreference)
-        		preferences.get(key);
-        if (pref != null) {
-            pref.setValues(values);
-        } else {
-            pref = new PortletPreferenceImpl(key, values);
-            preferences.put(key, pref);
-        }
-    }
-
-    public Enumeration getNames() {
-        return new Vector(preferences.keySet()).elements();
-    }
-
-    public Map getMap() {
-        Map map = new HashMap();
-        Iterator it = preferences.keySet().iterator();
-        while (it.hasNext()) {
-        	InternalPortletPreference pref = (InternalPortletPreference)
-        			preferences.get(it.next());
-            map.put(pref.getName(),
-                    pref.getValues() != null ? pref.getValues().clone() : null);
-        }
-        return Collections.unmodifiableMap(map);
-    }
-
-    public void reset(String key) throws ReadOnlyException {
-    	// Read-only preferences cannot be reset.
-        if (isReadOnly(key)) {
-            throw new ReadOnlyException(EXCEPTIONS.getString(
-            		"error.preference.readonly", "Preference key "));
-        }
-        // Try to reset preference to the default values.
-        boolean resetDone = false;
-        for (int i = 0; !resetDone && i < defaultPreferences.length; i++) {
-        	if (key.equals(defaultPreferences[i].getName())) {
-        		if (LOG.isDebugEnabled()) {
-        			LOG.debug("Resetting preference for key: " + key);
-        		}
-        		preferences.put(key,
-        				defaultPreferences[i].clone());
-        		resetDone = true;
-        	}
-        }
-        // Remove preference if default values are not defined (PLT.14.1).
-        if (!resetDone) {
-        	if (LOG.isDebugEnabled()) {
-        		LOG.debug("Resetting preference to null for key: " + key);
-        	}
-        	preferences.remove(key);
-        }
-    }
-
-    /**
-     * Stores the portlet preferences to a persistent storage. This method
-     * should only be invoked within <code>processAction()</code> method.
-     *
-     * @see #internalStore()
-     *
-     * @throws IllegalStateException  if this method is not invoked within
-     *         <code>processAction()</code> method.
-     * @throws ValidatorException  if the portlet preferences are not valid.
-     * @throws IOException  if an error occurs with the persistence mechanism.
-     */
-    public void store() throws IOException, ValidatorException {
-        if (!Constants.METHOD_ACTION.equals(methodId)) {
-            throw new IllegalStateException(
-                	"store is only allowed inside a processAction call.");
-        }
-        internalStore();
-    }
-
-
-    // Private Methods ---------------------------------------------------------
-
-    /**
-     * Stores the portlet preferences to a persistent storage. If a preferences
-     * validator is defined for this portlet, this method firstly validates the
-     * portlet preferences.
-     * <p>
-     * This method is invoked internally, thus it does not check the portlet
-     * request method ID (METHOD_RENDER or METHOD_ACTION).
-     * </p>
-     * @throws ValidatorException  if the portlet preferences are not valid.
-     * @throws IOException  if an error occurs with the persistence mechanism.
-     */
-    private void internalStore() throws IOException, ValidatorException {
-        // Validate the preferences before storing, if a validator is defined.
-        //   If the preferences cannot pass the validation,
-        //   an ValidatorException will be thrown out.
-        PreferencesValidator validator = window.getPortletEntity()
-        		.getPreferencesValidator();
-        if (validator != null) {
-        	validator.validate(this);
-        }
-        // Store the portlet preferences.
-        InternalPortletPreference[] prefs = (InternalPortletPreference[])
-        		(new ArrayList(preferences.values())).toArray(
-        				new InternalPortletPreference[preferences.size()]);
-        try {
-        	preferencesService.store(window, request, prefs);
-        } catch (PortletContainerException ex) {
-            LOG.error("Error storing preferences.", ex);
-            throw new IOException("Error storing perferences: " + ex.getMessage());
-        }
-    }
-
-
-    // Object Methods ----------------------------------------------------------
-
-    /**
-     * Returns the string representation of this object. Preferences are
-     * separated by ';' character, while values in one preference are separated
-     * by ',' character.
-     * @return the string representation of this object.
-     * @see java.lang.Object#toString()
-     */
-    public String toString() {
-    	StringBuffer buffer = new StringBuffer();
-    	buffer.append(getClass().getName()).append("[");
-    	for (Enumeration en = getNames(); en.hasMoreElements(); ) {
-    		String name = (String) en.nextElement();
-    		buffer.append(name);
-    		buffer.append("(readOnly:").append(isReadOnly(name)).append(")=");
-    		String[] values = getValues(name, null);
-    		if (values != null) {
-	    		for (int i = 0; i < values.length; i++) {
-	    			buffer.append(values[i]);
-	    			if (i < values.length - 1) {
-	    				buffer.append(",");
-	    			}
-				}
-    		} else {
-    			buffer.append("NULL");
-    		}
-    		buffer.append(";");
-    	}
-    	buffer.append("]");
-    	return buffer.toString();
-    }
-
-}
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.internal.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.portlet.PortletPreferences;
+import javax.portlet.PreferencesValidator;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.ValidatorException;
+
+import org.apache.pluto.Constants;
+import org.apache.pluto.PortletContainer;
+import org.apache.pluto.PortletContainerException;
+import org.apache.pluto.util.StringManager;
+import org.apache.pluto.internal.InternalPortletPreference;
+import org.apache.pluto.internal.InternalPortletRequest;
+import org.apache.pluto.internal.InternalPortletWindow;
+import org.apache.pluto.internal.PortletEntity;
+import org.apache.pluto.spi.optional.PortletPreferencesService;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+/**
+ * Implementation of the <code>javax.portlet.PortletPreferences</code>
+ * interface.
+ *
+ * @see PortletPreferences
+ * @see PortletPreferenceImpl
+ *
+ */
+public class PortletPreferencesImpl implements PortletPreferences {
+
+	/** Logger. */
+    private static final Log LOG = LogFactory.getLog(PortletPreferencesImpl.class);
+
+    private static final StringManager EXCEPTIONS = StringManager.getManager(
+    		PortletPreferencesImpl.class.getPackage().getName());
+
+
+    // Private Member Variables ------------------------------------------------
+
+    /** The portlet preferences service provided by the portal. */
+    private PortletPreferencesService preferencesService;
+
+    private InternalPortletWindow window;
+
+    private InternalPortletRequest request;
+
+    /**
+     * Default portlet preferences retrieved from portlet.xml, and used for
+     * resetting portlet preferences.
+     */
+    private InternalPortletPreference[] defaultPreferences;
+
+    /**
+     * Current portlet preferences: key is the preference name as a string,
+     * value is the PortletPreference instance.
+     */
+    private final Map preferences = new HashMap();
+
+    /** Current method used for managing these preferences. */
+    private Integer methodId;
+
+
+    // Constructor -------------------------------------------------------------
+
+    /**
+     * Constructs an instance.
+     * @param container  the portlet container.
+     * @param window  the internal portlet window.
+     * @param request  the internal portlet request.
+     * @param methodId  the request method ID: render request or action request.
+     */
+    public PortletPreferencesImpl(PortletContainer container,
+                                  InternalPortletWindow window,
+                                  InternalPortletRequest request,
+                                  Integer methodId) {
+        this.window = window;
+        this.request = request;
+        this.methodId = methodId;
+
+        // Get the portlet preferences service from container.
+        preferencesService = container.getOptionalContainerServices()
+        		.getPortletPreferencesService();
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Using PortletPreferencesService: "
+            		+ preferencesService.getClass().getName());
+        }
+
+        // Put default portlet preferences into preferences map.
+        PortletEntity entity = window.getPortletEntity();
+        defaultPreferences = entity.getDefaultPreferences();
+        for (int i = 0; i < defaultPreferences.length; i++) {
+            preferences.put(defaultPreferences[i].getName(),
+                            defaultPreferences[i].clone());
+        }
+        if (LOG.isDebugEnabled()) {
+        	LOG.debug("Loaded default preferences: " + toString());
+        }
+
+        // Merge stored portlet preferences into preferences map.
+        try {
+        	InternalPortletPreference[] storedPreferences = preferencesService
+            		.getStoredPreferences(window, request);
+            for (int i = 0; i < storedPreferences.length; i++) {
+            	if (LOG.isDebugEnabled()) {
+            		LOG.debug("Merging stored preference: "
+            				+ storedPreferences[i].getName());
+            	}
+                preferences.put(storedPreferences[i].getName(),
+                                storedPreferences[i]);
+            }
+        	// Store the preferences retrieved from portlet.xml.
+            //   Portlet preferences are stored everytime when a
+            //   PortletPreferencesImpl instance is created.
+            //   So here we do not check the portlet request method ID.
+        	internalStore();
+
+        } catch (PortletContainerException ex) {
+            LOG.error("Error retrieving preferences.", ex);
+            //TODO: Rethrow up the stack????
+        } catch (IOException ex) {
+            LOG.error("Error retrieving preferences.", ex);
+            //TODO: Rethrow up the stack????
+        } catch (ValidatorException ex) {
+            LOG.warn("ValidatorException initializing portlet preferences. "
+            		+ "This is not illegal at this point "
+            		+ "since we are just retreiving from portlet.xml.", ex);
+        }
+        if (LOG.isDebugEnabled()) {
+        	LOG.debug("Merged stored preferences: " + toString());
+        }
+    }
+
+
+    // PortletPreferences Impl -------------------------------------------------
+
+    public boolean isReadOnly(String key) {
+        if (key == null) {
+            throw new IllegalArgumentException(
+            		EXCEPTIONS.getString("error.null", "Preference key "));
+        }
+        InternalPortletPreference pref = (InternalPortletPreference)
+        		preferences.get(key);
+        return (pref != null && pref.isReadOnly());
+    }
+
+    public String getValue(String key, String defaultValue) {
+        String[] values = getValues(key, new String[] { defaultValue });
+        String value = null;
+        if (values != null && values.length > 0) {
+        	value = values[0];
+        }
+        if (value == null) {
+        	value = defaultValue;
+        }
+        return value;
+    }
+
+    public String[] getValues(String key, String[] defaultValues) {
+        if (key == null) {
+            throw new IllegalArgumentException(
+            		EXCEPTIONS.getString("error.null", "Preference key "));
+        }
+        String[] values = null;
+        InternalPortletPreference pref = (InternalPortletPreference)
+        		preferences.get(key);
+        if (pref != null) {
+            values = pref.getValues();
+        }
+        if (values == null) {
+            values = defaultValues;
+        }
+        return values;
+    }
+
+    public void setValue(String key, String value) throws ReadOnlyException {
+        if (isReadOnly(key)) {
+            throw new ReadOnlyException(EXCEPTIONS.getString(
+            		"error.preference.readonly", key));
+        }
+        InternalPortletPreference pref = (InternalPortletPreference)
+        		preferences.get(key);
+        if (pref != null) {
+            pref.setValues(new String[] { value });
+        } else {
+            pref = new PortletPreferenceImpl(key, new String[] { value });
+            preferences.put(key, pref);
+        }
+    }
+
+    public void setValues(String key, String[] values) throws ReadOnlyException {
+        if (isReadOnly(key)) {
+            throw new ReadOnlyException(EXCEPTIONS.getString(
+            		"error.preference.readonly"));
+        }
+        InternalPortletPreference pref = (InternalPortletPreference)
+        		preferences.get(key);
+        if (pref != null) {
+            pref.setValues(values);
+        } else {
+            pref = new PortletPreferenceImpl(key, values);
+            preferences.put(key, pref);
+        }
+    }
+
+    public Enumeration getNames() {
+        return new Vector(preferences.keySet()).elements();
+    }
+
+    public Map getMap() {
+        Map map = new HashMap();
+        Iterator it = preferences.keySet().iterator();
+        while (it.hasNext()) {
+        	InternalPortletPreference pref = (InternalPortletPreference)
+        			preferences.get(it.next());
+            map.put(pref.getName(),
+                    pref.getValues() != null ? pref.getValues().clone() : null);
+        }
+        return Collections.unmodifiableMap(map);
+    }
+
+    public void reset(String key) throws ReadOnlyException {
+    	// Read-only preferences cannot be reset.
+        if (isReadOnly(key)) {
+            throw new ReadOnlyException(EXCEPTIONS.getString(
+            		"error.preference.readonly", "Preference key "));
+        }
+        // Try to reset preference to the default values.
+        boolean resetDone = false;
+        for (int i = 0; !resetDone && i < defaultPreferences.length; i++) {
+        	if (key.equals(defaultPreferences[i].getName())) {
+        		if (LOG.isDebugEnabled()) {
+        			LOG.debug("Resetting preference for key: " + key);
+        		}
+        		preferences.put(key,
+        				defaultPreferences[i].clone());
+        		resetDone = true;
+        	}
+        }
+        // Remove preference if default values are not defined (PLT.14.1).
+        if (!resetDone) {
+        	if (LOG.isDebugEnabled()) {
+        		LOG.debug("Resetting preference to null for key: " + key);
+        	}
+        	preferences.remove(key);
+        }
+    }
+
+    /**
+     * Stores the portlet preferences to a persistent storage. This method
+     * should only be invoked within <code>processAction()</code> method.
+     *
+     * @see #internalStore()
+     *
+     * @throws IllegalStateException  if this method is not invoked within
+     *         <code>processAction()</code> method.
+     * @throws ValidatorException  if the portlet preferences are not valid.
+     * @throws IOException  if an error occurs with the persistence mechanism.
+     */
+    public void store() throws IOException, ValidatorException {
+        if (!Constants.METHOD_ACTION.equals(methodId)) {
+            throw new IllegalStateException(
+                	"store is only allowed inside a processAction call.");
+        }
+        internalStore();
+    }
+
+
+    // Private Methods ---------------------------------------------------------
+
+    /**
+     * Stores the portlet preferences to a persistent storage. If a preferences
+     * validator is defined for this portlet, this method firstly validates the
+     * portlet preferences.
+     * <p>
+     * This method is invoked internally, thus it does not check the portlet
+     * request method ID (METHOD_RENDER or METHOD_ACTION).
+     * </p>
+     * @throws ValidatorException  if the portlet preferences are not valid.
+     * @throws IOException  if an error occurs with the persistence mechanism.
+     */
+    private void internalStore() throws IOException, ValidatorException {
+        // Validate the preferences before storing, if a validator is defined.
+        //   If the preferences cannot pass the validation,
+        //   an ValidatorException will be thrown out.
+        PreferencesValidator validator = window.getPortletEntity()
+        		.getPreferencesValidator();
+        if (validator != null) {
+        	validator.validate(this);
+        }
+        // Store the portlet preferences.
+        InternalPortletPreference[] prefs = (InternalPortletPreference[])
+        		(new ArrayList(preferences.values())).toArray(
+        				new InternalPortletPreference[preferences.size()]);
+        try {
+        	preferencesService.store(window, request, prefs);
+        } catch (PortletContainerException ex) {
+            LOG.error("Error storing preferences.", ex);
+            throw new IOException("Error storing perferences: " + ex.getMessage());
+        }
+    }
+
+
+    // Object Methods ----------------------------------------------------------
+
+    /**
+     * Returns the string representation of this object. Preferences are
+     * separated by ';' character, while values in one preference are separated
+     * by ',' character.
+     * @return the string representation of this object.
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+    	StringBuffer buffer = new StringBuffer();
+    	buffer.append(getClass().getName()).append("[");
+    	for (Enumeration en = getNames(); en.hasMoreElements(); ) {
+    		String name = (String) en.nextElement();
+    		buffer.append(name);
+    		buffer.append("(readOnly:").append(isReadOnly(name)).append(")=");
+    		String[] values = getValues(name, null);
+    		if (values != null) {
+	    		for (int i = 0; i < values.length; i++) {
+	    			buffer.append(values[i]);
+	    			if (i < values.length - 1) {
+	    				buffer.append(",");
+	    			}
+				}
+    		} else {
+    			buffer.append("NULL");
+    		}
+    		buffer.append(";");
+    	}
+    	buffer.append("]");
+    	return buffer.toString();
+    }
+
+}

Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletPreferencesImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java?rev=607450&r1=607449&r2=607450&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java (original)
+++ portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java Sat Dec 29 09:31:56 2007
@@ -1,123 +1,123 @@
-/*
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.internal.impl;
-
-import org.apache.pluto.internal.InternalRenderRequest;
-import org.apache.pluto.internal.InternalRenderResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-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;
-
-/**
- * Implementation of the <code>PortletRequestDispatcher</code> interface.
- * The portlet request dispatcher is used to dispatch <b>RenderRequest</b> and
- * <b>RenderResponse</b> to a URI. Note that ActionRequest and ActionResponse
- * can never be dispatched.
- *
- */
-public class PortletRequestDispatcherImpl implements PortletRequestDispatcher {
-
-	/** Logger. */
-    private static final Log LOG = LogFactory.getLog(PortletRequestDispatcherImpl.class);
-
-
-    // Private Member Variables ------------------------------------------------
-
-    /** The nested servlet request dispatcher instance. */
-    private RequestDispatcher requestDispatcher;
-
-    /** The included query string. */
-    private String queryString;
-
-
-    // Constructors ------------------------------------------------------------
-
-    /**
-     * Creates an instance. This constructor should be called to construct a
-     * named dispatcher.
-     * @param requestDispatcher  the servlet request dispatcher.
-     * @see javax.portlet.PortletContext#getNamedDispatcher(String)
-     */
-    public PortletRequestDispatcherImpl(RequestDispatcher requestDispatcher) {
-        this.requestDispatcher = requestDispatcher;
-        if (LOG.isDebugEnabled()) {
-        	LOG.debug("Named dispatcher created.");
-        }
-    }
-
-    /**
-     * Creates an instance. This constructor should be called to construct a
-     * portlet request dispatcher.
-     * @param requestDispatcher  the servlet request dispatcher.
-     * @param queryString  the included query string.
-     * @see javax.portlet.PortletContext#getRequestDispatcher(String)
-     */
-    public PortletRequestDispatcherImpl(RequestDispatcher requestDispatcher,
-                                        String queryString) {
-        this(requestDispatcher);
-        this.queryString = queryString;
-        if (LOG.isDebugEnabled()) {
-        	LOG.debug("Request dispatcher created.");
-        }
-    }
-
-
-    // PortletRequestDispatcher Impl -------------------------------------------
-
-    public void include(RenderRequest request, RenderResponse response)
-    throws PortletException, IOException {
-
-        InternalRenderRequest internalRequest = (InternalRenderRequest)
-                InternalImplConverter.getInternalRequest(request);
-        InternalRenderResponse internalResponse = (InternalRenderResponse)
-                InternalImplConverter.getInternalResponse(response);
-
-        boolean isIncluded = (internalRequest.isIncluded()
-        		|| internalResponse.isIncluded());
-        try {
-        	internalRequest.setIncluded(true);
-        	internalRequest.setIncludedQueryString(queryString);
-        	internalResponse.setIncluded(true);
-
-            requestDispatcher.include(
-            		(HttpServletRequest) internalRequest,
-            		(HttpServletResponse) internalResponse);
-        } catch (IOException ex) {
-            throw ex;
-        } catch (ServletException ex) {
-            if (ex.getRootCause() != null) {
-                throw new PortletException(ex.getRootCause());
-            } else {
-                throw new PortletException(ex);
-            }
-        } finally {
-        	internalRequest.setIncluded(isIncluded);
-        	internalResponse.setIncluded(isIncluded);
-        }
-    }
-
-}
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.internal.impl;
+
+import org.apache.pluto.internal.InternalRenderRequest;
+import org.apache.pluto.internal.InternalRenderResponse;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+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;
+
+/**
+ * Implementation of the <code>PortletRequestDispatcher</code> interface.
+ * The portlet request dispatcher is used to dispatch <b>RenderRequest</b> and
+ * <b>RenderResponse</b> to a URI. Note that ActionRequest and ActionResponse
+ * can never be dispatched.
+ *
+ */
+public class PortletRequestDispatcherImpl implements PortletRequestDispatcher {
+
+	/** Logger. */
+    private static final Log LOG = LogFactory.getLog(PortletRequestDispatcherImpl.class);
+
+
+    // Private Member Variables ------------------------------------------------
+
+    /** The nested servlet request dispatcher instance. */
+    private RequestDispatcher requestDispatcher;
+
+    /** The included query string. */
+    private String queryString;
+
+
+    // Constructors ------------------------------------------------------------
+
+    /**
+     * Creates an instance. This constructor should be called to construct a
+     * named dispatcher.
+     * @param requestDispatcher  the servlet request dispatcher.
+     * @see javax.portlet.PortletContext#getNamedDispatcher(String)
+     */
+    public PortletRequestDispatcherImpl(RequestDispatcher requestDispatcher) {
+        this.requestDispatcher = requestDispatcher;
+        if (LOG.isDebugEnabled()) {
+        	LOG.debug("Named dispatcher created.");
+        }
+    }
+
+    /**
+     * Creates an instance. This constructor should be called to construct a
+     * portlet request dispatcher.
+     * @param requestDispatcher  the servlet request dispatcher.
+     * @param queryString  the included query string.
+     * @see javax.portlet.PortletContext#getRequestDispatcher(String)
+     */
+    public PortletRequestDispatcherImpl(RequestDispatcher requestDispatcher,
+                                        String queryString) {
+        this(requestDispatcher);
+        this.queryString = queryString;
+        if (LOG.isDebugEnabled()) {
+        	LOG.debug("Request dispatcher created.");
+        }
+    }
+
+
+    // PortletRequestDispatcher Impl -------------------------------------------
+
+    public void include(RenderRequest request, RenderResponse response)
+    throws PortletException, IOException {
+
+        InternalRenderRequest internalRequest = (InternalRenderRequest)
+                InternalImplConverter.getInternalRequest(request);
+        InternalRenderResponse internalResponse = (InternalRenderResponse)
+                InternalImplConverter.getInternalResponse(response);
+
+        boolean isIncluded = (internalRequest.isIncluded()
+        		|| internalResponse.isIncluded());
+        try {
+        	internalRequest.setIncluded(true);
+        	internalRequest.setIncludedQueryString(queryString);
+        	internalResponse.setIncluded(true);
+
+            requestDispatcher.include(
+            		(HttpServletRequest) internalRequest,
+            		(HttpServletResponse) internalResponse);
+        } catch (IOException ex) {
+            throw ex;
+        } catch (ServletException ex) {
+            if (ex.getRootCause() != null) {
+                throw new PortletException(ex.getRootCause());
+            } else {
+                throw new PortletException(ex);
+            }
+        } finally {
+        	internalRequest.setIncluded(isIncluded);
+        	internalResponse.setIncluded(isIncluded);
+        }
+    }
+
+}

Propchange: portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native