You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2006/08/20 01:40:25 UTC

svn commit: r432900 - in /tapestry/tapestry5/tapestry-core/trunk: ./ src/main/java/org/apache/tapestry/internal/ioc/ src/main/java/org/apache/tapestry/internal/ioc/services/ src/main/java/org/apache/tapestry/internal/request/ src/main/java/org/apache/t...

Author: hlship
Date: Sat Aug 19 16:40:24 2006
New Revision: 432900

URL: http://svn.apache.org/viewvc?rev=432900&view=rev
Log:
Begin filling in the request processing pipeline, and add more documentation.

Added:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/RequestGlobalsImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebRequestImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebResponseImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestFilter.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestHandler.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestGlobals.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestModule.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequest.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestFilter.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestHandler.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebResponse.java
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/shadow.apt
    tapestry/tapestry5/tapestry-core/trunk/src/test/conf/log4j.properties
Modified:
    tapestry/tapestry5/tapestry-core/trunk/pom.xml
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/IOCUtilities.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/services/PropertyShadowBuilderImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/services/PropertyShadowBuilder.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/provider.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/IOCUtilitiesTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/MarkupWriterImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/services/PropertyShadowBuilderImplTest.java

Modified: tapestry/tapestry5/tapestry-core/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/pom.xml?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/pom.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/pom.xml Sat Aug 19 16:40:24 2006
@@ -44,7 +44,16 @@
         </dependency>
         <dependency>
             <groupId>aspectj</groupId>
-            <artifactId>aspectjrt</artifactId>
+            <artifactId>aspectjrt</artifactId>            
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.4</version>
+        </dependency>
+        <dependency><groupId>log4j</groupId> <artifactId>log4j</artifactId>
+            <version>1.2.9</version>
+            <scope>test</scope>
         </dependency>
     </dependencies>
     <build>

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/IOCUtilities.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/IOCUtilities.java?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/IOCUtilities.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/IOCUtilities.java Sat Aug 19 16:40:24 2006
@@ -18,6 +18,7 @@
 import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
 
@@ -168,5 +169,24 @@
     public static boolean isNonBlank(String input)
     {
         return !isBlank(input);
+    }
+
+    /**
+     * Converts an enumeration (of Strings) into a sorted list of Strings.
+     */
+    public static List<String> toList(Enumeration e)
+    {
+        List<String> result = newList();
+
+        while (e.hasMoreElements())
+        {
+            String name = (String) e.nextElement();
+
+            result.add(name);
+        }
+
+        Collections.sort(result);
+
+        return result;
     }
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/services/PropertyShadowBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/services/PropertyShadowBuilderImpl.java?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/services/PropertyShadowBuilderImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/services/PropertyShadowBuilderImpl.java Sat Aug 19 16:40:24 2006
@@ -41,7 +41,7 @@
         _propertyAccess = propertyAccess;
     }
 
-    public <T> T createShadow(Object source, String propertyName, Class<T> propertyType)
+    public <T> T buildShadow(Object source, String propertyName, Class<T> propertyType)
     {
         Class sourceClass = source.getClass();
         PropertyAdapter adapter = _propertyAccess.getAdapter(sourceClass).getPropertyAdapter(

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/RequestGlobalsImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/RequestGlobalsImpl.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/RequestGlobalsImpl.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/RequestGlobalsImpl.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,71 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.internal.request;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tapestry.request.RequestGlobals;
+import org.apache.tapestry.request.WebRequest;
+import org.apache.tapestry.request.WebResponse;
+
+/**
+ * Dumb data holder for per-request data.
+ * 
+ * @author Howard M. Lewis Ship
+ */
+public class RequestGlobalsImpl implements RequestGlobals
+{
+    private HttpServletRequest _servletRequest;
+
+    private HttpServletResponse _servletResponse;
+
+    private WebRequest _request;
+
+    private WebResponse _response;
+
+    public void store(HttpServletRequest request, HttpServletResponse response)
+    {
+        _servletRequest = request;
+        _servletResponse = response;
+    }
+
+    public HttpServletRequest getHTTPServletRequest()
+    {
+        return _servletRequest;
+    }
+
+    public HttpServletResponse getHTTPServletResponse()
+    {
+        return _servletResponse;
+    }
+
+    public void store(WebRequest request, WebResponse response)
+    {
+        _request = request;
+        _response = response;
+    }
+
+    public WebRequest getRequest()
+    {
+        return _request;
+    }
+
+    public WebResponse getResponse()
+    {
+        return _response;
+    }
+
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebRequestImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebRequestImpl.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebRequestImpl.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebRequestImpl.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,54 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.internal.request;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.tapestry.internal.ioc.IOCUtilities;
+import org.apache.tapestry.request.WebRequest;
+
+/**
+ * Basic implementation of {@link org.apache.tapestry.request.WebRequest} that wraps around
+ * an {@link javax.servlet.http.HttpServletRequest}.
+ * 
+ * @author Howard M. Lewis Ship
+ */
+public class WebRequestImpl implements WebRequest
+{
+    private final HttpServletRequest _request;
+
+    public WebRequestImpl(HttpServletRequest request)
+    {
+        _request = request;
+    }
+
+    public List<String> getParameterNames()
+    {
+        return IOCUtilities.toList(_request.getParameterNames());
+    }
+
+    public String getParameter(String name)
+    {
+        return _request.getParameter(name);
+    }
+
+    public String[] getParameters(String name)
+    {
+        return _request.getParameterValues(name);
+    }
+
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebResponseImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebResponseImpl.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebResponseImpl.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/request/WebResponseImpl.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,32 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.internal.request;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tapestry.request.WebResponse;
+
+/**
+ * @author Howard M. Lewis Ship
+ */
+public class WebResponseImpl implements WebResponse
+{
+    private final HttpServletResponse _response;
+
+    public WebResponseImpl(HttpServletResponse response)
+    {
+        _response = response;
+    }
+}

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/services/PropertyShadowBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/services/PropertyShadowBuilder.java?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/services/PropertyShadowBuilder.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/services/PropertyShadowBuilder.java Sat Aug 19 16:40:24 2006
@@ -39,5 +39,5 @@
      *            this type
      * @return the shadow
      */
-    <T> T createShadow(Object source, String propertyName, Class<T> propertyType);
+    <T> T buildShadow(Object source, String propertyName, Class<T> propertyType);
 }

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestFilter.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestFilter.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestFilter.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,40 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.request;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author Howard M. Lewis Ship
+ * @see org.apache.tapestry.request.HttpServletRequestHandler
+ */
+public interface HttpServletRequestFilter
+{
+    /**
+     * Filter interface for the tapestry.request.HttpServletRequestHandler pipeline. A filter should
+     * delegate to the handler. It may perform operations before or after invoking the handler, and
+     * may modify the request and response passed in to the handler.
+     * 
+     * @param request
+     * @param response
+     * @param handler
+     * @throws IOException
+     */
+    void service(HttpServletRequest request, HttpServletResponse response,
+            HttpServletRequestHandler handler) throws IOException;
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestHandler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestHandler.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestHandler.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/HttpServletRequestHandler.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,31 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.request;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Service interface for the tapestry.request.HttpServletRequestHandler pipeline service.
+ * 
+ * @author Howard M. Lewis Ship
+ * @see org.apache.tapestry.request.HttpServletRequestFilter
+ */
+public interface HttpServletRequestHandler
+{
+    void service(HttpServletRequest request, HttpServletResponse response) throws IOException;
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestGlobals.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestGlobals.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestGlobals.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestGlobals.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,42 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.request;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Service used to store the current request objects, both the Servlet API versions, and the
+ * Tapestry generic versions.
+ * 
+ * @author Howard M. Lewis Ship
+ */
+public interface RequestGlobals
+{
+    /** Stores the servlet API request and response objects, for access via the properties. */
+    void store(HttpServletRequest request, HttpServletResponse response);
+
+    HttpServletRequest getHTTPServletRequest();
+
+    HttpServletResponse getHTTPServletResponse();
+
+    void store(WebRequest request, WebResponse response);
+
+    /** Accessible as injected object "infrastructure:request". */
+    WebRequest getRequest();
+
+    /** Accessible as injected object "infrastructure:response". */
+    WebResponse getResponse();
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestModule.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestModule.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/RequestModule.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,131 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.request;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.tapestry.internal.request.RequestGlobalsImpl;
+import org.apache.tapestry.internal.request.WebRequestImpl;
+import org.apache.tapestry.internal.request.WebResponseImpl;
+import org.apache.tapestry.ioc.MappedConfiguration;
+import org.apache.tapestry.ioc.annotations.Contribute;
+import org.apache.tapestry.ioc.annotations.Id;
+import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.services.PipelineBuilder;
+import org.apache.tapestry.ioc.services.PropertyShadowBuilder;
+
+/**
+ * Modules related to storing the current request and pipelines for handling requests.
+ * 
+ * @author Howard M. Lewis Ship
+ */
+@Id("tapestry.request")
+public final class RequestModule
+{
+    private final PipelineBuilder _pipelineBuilder;
+
+    private final PropertyShadowBuilder _shadowBuilder;
+
+    private final RequestGlobals _requestGlobals;
+
+    // Yes, you can inject services defined by this module into this module. The service proxy is
+    // created without
+    // instantiating the module itself.
+
+    public RequestModule(@InjectService("tapestry.ioc.PipelineBuilder")
+    PipelineBuilder pipelineBuilder, @InjectService("tapestry.ioc.PropertyShadowBuilder")
+    PropertyShadowBuilder shadowBuilder, @InjectService("RequestGlobals")
+    RequestGlobals requestGlobals)
+    {
+        _pipelineBuilder = pipelineBuilder;
+        _shadowBuilder = shadowBuilder;
+        _requestGlobals = requestGlobals;
+    }
+
+    public HttpServletRequestHandler buildHttpServletRequestHandler(Log log,
+            List<HttpServletRequestFilter> configuration, @InjectService("WebRequestHandler")
+            final WebRequestHandler webRequestHandler)
+    {
+        HttpServletRequestHandler terminator = new HttpServletRequestHandler()
+        {
+            public void service(HttpServletRequest request, HttpServletResponse response)
+                    throws IOException
+            {
+                _requestGlobals.store(request, response);
+
+                WebRequest wrequest = new WebRequestImpl(request);
+                WebResponse wresponse = new WebResponseImpl(response);
+
+                webRequestHandler.service(wrequest, wresponse);
+            }
+        };
+
+        return _pipelineBuilder.buildPipeline(
+                log,
+                HttpServletRequestHandler.class,
+                HttpServletRequestFilter.class,
+                configuration,
+                terminator);
+    }
+
+    public WebRequestHandler buildWebRequestHandler(Log log, List<WebRequestFilter> configuration)
+    {
+        WebRequestHandler terminator = new WebRequestHandler()
+        {
+            public void service(WebRequest request, WebResponse response) throws IOException
+            {
+                _requestGlobals.store(request, response);
+
+                // But after that, who knows?
+
+                throw new UnsupportedOperationException("Not yet implemented.");
+            }
+
+        };
+
+        return _pipelineBuilder.buildPipeline(
+                log,
+                WebRequestHandler.class,
+                WebRequestFilter.class,
+                configuration,
+                terminator);
+    }
+
+    @Lifecycle("perthread")
+    public RequestGlobals buildRequestGlobals()
+    {
+        return new RequestGlobalsImpl();
+    }
+
+    public WebRequest buildWebRequest()
+    {
+        return _shadowBuilder.buildShadow(_requestGlobals, "request", WebRequest.class);
+    }
+
+    /** Contributes the WebRequest service as "request". */
+    @Contribute("tapestry.Infrastructure")
+    public void contributeInfrastructure(MappedConfiguration<String, Object> configuration,
+            @InjectService("WebRequest")
+            WebRequest request)
+    {
+        configuration.add("request", request);
+    }
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequest.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequest.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequest.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,40 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.request;
+
+import java.util.List;
+
+/**
+ * Generic version of {@link javax.servlet.http.HttpServletRequest}.
+ * 
+ * @author Howard M. Lewis Ship
+ */
+public interface WebRequest
+{
+    /** Returns a list of query parameter names, in alphabetical order. */
+    List<String> getParameterNames();
+
+    /**
+     * Returns the query parameter value for the given name. Returns null if no such parameter is in
+     * the request. For a multi-valued parameter, returns just the first value.
+     */
+    String getParameter(String name);
+
+    /**
+     * Returns the parameter values for the given name. Returns null if no such parameter is in the
+     * request.
+     */
+    String[] getParameters(String name);
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestFilter.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestFilter.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestFilter.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,29 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.request;
+
+import java.io.IOException;
+
+/**
+ * Filter interface for {@link org.apache.tapestry.request.WebRequestHandler}.
+ * 
+ * @author Howard M. Lewis Ship
+ */
+public interface WebRequestFilter
+{
+    void service(WebRequest request, WebResponse response, WebRequestHandler handler)
+            throws IOException;
+
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestHandler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestHandler.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestHandler.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebRequestHandler.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,27 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.request;
+
+import java.io.IOException;
+
+/**
+ * Service interface for the tapestry.request.WebRequestHandler pipeline service.
+ * 
+ * @author Howard M. Lewis Ship
+ */
+public interface WebRequestHandler
+{
+    void service(WebRequest request, WebResponse response) throws IOException;
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebResponse.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebResponse.java?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebResponse.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/request/WebResponse.java Sat Aug 19 16:40:24 2006
@@ -0,0 +1,20 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.request;
+
+public interface WebResponse
+{
+
+}

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java Sat Aug 19 16:40:24 2006
@@ -30,6 +30,7 @@
 import org.apache.tapestry.ioc.annotations.Id;
 import org.apache.tapestry.ioc.annotations.InjectService;
 import org.apache.tapestry.ioc.annotations.SubModule;
+import org.apache.tapestry.request.RequestModule;
 import org.apache.tapestry.transform.TransformModule;
 
 /**
@@ -39,7 +40,7 @@
  */
 @Id("tapestry")
 @SubModule(
-{ TransformModule.class, InternalModule.class })
+{ TransformModule.class, InternalModule.class, RequestModule.class })
 public final class TapestryModule
 {
     public Infrastructure buildInfrastructure(Log log,
@@ -66,12 +67,12 @@
     public void contributeInfrastructure(Configuration<InfrastructureContribution> configuration,
             ServiceResources resources)
     {
-        add(configuration, ComponentNameExpander.class, resources);
-        add(configuration, MarkupWriterFactory.class, resources);
+        add(configuration, resources, ComponentNameExpander.class);
+        add(configuration, resources, MarkupWriterFactory.class);
     }
 
     private <T> void add(Configuration<InfrastructureContribution> configuration,
-            Class<T> serviceInterface, ServiceResources resources)
+            ServiceResources resources, Class<T> serviceInterface)
     {
         String className = serviceInterface.getName();
         int dotx = className.lastIndexOf('.');
@@ -91,6 +92,7 @@
 
     public MarkupWriterFactory buildMarkupWriterFactory()
     {
+        // Temporary ...
         return new MarkupWriterFactory()
         {
             public MarkupWriter newMarkupWriter()
@@ -108,7 +110,6 @@
     {
         return new ComponentNameExpander()
         {
-
             public String expandComponentName(String componentName)
             {
                 return componentName;

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/dom.apt Sat Aug 19 16:40:24 2006
@@ -0,0 +1,117 @@
+ ---
+ Document Object Model
+ ---
+ 
+Document Object Model
+
+  Tapestry 5 takes a very different approach to markup generation than Tapestry 4,
+  or most other frameworks.
+  
+* Tapestry 4 Approach
+  
+  In Tapestry 4, markup generation was based on generating a character stream.
+  At the lowest level, the fact that the output was in a markup format such as HTML, XHTML
+  or WML was not known.  Higher levels, such as the IMarkupWriter interface (and its
+  implementations) provide the concept of markup generation: elements, attributes, start
+  tags and end tags.
+
+  Often, components would work together to generate markup. A common example would
+  be a Form component and the many form control components it contains (such
+  as TextField, Checkbox, etc.).  The Form could not fully render until all
+  such enclosed components had rendered first. 
+  
+  IMarkupWriter supported <nested writers>. Nested writers are a way to buffer output
+  until needed. A Form component would render its body using a nested writer, then
+  write out its \<form\> and \<input type="hidden"\>  elements, as well as the nested,
+  buffered body.
+  
+  This technique breaks down when two elements are peers, and not in a parent/child
+  relationship. For example, the rendering of a FieldLabel component is affected by its
+  companion TextField component. Handling these cases in Tapestry 4 required a number of
+  kludges and special cases.
+  
+* Tapestry 5 Approach
+
+  Tapestry 5 components render out a DOM, a Document Object Model.  This is a tree of
+  nodes representing elements, attributes and text within a document.
+  
+  The DOM may ultimately be operated upon in a random access manner, rather than
+  the serial (or buffered) approach used in Tapestry 4.
+  
+  A new 
+  {{{../apidocs/org/apache/tapestry/MarkupWriter.html}MarkupWriter}} interface
+  allows the majority of code to treat the generation of output as a stream. In fact,
+  MarkupWriter is more like a cursor into the DOM tree.
+  
+  Once all rendering is complete, the DOM tree is streamed to the client.  
+  
+DOM Classes
+
+  The implementation of this DOM is part of Tapestry, despite the fact that several third-party
+  alternatives exist. This represents a desire to limit dependencies for the framework, but also
+  the Tapestry DOM is streamlined for initial creation, and a limited amount of subsequent modification.
+  Most DOM implemenations are more sophisticated, with greater support for querying (often using XPath) and
+  manipulation. 
+    
+  Once the Document object is created, you don't directly create new DOM objects; instead, each
+  DOM object includes methods that create new sub-objects.  This primarily applies to the Element
+  class, which can be a container of text, comments and other elements.
+  
+* {{{../apidocs/org/apache/tapestry/dom/Document.html}Document}}
+
+  The Document object represents the an entire document, which is to say, an entire response to be
+  sent to the client.
+  
+  Documents will have a single root element.
+  The newRootElement() method is used to create the root element for the document.
+  
+  <<TODO: Support for doctypes, content type, processing instructions, and top-level comments.>>
+  
+* {{{../apidocs/org/apache/tapestry/dom/Element.html}Element}}
+
+  An element of the document. Elements may have attributes, and they may themselves contain other
+  elements, as well as text and comments.
+  
+  The addAttribute() method adds a new attribute/value pair to the Element.  If an existing attribute
+  with the specified name already exists, then then the new value is ignored. This has implications when
+  different pieces of code try to add attributes to an Element ... the first to add an attribute will "win"
+  
+  
+  
+  
+MarkupWriter
+
+  The MarkupWriter interface allows the structure of the document to be built while maintaining a streaming metaphor.
+  
+  Calls to begin() create a new element within the tree.  Calls to write(), writeln() and writef() write text nodes
+  within the current element.  Every call to begin() should be matched with a call to end(), which is used to move
+  the current node up one level. 
+  
+  Within an element, the attributes() method allows a series of attribute/value pairs to be written out.  A simple example:
+  
++-----+
+
+  writer.begin("img");
+  writer.attributes("src", "icon.png", "width", "20", "height", "20", alt, "*");
+  writer.end();
++-----+
+  
+  Noet that end() must be called here, even though the \<img\> element is empty (has no body).  If the call to
+  end() is omitted, then later element created by begin() will be nested <inside> the \<img\> element, which is not
+  desired.
+  
+  Again, <<every call to begin() must be matched with a call to end()>>.
+  
++-----+
+  writer.begin("select");
+  writer.attribute("name", "choice");
+  
+  for (String name : optionsNames)
+  {
+    writer.begin("option");
+    writer.write(name);
+    writer.end();
+  }
+  
+  writer.end();
++-------+
\ No newline at end of file

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt Sat Aug 19 16:40:24 2006
@@ -0,0 +1,74 @@
+ ----
+ Request Processing
+ ----
+ 
+Request Processing
+
+  Understanding the request processing pipeline is very important, as it is one of the
+  chief extension points for Tapestry.
+  
+  Much of the early stages of processing are in the form of extensible 
+  {{{../ioc/pipeline.html}pipelines}}.
+  
+Tapestry Filter
+
+  All incoming requests originate with the TapestryFilter, which is configured
+  inside the application's web.xml.
+  
+  The TapestryFilter is responsible for a number of startup and initialization
+  functions.
+  
+  When it receives a request, the TapestryFilter obtains the
+  {{{../apidocs/org/apache/tapestry/request/HttpServletRequestHandler.html}tapestry.request.HttpServletRequestHandler}} 
+  service, and invokes its service() method. 
+  
+  <<TODO: How does the TF identify which requests it will process, and which are
+  for static content files?  Or is that a function of a filter within the pipeline.>>
+  
+  
+HttpServletRequestHandler Pipeline
+
+  This pipeline performs initial processing of the request. It can be extended
+  by contributing a
+  {{{../apidocs/org/apache/tapestry/request/HttpServletRequestFilter.html}tapestry.request.HttpServletRequestFilter}} into
+  the tapestry.request.HttpServletRequestHandler service's configuration.
+  
+  The terminator for the pipeline does two things:
+  
+  * It stores the request and response into the {{{.../apidocs/org/apache/tapestry/request/RequestGlobals.html}tapestry.request.RequestGlobals}}
+    service. This is a threaded service that stores per-thread/per-request information.
+    
+  * It wraps the request and response as a
+    {{{../apidocs/org/apache/tapestry/request/WebRequest.html}WebRequest}} and
+    {{{../apidocs/org/apache/tapestry/request/WebResponse.html}WebResponse}}, and passes them into the
+    {{{../apidocs/org/apache/tapestry/request/WebRequestHandler.html}tapestry.request.WebRequestHandler}} pipeline.
+ 
+  []
+     
+WebRequestHandler Pipeline
+ 
+   This pipeline is where most extensions related to requests take place.  WebRequest represents an abstraction on top of HttpServletRequest; this
+   is necessary to support non-servlet applications, such as portlet applications. Where other code and services within
+   Tapestry require access to information in the request, such as query parameters, that information is obtained from the
+   WebRequest (or WebResponse) objects.
+   
+   <<TODO: Describe request dispatch, once that is understood.>>
+   
+   The terminator for this pipeline stores the WebRequest and the WebResponse into RequestGlobals.
+   
+RequestGlobals Service
+
+  The tapestry.request.RequestGlobals service 
+  has a lifecycle of perthread; this means that a seperate instance exists for every thread, and therefore,
+  for every request.  The terminators of the two handler pipelines store the request/response pairs into the RequestGlobals service.
+  
+WebRequest Service
+
+  The tapestry.request.WebRequest service is a 
+  {{{../ioc/shadow.html}shadow}}
+  of the RequestGlobals services' request property. That is, any methods invoked
+  on this service are delegated to the request object stored inside the RequestGlobals.
+  
+  This service is also accessible with the object reference <<<infrastructure:request>>>.
+   
+  
\ No newline at end of file

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt Sat Aug 19 16:40:24 2006
@@ -7,3 +7,112 @@
   The core module of Tapestry provides the interfaces and annotations that form the Tapestry API.
   It also includes the {{{ioc/index.html}Tapestry IoC container}}, 
   as well as the core implementations and and internal code.
+  
+What's Tapestry?  
+  
+	Tapestry is an open-source framework for creating dynamic, robust, highly scalable
+	web applications in Java. Tapestry complements and builds upon the standard Java
+	Servlet API, and so it works in any servlet container or application server.
+  
+	Tapestry divides a web application into a set of pages, each constructed from
+	components. This provides a consistent structure, allowing the Tapestry framework to
+	assume responsibility for key concerns such as URL construction and dispatch,
+	persistent state storage on the client or on the server, user input validation,
+	localization/internationalization, and exception reporting. Developing Tapestry
+	applications involves creating HTML templates using plain HTML, and combining the
+	templates with small amounts of Java code. In
+	Tapestry, you create your application in terms of objects, and the methods and
+	fields of those objects -- and specifically not in terms of URLs and query
+	parameters. Tapestry brings true object oriented development to Java web
+	applications.
+  
+    Tapestry is architected to scale from the tinest one page utility 
+    all the way up to massive
+    applications consisting of hundreds of individual pages, developed by large, diverse
+    teams.
+    
+  Tapestry is released under the Apache Software Licence 2.0.    
+
+What's New?
+
+  Tapestry 5 is an all new code base, written from the ground up to take Java web
+  component development to new levels of productivity.
+  
+  This new release removes many limitations of Tapestry 4:
+  
+  * Components no longer extend from base classes.
+  
+  * Components classes are no longer <abstract>.  Components are pure, simple POJOs (<plain old Java
+    objects>).
+  
+  * Tapestry no longer uses XML page and component specification files. Information that used to
+    be supplied in such files is now supplied directly in the Java class, using Java annotations.
+    
+  * Changes to Tapestry component templates <and classes> are now picked up <immediately>, without any kind
+    of restart. This will even work properly in <production>, not just during development.
+    
+  []
+  
+Adaptive API
+
+  A key feature of Tapestry 5 is <adaptive API>.
+  
+  In traditional Java frameworks, including Tapestry 4, user code is expected to
+  conform to the framework.  You create classes that extend from framework-provided
+  base classes, or implement framework-provided interfaces.
+  
+  This works well until you upgrade to the next release of the framework: with
+  the new features of the upgrade, you will more often than not experience breaks
+  in backwards compatibility. Interfaces or base classes will have changed and your
+  existing code will need to be changed to match.
+  
+  In Tapestry 5, the framework <adapts to your code>.  You have control over the
+  names of the methods, the parameters they take, and the value that is returned. This
+  is driven by annotations, which tell Tapestry under what circumstances your
+  methods are to be invoked.
+  
+  For example, you may have a login form and have a method that gets invoked
+  when the form is submitted:
+  
++----+
+private String _userId;
+private String _password;
+private String _errorMessage;
+
+@Inject
+private Start _startPage;
+
+@Inject
+private LoginAuthenticator _authenticator;
+
+@OnEvent("submit")
+private Object doLogin()
+{
+  if (_authenticator.isValidLogin(_userId, _password))
+    return _startPage;
+    
+  // Stay on this page:
+
+  _errorMessage = "Incorrect user id or password.";  
+  
+  return null;
+}
++----+
+
+  This short snippet demonstrates a bit about how Tapestry operates.  Pages and services
+  within the application are injected with the @Inject annotation. The @OnEvent
+  annotation identifies, to Tapestry, when to method is to be invoked
+  (when a form component contained by the page emits a "submit" event). Further the
+  return value directs Tapestry on what to do: jump to another page within the application
+  (by returning the injected Start page), or stay on the same page to display the
+  error message.
+  
+  This also represents a distinct change from Tapestry 4. In earlier versions of Tapestry, 
+  the Form component's listener parameter would be bound to the method to invoke, by name.  Further,
+  the listener method had to be public.
+  This new approach not only support multiple listeners, but provides an improved separation of
+  view concerns (inside the page's HTML template) and logic concerns, inside the Java class.
+    
+  In many cases, additional information about the event is available, and can be passed
+  into the method by adding parameters to the method. Again, Tapestry will adapt
+  to your parameters, in whatever order you supply them.
\ No newline at end of file

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/provider.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/provider.apt?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/provider.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/provider.apt Sat Aug 19 16:40:24 2006
@@ -57,7 +57,7 @@
 *---------------------+-----------------------------------------------------------------------------------------+
 | <<Property>>        | <<Default Service or Implementation>>                                                   |
 *---------------------+-----------------------------------------------------------------------------------------+
-| xyz                 | {{{../apidocs/org/apache/tapestry/ioc/services/ClassFactory.html}ClassFactory}}         |
+| request             | {{{../apidocs/org/apache/tapestry/request/WebRequest}tapestry.request.WebRequest}}      |
 *---------------------+-----------------------------------------------------------------------------------------+
 Default properties available via the infrastructure object provider
   

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/shadow.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/shadow.apt?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/shadow.apt (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/shadow.apt Sat Aug 19 16:40:24 2006
@@ -0,0 +1,56 @@
+ ----
+ Shadow Services
+ ----
+ 
+Shadow Services
+
+  The 
+  {{{../apidocs/org/apache/tapestry/ioc/services/PropertyShadowBuilder.html}tapestry.ioc.PropertyShadowBuilder}}
+  service is used to build a special, delegating kind of service implementation.
+  
+  Effectively, it is used to allow a property of another service to be exposed as its own service.
+  
+  For example, the tapestry.request module provides a WebRequest property as a shadow of the RequestGlobals
+  service's request property:
+  
++----+
+public WebRequest buildWebRequest()
+{
+  return _shadowBuilder.createShadow(_requestGlobals, "request", WebRequest.class);
+}
++----+
+
+  This can be thought of as similar to:
+  
++----+
+public WebRequest buildWebRequest()
+{
+  return _requestGlobals.getRequest();
+}
++----+
+    
+  However there is a <critical> difference between the two:  a shadow property is <re-evaluated on each method invocation>.
+  In the former case, the WebRequest service will always obtain the current value of the request property from the
+  per-thread RequestGlobals service. The second example is more than likely broken, since it will expose whatever
+  value is in the request property of the RequestGlobals <at the time the WebRequest service implementation is created>.
+  
+  Notice that in this example, the WebRequest service is a normal singleton. This service can be freely injected
+  into any service throughout the framework or application. Invoking methods on this service will always delegate
+  to the current thread's request. Callers don't have to be aware of this internal delegation; it just happens.    
+  
+Non-Reflective
+
+  When the shadow is created, reflection is used to translate the property name to a method name.
+  At runtime, reflection is not used.  A typical method is implemented is (approximately):
+  
++----+
+public String getParameter(String name)
+{
+  return _source.getRequest().getParameter(name);
+}
++----+
+
+  That is, the shadow implementation holds onto the target object (in the above example,
+  the RequestGlobals service) and invokes a method on it directly, not using reflection.
+  
+  
\ No newline at end of file

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml Sat Aug 19 16:40:24 2006
@@ -60,6 +60,12 @@
             <item name="Ordering" href="ioc/order.html"/>
             <item name="Chain Of Command" href="ioc/command.html"/>
             <item name="Pipeline" href="ioc/pipeline.html"/>
+            <item name="Shadow Services" href="ioc/shadow.html"/>
+        </menu>
+
+        <menu name="Internals Guide">
+            <item name="Request Processing" href="guide/request.html"/>
+            <item name="DOM" href="guide/dom.html"/>
         </menu>
                 
         ${reports}

Added: tapestry/tapestry5/tapestry-core/trunk/src/test/conf/log4j.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/conf/log4j.properties?rev=432900&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/conf/log4j.properties (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/conf/log4j.properties Sat Aug 19 16:40:24 2006
@@ -0,0 +1,24 @@
+# Copyright 2006 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+log4j.rootCategory=WARN, A1
+
+# A1 is set to be a ConsoleAppender. 
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%c{1} [%p] %m%n
+
+log4j.category.tapestry=debug

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/IOCUtilitiesTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/IOCUtilitiesTest.java?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/IOCUtilitiesTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/IOCUtilitiesTest.java Sat Aug 19 16:40:24 2006
@@ -15,6 +15,8 @@
 package org.apache.tapestry.internal.ioc;
 
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
 import java.util.List;
 
 import org.apache.tapestry.test.TestBase;
@@ -60,5 +62,16 @@
         // Make sure that joinSorted() doesn't change the input list
 
         assertEquals(copy, unsorted);
+    }
+
+    @Test
+    public void enumeration_to_list()
+    {
+        List<String> input = Arrays.asList("wilma", "fred", "barney");
+        Enumeration e = Collections.enumeration(input);
+
+        List<String> output = IOCUtilities.toList(e);
+
+        assertEquals(output, Arrays.asList("barney", "fred", "wilma"));
     }
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/MarkupWriterImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/MarkupWriterImplTest.java?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/MarkupWriterImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/MarkupWriterImplTest.java Sat Aug 19 16:40:24 2006
@@ -1,3 +1,17 @@
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package org.apache.tapestry.internal.services;
 
 import org.apache.tapestry.MarkupWriter;

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/services/PropertyShadowBuilderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/services/PropertyShadowBuilderImplTest.java?rev=432900&r1=432899&r2=432900&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/services/PropertyShadowBuilderImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/services/PropertyShadowBuilderImplTest.java Sat Aug 19 16:40:24 2006
@@ -88,7 +88,7 @@
 
         holder.setFoo(foo);
 
-        Foo shadow = _builder.createShadow(holder, "foo", Foo.class);
+        Foo shadow = _builder.buildShadow(holder, "foo", Foo.class);
 
         for (int i = 0; i < 3; i++)
         {
@@ -113,7 +113,7 @@
 
         try
         {
-            _builder.createShadow(holder, "bar", Foo.class);
+            _builder.buildShadow(holder, "bar", Foo.class);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -130,7 +130,7 @@
 
         try
         {
-            _builder.createShadow(holder, "count", Map.class);
+            _builder.buildShadow(holder, "count", Map.class);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -147,7 +147,7 @@
 
         try
         {
-            _builder.createShadow(holder, "writeOnly", Foo.class);
+            _builder.buildShadow(holder, "writeOnly", Foo.class);
             unreachable();
         }
         catch (RuntimeException ex)