tiles-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r939057 - in /tiles/sandbox/trunk/tiles-request: tiles-request-api/src/main/java/org/apache/tiles/request/collection/ tiles-request-api/src/test/java/org/apache/tiles/request/collection/ tiles-request-portlet/src/main/java/org/apache/tiles/...
Date Wed, 28 Apr 2010 19:18:00 GMT
Author: apetrelli
Date: Wed Apr 28 19:17:59 2010
New Revision: 939057

URL: http://svn.apache.org/viewvc?rev=939057&view=rev
Log:
TILESSB-31
Refactored portlet support.

Added:
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ActionPortletRequest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/EventPortletRequest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/PortletRequest.java
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/RenderPortletRequest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ResourcePortletRequest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/StateAwareParameterMap.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/MimeResponseDelegate.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/PortletRequestDelegate.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/RequestDelegate.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/ResponseDelegate.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareRequestDelegate.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareResponseDelegate.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ApplicationScopeExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/HeaderExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/InitParameterExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ParameterExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/RequestScopeExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/SessionScopeExtractor.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/StateAwareParameterExtractor.java   (with props)
Modified:
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/collection/AddableParameterMapTest.java

Modified: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java?rev=939057&r1=939056&r2=939057&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java (original)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/collection/AddableParameterMap.java Wed Apr 28 19:17:59 2010
@@ -24,7 +24,7 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.tiles.request.collection.extractor.EnumeratedValuesExtractor;
+import org.apache.tiles.request.collection.extractor.HasAddableKeys;
 
 /**
  * <p>Private implementation of <code>Map</code> for servlet request
@@ -35,7 +35,7 @@ import org.apache.tiles.request.collecti
 
 public class AddableParameterMap extends ReadOnlyEnumerationMap<String> {
 
-    private EnumeratedValuesExtractor request;
+    private HasAddableKeys<String> request;
 
     /**
      * Constructor.
@@ -44,7 +44,7 @@ public class AddableParameterMap extends
      * @param response The response object to use.
      * @since 2.2.0
      */
-    public AddableParameterMap(EnumeratedValuesExtractor request) {
+    public AddableParameterMap(HasAddableKeys<String> request) {
         super(request);
         this.request = request;
     }

Modified: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/collection/AddableParameterMapTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/collection/AddableParameterMapTest.java?rev=939057&r1=939056&r2=939057&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/collection/AddableParameterMapTest.java (original)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/collection/AddableParameterMapTest.java Wed Apr 28 19:17:59 2010
@@ -3,6 +3,7 @@
  */
 package org.apache.tiles.request.collection;
 
+import static org.easymock.EasyMock.*;
 import static org.easymock.classextension.EasyMock.*;
 import static org.junit.Assert.*;
 
@@ -12,7 +13,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.tiles.request.collection.extractor.EnumeratedValuesExtractor;
+import org.apache.tiles.request.collection.extractor.HasAddableKeys;
 import org.apache.tiles.request.util.MapEntry;
 import org.junit.Before;
 import org.junit.Test;
@@ -26,14 +27,15 @@ public class AddableParameterMapTest {
 
     private AddableParameterMap map;
 
-    private EnumeratedValuesExtractor extractor;
+    private HasAddableKeys<String> extractor;
 
     /**
      * Sets up the test.
      */
+    @SuppressWarnings("unchecked")
     @Before
     public void setUp() {
-        extractor = createMock(EnumeratedValuesExtractor.class);
+        extractor = createMock(HasAddableKeys.class);
         map = new AddableParameterMap(extractor);
     }
 

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ActionPortletRequest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ActionPortletRequest.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ActionPortletRequest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ActionPortletRequest.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,19 @@
+package org.apache.tiles.request.portlet;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletContext;
+
+import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.portlet.delegate.StateAwareRequestDelegate;
+import org.apache.tiles.request.portlet.delegate.StateAwareResponseDelegate;
+
+public class ActionPortletRequest extends PortletRequest {
+
+    public ActionPortletRequest(ApplicationContext applicationContext,
+            PortletContext context, ActionRequest request, ActionResponse response) {
+        super(applicationContext, context, request, response,
+                new StateAwareRequestDelegate(request, response),
+                new StateAwareResponseDelegate());
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ActionPortletRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ActionPortletRequest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/EventPortletRequest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/EventPortletRequest.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/EventPortletRequest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/EventPortletRequest.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,20 @@
+package org.apache.tiles.request.portlet;
+
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletContext;
+
+import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.portlet.delegate.StateAwareRequestDelegate;
+import org.apache.tiles.request.portlet.delegate.StateAwareResponseDelegate;
+
+public class EventPortletRequest extends PortletRequest {
+
+    public EventPortletRequest(ApplicationContext applicationContext,
+            PortletContext context, EventRequest request,
+            EventResponse response) {
+        super(applicationContext, context, request, response,
+                new StateAwareRequestDelegate(request, response),
+                new StateAwareResponseDelegate());
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/EventPortletRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/EventPortletRequest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/PortletRequest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/PortletRequest.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/PortletRequest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/PortletRequest.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,303 @@
+/*
+ * $Id$
+ *
+ * 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.tiles.request.portlet;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletSession;
+
+import org.apache.tiles.request.AbstractClientRequest;
+import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.collection.AddableParameterMap;
+import org.apache.tiles.request.collection.HeaderValuesMap;
+import org.apache.tiles.request.collection.ScopeMap;
+import org.apache.tiles.request.portlet.delegate.RequestDelegate;
+import org.apache.tiles.request.portlet.delegate.ResponseDelegate;
+import org.apache.tiles.request.portlet.extractor.HeaderExtractor;
+import org.apache.tiles.request.portlet.extractor.RequestScopeExtractor;
+import org.apache.tiles.request.portlet.extractor.SessionScopeExtractor;
+
+/**
+ * Portlet-based TilesApplicationContext implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PortletRequest extends AbstractClientRequest {
+
+    private static final String[] SCOPES = {"request", "portletSession", "session", "application"};
+
+    /**
+     * <p>The lazily instantiated <code>Map</code> of header name-value
+     * combinations (immutable).</p>
+     */
+    private Map<String, String> header = null;
+
+
+    /**
+     * <p>The lazily instantitated <code>Map</code> of header name-values
+     * combinations (immutable).</p>
+     */
+    private Map<String, String[]> headerValues = null;
+
+    /**
+     * The <code>PortletContext</code> for this application.
+     */
+    protected PortletContext context = null;
+
+    /**
+     * <p>The <code>PortletRequest</code> for this request.</p>
+     */
+    protected javax.portlet.PortletRequest request = null;
+
+    protected RequestDelegate requestDelegate;
+
+
+    /**
+     * <p>The lazily instantiated <code>Map</code> of request scope
+     * attributes.</p>
+     */
+    private Map<String, Object> requestScope = null;
+
+
+    /**
+     * <p>The <code>PortletResponse</code> for this request.</p>
+     */
+    protected PortletResponse response = null;
+
+    protected ResponseDelegate responseDelegate;
+
+
+    /**
+     * The request objects, lazily initialized.
+     */
+    private Object[] requestObjects;
+
+    /**
+     * <p>The lazily instantiated <code>Map</code> of session scope
+     * attributes.</p>
+     */
+    private Map<String, Object> sessionScope = null;
+
+    /**
+     * <p>The lazily instantiated <code>Map</code> of portlet session scope
+     * attributes.</p>
+     */
+    private Map<String, Object> portletSessionScope = null;
+
+
+    /**
+     * Creates a new instance of PortletTilesRequestContext.
+     *
+     * @param applicationContext The Tiles application context.
+     * @param context The portlet context to use.
+     * @param request The request object to use.
+     * @param response The response object to use.
+     * @param requestDelegate The request delegate.
+     * @param responseDelegate The response delegate.
+     * @since 2.1.1
+     */
+    public PortletRequest(ApplicationContext applicationContext,
+            PortletContext context, javax.portlet.PortletRequest request,
+            PortletResponse response, RequestDelegate requestDelegate, ResponseDelegate responseDelegate) {
+        super(applicationContext);
+
+        // Save the specified Portlet API object references
+        this.context = context;
+        this.request = request;
+        this.response = response;
+        this.requestDelegate = requestDelegate;
+        this.responseDelegate = responseDelegate;
+    }
+
+    /**
+     * <p>Return the {@link PortletRequest} for this context.</p>
+     *
+     * @return The used portlet request.
+     */
+    public javax.portlet.PortletRequest getRequest() {
+        return (this.request);
+    }
+
+    /**
+     * <p>Return the {@link PortletResponse} for this context.</p>
+     *
+     * @return The used portlet response.
+     */
+    public PortletResponse getResponse() {
+        return (this.response);
+    }
+
+    public PortletContext getPortletContext() {
+        return context;
+    }
+
+    /** {@inheritDoc} */
+    public Map<String, String> getHeader() {
+        if ((header == null) && (request != null)) {
+            header = new AddableParameterMap(new HeaderExtractor(request, response));
+        }
+        return (header);
+    }
+
+    /** {@inheritDoc} */
+    public Map<String, String[]> getHeaderValues() {
+        if ((headerValues == null) && (request != null)) {
+            headerValues = new HeaderValuesMap(new HeaderExtractor(request, response));
+        }
+        return (headerValues);
+    }
+
+    /** {@inheritDoc} */
+    public Map<String, Object> getRequestScope() {
+        if ((requestScope == null) && (request != null)) {
+            requestScope = new ScopeMap(new RequestScopeExtractor(request));
+        }
+        return (requestScope);
+    }
+
+    /** {@inheritDoc} */
+    public Map<String, Object> getSessionScope() {
+        if ((sessionScope == null) && (request != null)) {
+            sessionScope = new ScopeMap(new SessionScopeExtractor(request,
+                    PortletSession.APPLICATION_SCOPE));
+        }
+        return (sessionScope);
+    }
+
+    /** {@inheritDoc} */
+    public Map<String, Object> getPortletSessionScope() {
+        if ((portletSessionScope == null) && (request != null)) {
+            portletSessionScope = new ScopeMap(new SessionScopeExtractor(
+                    request, PortletSession.APPLICATION_SCOPE));
+        }
+        return (portletSessionScope);
+    }
+
+    @Override
+    public String[] getNativeScopes() {
+        return SCOPES;
+    }
+
+    /** {@inheritDoc} */
+    public Object[] getRequestObjects() {
+        if (requestObjects == null) {
+            requestObjects = new Object[2];
+            requestObjects[0] = request;
+            requestObjects[1] = response;
+        }
+        return requestObjects;
+    }
+
+    /** {@inheritDoc} */
+    public Locale getRequestLocale() {
+        if (request != null) {
+            return request.getLocale();
+        }
+        return null;
+    }
+
+    @Override
+    public Map<String, String> getParam() {
+        return requestDelegate.getParam();
+    }
+
+    @Override
+    public Map<String, String[]> getParamValues() {
+        return requestDelegate.getParamValues();
+    }
+
+    /** {@inheritDoc} */
+    public boolean isUserInRole(String role) {
+        return request.isUserInRole(role);
+    }
+
+    @Override
+    public OutputStream getOutputStream() throws IOException {
+        return responseDelegate.getOutputStream();
+    }
+
+    @Override
+    public PrintWriter getPrintWriter() throws IOException {
+        return responseDelegate.getPrintWriter();
+    }
+
+    @Override
+    public Writer getWriter() throws IOException {
+        return responseDelegate.getWriter();
+    }
+
+    @Override
+    public boolean isResponseCommitted() {
+        return responseDelegate.isResponseCommitted();
+    }
+
+    @Override
+    public void setContentType(String contentType) {
+        responseDelegate.setContentType(contentType);
+    }
+
+    /** {@inheritDoc} */
+    public void doForward(String path) throws IOException {
+        try {
+            PortletRequestDispatcher rd = getPortletContext()
+                    .getRequestDispatcher(path);
+
+            if (rd == null) {
+                throw new IOException(
+                        "No portlet request dispatcher returned for path '"
+                                + path + "'");
+            }
+
+            rd.forward(request, response);
+        } catch (PortletException e) {
+            throw new IOException("PortletException while including path '"
+                    + path + "'.", e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void doInclude(String path) throws IOException {
+        try {
+            PortletRequestDispatcher rd = getPortletContext()
+                    .getRequestDispatcher(path);
+
+            if (rd == null) {
+                throw new IOException(
+                        "No portlet request dispatcher returned for path '"
+                                + path + "'");
+            }
+
+            rd.include(request, response);
+        } catch (PortletException e) {
+            throw new IOException("PortletException while including path '"
+                    + path + "'.", e);
+        }
+    }
+}

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/RenderPortletRequest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/RenderPortletRequest.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/RenderPortletRequest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/RenderPortletRequest.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,20 @@
+package org.apache.tiles.request.portlet;
+
+import javax.portlet.PortletContext;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.portlet.delegate.MimeResponseDelegate;
+import org.apache.tiles.request.portlet.delegate.PortletRequestDelegate;
+
+public class RenderPortletRequest extends PortletRequest {
+
+    public RenderPortletRequest(ApplicationContext applicationContext,
+            PortletContext context, RenderRequest request,
+            RenderResponse response) {
+        super(applicationContext, context, request, response,
+                new PortletRequestDelegate(request), new MimeResponseDelegate(
+                        response));
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/RenderPortletRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/RenderPortletRequest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ResourcePortletRequest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ResourcePortletRequest.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ResourcePortletRequest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ResourcePortletRequest.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,20 @@
+package org.apache.tiles.request.portlet;
+
+import javax.portlet.PortletContext;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+
+import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.portlet.delegate.MimeResponseDelegate;
+import org.apache.tiles.request.portlet.delegate.PortletRequestDelegate;
+
+public class ResourcePortletRequest extends PortletRequest {
+
+    public ResourcePortletRequest(ApplicationContext applicationContext,
+            PortletContext context, ResourceRequest request,
+            ResourceResponse response) {
+        super(applicationContext, context, request, response,
+                new PortletRequestDelegate(request), new MimeResponseDelegate(
+                        response));
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ResourcePortletRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/ResourcePortletRequest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/StateAwareParameterMap.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/StateAwareParameterMap.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/StateAwareParameterMap.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/StateAwareParameterMap.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,78 @@
+package org.apache.tiles.request.portlet;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+public class StateAwareParameterMap implements Map<String, String[]> {
+
+    private Map<String, String[]> requestMap;
+
+    private Map<String, String[]> responseMap;
+
+    public StateAwareParameterMap(Map<String, String[]> requestMap,
+            Map<String, String[]> responseMap) {
+        this.requestMap = requestMap;
+        this.responseMap = responseMap;
+    }
+
+    @Override
+    public void clear() {
+        responseMap.clear();
+    }
+
+    @Override
+    public boolean containsKey(Object key) {
+        return requestMap.containsKey(key);
+    }
+
+    @Override
+    public boolean containsValue(Object value) {
+        return requestMap.containsValue(value);
+    }
+
+    @Override
+    public Set<java.util.Map.Entry<String, String[]>> entrySet() {
+        return requestMap.entrySet();
+    }
+
+    @Override
+    public String[] get(Object key) {
+        return requestMap.get(key);
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return requestMap.isEmpty();
+    }
+
+    @Override
+    public Set<String> keySet() {
+        return requestMap.keySet();
+    }
+
+    @Override
+    public String[] put(String key, String[] value) {
+        return responseMap.put(key, value);
+    }
+
+    @Override
+    public void putAll(Map<? extends String, ? extends String[]> m) {
+        responseMap.putAll(m);
+    }
+
+    @Override
+    public String[] remove(Object key) {
+        return responseMap.remove(key);
+    }
+
+    @Override
+    public int size() {
+        return requestMap.size();
+    }
+
+    @Override
+    public Collection<String[]> values() {
+        return requestMap.values();
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/StateAwareParameterMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/StateAwareParameterMap.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/MimeResponseDelegate.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/MimeResponseDelegate.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/MimeResponseDelegate.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/MimeResponseDelegate.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,42 @@
+package org.apache.tiles.request.portlet.delegate;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Writer;
+
+import javax.portlet.MimeResponse;
+
+public class MimeResponseDelegate implements ResponseDelegate {
+
+    private MimeResponse response;
+
+    public MimeResponseDelegate(MimeResponse response) {
+        this.response = response;
+    }
+
+    /** {@inheritDoc} */
+    public OutputStream getOutputStream() throws IOException {
+        return response.getPortletOutputStream();
+    }
+
+    /** {@inheritDoc} */
+    public PrintWriter getPrintWriter() throws IOException {
+        return response.getWriter();
+    }
+
+    /** {@inheritDoc} */
+    public Writer getWriter() throws IOException {
+        return response.getWriter();
+    }
+
+    /** {@inheritDoc} */
+    public boolean isResponseCommitted() {
+        return response.isCommitted();
+    }
+
+    /** {@inheritDoc} */
+    public void setContentType(String contentType) {
+        response.setContentType(contentType);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/MimeResponseDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/MimeResponseDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/PortletRequestDelegate.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/PortletRequestDelegate.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/PortletRequestDelegate.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/PortletRequestDelegate.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,45 @@
+package org.apache.tiles.request.portlet.delegate;
+
+import java.util.Map;
+
+import javax.portlet.PortletRequest;
+
+import org.apache.tiles.request.collection.ReadOnlyEnumerationMap;
+import org.apache.tiles.request.portlet.extractor.ParameterExtractor;
+
+public class PortletRequestDelegate implements RequestDelegate {
+
+    private PortletRequest request;
+
+    /**
+     * <p>The lazily instantiated <code>Map</code> of request
+     * parameter name-value.</p>
+     */
+    private Map<String, String> param = null;
+
+    /**
+     * <p>The lazily instantiated <code>Map</code> of request
+     * parameter name-values.</p>
+     */
+    private Map<String, String[]> paramValues = null;
+
+    public PortletRequestDelegate(PortletRequest request) {
+        this.request = request;
+    }
+
+    /** {@inheritDoc} */
+    public Map<String, String> getParam() {
+        if ((param == null) && (request != null)) {
+            param = new ReadOnlyEnumerationMap<String>(new ParameterExtractor(request));
+        }
+        return (param);
+    }
+
+    /** {@inheritDoc} */
+    public Map<String, String[]> getParamValues() {
+        if ((paramValues == null) && (request != null)) {
+            paramValues = request.getParameterMap();
+        }
+        return (paramValues);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/PortletRequestDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/PortletRequestDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/RequestDelegate.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/RequestDelegate.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/RequestDelegate.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/RequestDelegate.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,10 @@
+package org.apache.tiles.request.portlet.delegate;
+
+import java.util.Map;
+
+public interface RequestDelegate {
+
+    Map<String, String> getParam();
+
+    Map<String, String[]> getParamValues();
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/RequestDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/RequestDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/ResponseDelegate.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/ResponseDelegate.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/ResponseDelegate.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/ResponseDelegate.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,19 @@
+package org.apache.tiles.request.portlet.delegate;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Writer;
+
+public interface ResponseDelegate {
+
+    OutputStream getOutputStream() throws IOException;
+
+    PrintWriter getPrintWriter() throws IOException;
+
+    Writer getWriter() throws IOException;
+
+    void setContentType(String contentType);
+
+    boolean isResponseCommitted();
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/ResponseDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/ResponseDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareRequestDelegate.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareRequestDelegate.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareRequestDelegate.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareRequestDelegate.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,53 @@
+package org.apache.tiles.request.portlet.delegate;
+
+import java.util.Map;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.StateAwareResponse;
+
+import org.apache.tiles.request.collection.AddableParameterMap;
+import org.apache.tiles.request.portlet.StateAwareParameterMap;
+import org.apache.tiles.request.portlet.extractor.StateAwareParameterExtractor;
+
+public class StateAwareRequestDelegate implements RequestDelegate {
+
+    private PortletRequest request;
+
+    private StateAwareResponse response;
+
+    public StateAwareRequestDelegate(PortletRequest request,
+            StateAwareResponse response) {
+        this.request = request;
+        this.response = response;
+    }
+
+    /**
+     * <p>The lazily instantiated <code>Map</code> of request
+     * parameter name-value.</p>
+     */
+    private Map<String, String> param = null;
+
+    /**
+     * <p>The lazily instantiated <code>Map</code> of request
+     * parameter name-values.</p>
+     */
+    private Map<String, String[]> paramValues = null;
+
+    /** {@inheritDoc} */
+    public Map<String, String> getParam() {
+        if ((param == null) && (request != null)) {
+            param = new AddableParameterMap(new StateAwareParameterExtractor(
+                    request, response));
+        }
+        return (param);
+    }
+
+    /** {@inheritDoc} */
+    public Map<String, String[]> getParamValues() {
+        if ((paramValues == null) && (request != null)) {
+            paramValues = new StateAwareParameterMap(request.getParameterMap(),
+                    response.getRenderParameterMap());
+        }
+        return (paramValues);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareRequestDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareRequestDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareResponseDelegate.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareResponseDelegate.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareResponseDelegate.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareResponseDelegate.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,37 @@
+package org.apache.tiles.request.portlet.delegate;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Writer;
+
+public class StateAwareResponseDelegate implements ResponseDelegate {
+
+    @Override
+    public OutputStream getOutputStream() {
+        throw new UnsupportedOperationException(
+                "No outputstream available for state-aware response");
+    }
+
+    @Override
+    public PrintWriter getPrintWriter() {
+        throw new UnsupportedOperationException(
+                "No outputstream available for state-aware response");
+    }
+
+    @Override
+    public Writer getWriter() {
+        throw new UnsupportedOperationException(
+                "No outputstream available for state-aware response");
+    }
+
+    @Override
+    public boolean isResponseCommitted() {
+        return false;
+    }
+
+    @Override
+    public void setContentType(String contentType) {
+        throw new UnsupportedOperationException(
+                "No outputstream available for state-aware response");
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareResponseDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareResponseDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ApplicationScopeExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ApplicationScopeExtractor.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ApplicationScopeExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ApplicationScopeExtractor.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,36 @@
+package org.apache.tiles.request.portlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletContext;
+
+import org.apache.tiles.request.collection.extractor.AttributeExtractor;
+
+public class ApplicationScopeExtractor implements AttributeExtractor {
+
+    private PortletContext context;
+
+    public ApplicationScopeExtractor(PortletContext context) {
+        this.context = context;
+    }
+
+    @Override
+    public void setValue(String name, Object value) {
+        context.setAttribute(name, value);
+    }
+
+    @Override
+    public void removeValue(String name) {
+        context.removeAttribute(name);
+    }
+
+    @Override
+    public Enumeration<String> getKeys() {
+        return context.getAttributeNames();
+    }
+
+    @Override
+    public Object getValue(String key) {
+        return context.getAttribute(key);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ApplicationScopeExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ApplicationScopeExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/HeaderExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/HeaderExtractor.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/HeaderExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/HeaderExtractor.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,41 @@
+package org.apache.tiles.request.portlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+
+import org.apache.tiles.request.collection.extractor.EnumeratedValuesExtractor;
+
+public class HeaderExtractor implements EnumeratedValuesExtractor {
+
+    private PortletRequest request;
+
+    private PortletResponse response;
+
+    public HeaderExtractor(PortletRequest request,
+            PortletResponse response) {
+        this.request = request;
+        this.response = response;
+    }
+
+    @Override
+    public Enumeration<String> getKeys() {
+        return request.getPropertyNames();
+   }
+
+    @Override
+    public String getValue(String key) {
+        return request.getProperty(key);
+    }
+
+    @Override
+    public Enumeration<String> getValues(String key) {
+        return request.getProperties(key);
+    }
+
+    @Override
+    public void setValue(String key, String value) {
+        response.setProperty(key, value);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/HeaderExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/HeaderExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/InitParameterExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/InitParameterExtractor.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/InitParameterExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/InitParameterExtractor.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,27 @@
+package org.apache.tiles.request.portlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletContext;
+
+import org.apache.tiles.request.collection.extractor.HasKeys;
+
+public class InitParameterExtractor implements HasKeys<String> {
+
+    private PortletContext context;
+
+    public InitParameterExtractor(PortletContext context) {
+        this.context = context;
+    }
+
+    @Override
+    public Enumeration<String> getKeys() {
+        return context.getInitParameterNames();
+    }
+
+    @Override
+    public String getValue(String key) {
+        return context.getInitParameter(key);
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/InitParameterExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/InitParameterExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ParameterExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ParameterExtractor.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ParameterExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ParameterExtractor.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,26 @@
+package org.apache.tiles.request.portlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletRequest;
+
+import org.apache.tiles.request.collection.extractor.HasKeys;
+
+public class ParameterExtractor implements HasKeys<String> {
+
+    private PortletRequest request;
+
+    public ParameterExtractor(PortletRequest request) {
+        this.request = request;
+    }
+
+    @Override
+    public Enumeration<String> getKeys() {
+        return request.getParameterNames();
+    }
+
+    @Override
+    public String getValue(String key) {
+        return request.getParameter(key);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ParameterExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/ParameterExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/RequestScopeExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/RequestScopeExtractor.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/RequestScopeExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/RequestScopeExtractor.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,36 @@
+package org.apache.tiles.request.portlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletRequest;
+
+import org.apache.tiles.request.collection.extractor.AttributeExtractor;
+
+public class RequestScopeExtractor implements AttributeExtractor {
+
+    private PortletRequest request;
+
+    public RequestScopeExtractor(PortletRequest request) {
+        this.request = request;
+    }
+
+    @Override
+    public void setValue(String name, Object value) {
+        request.setAttribute(name, value);
+    }
+
+    @Override
+    public void removeValue(String name) {
+        request.removeAttribute(name);
+    }
+
+    @Override
+    public Enumeration<String> getKeys() {
+        return request.getAttributeNames();
+    }
+
+    @Override
+    public Object getValue(String key) {
+        return request.getAttribute(key);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/RequestScopeExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/RequestScopeExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/SessionScopeExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/SessionScopeExtractor.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/SessionScopeExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/SessionScopeExtractor.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,56 @@
+package org.apache.tiles.request.portlet.extractor;
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+
+import org.apache.tiles.request.collection.extractor.AttributeExtractor;
+
+public class SessionScopeExtractor implements AttributeExtractor {
+
+    private PortletRequest request;
+
+    private int scope;
+
+    public SessionScopeExtractor(PortletRequest request, int scope) {
+        this.request = request;
+        if (scope != PortletSession.APPLICATION_SCOPE
+                && scope != PortletSession.PORTLET_SCOPE) {
+            throw new IllegalArgumentException(
+                    "The scope must be either APPLICATION_SCOPE or PORTLET_SCOPE");
+        }
+        this.scope = scope;
+    }
+
+    @Override
+    public void setValue(String name, Object value) {
+        request.getPortletSession().setAttribute(name, value, scope);
+    }
+
+    @Override
+    public void removeValue(String name) {
+        PortletSession session = request.getPortletSession(false);
+        if (session != null) {
+            session.removeAttribute(name, scope);
+        }
+    }
+
+    @Override
+    public Enumeration<String> getKeys() {
+        PortletSession session = request.getPortletSession(false);
+        if (session != null) {
+            return session.getAttributeNames(scope);
+        }
+        return null;
+    }
+
+    @Override
+    public Object getValue(String key) {
+        PortletSession session = request.getPortletSession(false);
+        if (session != null) {
+            return session.getAttribute(key, scope);
+        }
+        return null;
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/SessionScopeExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/SessionScopeExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/StateAwareParameterExtractor.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/StateAwareParameterExtractor.java?rev=939057&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/StateAwareParameterExtractor.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/StateAwareParameterExtractor.java Wed Apr 28 19:17:59 2010
@@ -0,0 +1,21 @@
+package org.apache.tiles.request.portlet.extractor;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.StateAwareResponse;
+
+import org.apache.tiles.request.collection.extractor.HasAddableKeys;
+
+public class StateAwareParameterExtractor extends ParameterExtractor implements HasAddableKeys<String> {
+
+    private StateAwareResponse response;
+
+    public StateAwareParameterExtractor(PortletRequest request, StateAwareResponse response) {
+        super(request);
+        this.response = response;
+    }
+
+    @Override
+    public void setValue(String key, String value) {
+        response.setRenderParameter(key, value);
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/StateAwareParameterExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-portlet/src/main/java/org/apache/tiles/request/portlet/extractor/StateAwareParameterExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message