You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2007/09/20 05:05:27 UTC

svn commit: r577519 - in /cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src: main/java/org/apache/cocoon/servletservice/ main/java/org/apache/cocoon/servletservice/util/ test/java/org/apache/cocoon/servletservice/ test/java/org/a...

Author: vgritsenko
Date: Wed Sep 19 20:05:26 2007
New Revision: 577519

URL: http://svn.apache.org/viewvc?rev=577519&view=rev
Log:
Reorganize (some of the) methods in the BlockCallHttpServletRequest to have at least some
logical grouping.
Implement couple of methods (content length, reader).

Added:
    cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/NullServletInputStream.java   (with props)
Modified:
    cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java
    cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletRequest.java
    cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/ServletServiceContextTestCase.java   (props changed)
    cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/util/RequestParametersTestCase.java

Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java?rev=577519&r1=577518&r2=577519&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java (original)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/ServletConnection.java Wed Sep 19 20:05:26 2007
@@ -49,10 +49,10 @@
     /** By default we use the logger for this class. */
     private final Log logger = LogFactory.getLog(getClass());
 
-    /** Wrapped request */
+    /** Connection request */
     private BlockCallHttpServletRequest request;
     
-    /** Wrapped response */
+    /** Connection response */
     private BlockCallHttpServletResponse response;
 
     /** The name of the called block */
@@ -66,8 +66,9 @@
     /** If already connected */
     private boolean connected;
     
-    private InputStream responseBody;
     private ByteArrayOutputStream requestBody;
+    private InputStream responseBody;
+
 
     /**
      * Construct a new object
@@ -97,7 +98,6 @@
 
         this.request = new BlockCallHttpServletRequest(blockURI, CallFrameHelper.getRequest());
         this.response = new BlockCallHttpServletResponse();
-        this.connected = false;
     }
     
     public void connect() throws IOException, ServletException {
@@ -107,10 +107,8 @@
         }
     	
         if (requestBody != null) {
-            request.setInputStream(new ByteArrayInputStream(requestBody.toByteArray()));
             request.setMethod("POST");
-        } else {
-            request.setMethod("GET");
+            request.setInputStream(new ByteArrayInputStream(requestBody.toByteArray()));
         }
     	
         ByteArrayOutputStream os = new ByteArrayOutputStream();

Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletRequest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletRequest.java?rev=577519&r1=577518&r2=577519&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletRequest.java (original)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/BlockCallHttpServletRequest.java Wed Sep 19 20:05:26 2007
@@ -1,25 +1,37 @@
 /*
-* 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.
-*/
+ * 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.cocoon.servletservice.util;
 
+import org.apache.commons.collections.iterators.IteratorEnumeration;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
+import java.io.InputStreamReader;
+import java.io.Reader;
 import java.net.URI;
 import java.security.Principal;
 import java.text.ParseException;
@@ -27,157 +39,194 @@
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Locale;
 import java.util.Map;
 
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionContext;
-
-import org.apache.commons.collections.iterators.IteratorEnumeration;
-
 /**
  * Create a HttpServletRequest from an URL, that is used while calling e.g. a block.
  * 
  * @version $Id$
  */
-public class BlockCallHttpServletRequest implements HttpServletRequest{
+public class BlockCallHttpServletRequest implements HttpServletRequest {
     
     /**
      * Protocol of block call requests.
      */
     private static final String PROTOCOL = "HTTP/1.1";
 
+    /**
+     * Date header format definied by RFC 822,
+     * see http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
+     */
+    private final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss' 'Z", Locale.US);
 
-    private URI uri;
-    private Hashtable attributes = new Hashtable();
-    private RequestParameters parameters;
-    private String encoding;
+
+    /**
+     * The <code>parent</code> holds reference to the request object that
+     * makes a servlet call.
+     */
+    private HttpServletRequest parent;
+
+    /**
+     * Block call request URI
+     */
+    private final URI uri;
+
+    /**
+     * Request method. If not set via {@link #setMethod(String)},
+     * defaults to <code>GET</code>.
+     */
     private String method;
-    private Map headers = new HashMap();
-    
+
     /**
-     * The <code>callingRequest</code> holds reference to the request object that makes a servlet call.
+     * Request headers map
      */
-    private HttpServletRequest callingRequest;
-    
-    private ServletInputStream requestBody;
-    
+    private final Map headers;
+
     /**
-     * format definied by RFC 822, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
+     * Request parameters extracted from {@link #uri}.
      */
-    final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss' 'Z", Locale.US);
-    
-    
+    private final RequestParameters parameters;
+
+    /**
+     * Request character encoding.
+     */
+    private String encoding;
+
+    /**
+     * Length of the request body.
+     */
+    private int contentLength;
+
+    /**
+     * Request body.
+     */
+    private ServletInputStream content;
+
+    /**
+     * Request attributes map.
+     */
+    private final Map attributes;
+
+
     /**
      * @param uri points to the called servlet
-     * @param callingRequest reference to the request object that makes a servlet call
+     * @param parent reference to the request object that makes a servlet call
      */
-    public BlockCallHttpServletRequest(URI uri, HttpServletRequest callingRequest) {
+    public BlockCallHttpServletRequest(URI uri, HttpServletRequest parent) {
+        this.parent = parent;
         this.uri = uri;
+        this.headers = new HashMap();
         this.parameters = new RequestParameters(this.uri.getQuery());
-        this.callingRequest = callingRequest;
+        this.method = "GET";
+        this.contentLength = -1;
+        this.content = NullServletInputStream.INSTANCE;
+        this.attributes = new HashMap();
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequestWrapper#getAttribute(java.lang.String)
+     * @see javax.servlet.ServletRequest#getProtocol()
      */
-    public Object getAttribute(String name) {
-        return this.attributes.get(name);
+    public String getProtocol() {
+        return PROTOCOL;
+    }
+
+    public String getMethod() {
+        return method;
     }
 
+    public void setMethod(String method) {
+        this.method = method;
+    }
+
+    //
+    // Request URI parts
+    //
+
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequestWrapper#getAttributeNames()
+     * @see javax.servlet.ServletRequest#getScheme()
      */
-    public Enumeration getAttributeNames() {
-        return this.attributes.keys();
+    public String getScheme() {
+        return this.uri.getScheme();
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequest#getAuthType()
+     * @see javax.servlet.ServletRequest#getServerName()
      */
-    public String getAuthType() {
-        return null;
+    public String getServerName() {
+        // TODO implement this
+        return "";
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getCharacterEncoding()
+     * @see javax.servlet.ServletRequest#getServerPort()
      */
-    public String getCharacterEncoding() {
-        return this.encoding;
+    public int getServerPort() {
+        // TODO implement this
+        return 80;
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getContentLength()
+     * @see javax.servlet.http.HttpServletRequest#getContextPath()
      */
-    public int getContentLength() {
-        // TODO Doesn't handle input streams yet
-        return -1;
+    public String getContextPath() {
+        return parent.getContextPath();
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getContentType()
+     * @see javax.servlet.http.HttpServletRequest#getServletPath()
      */
-    public String getContentType() {
-        // TODO Doesn't handle input streams yet
-        return null;
+    public String getServletPath() {
+        // TODO Is this right?
+        return "";
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequestWrapper#getContextPath()
+     * @see javax.servlet.http.HttpServletRequest#getPathInfo()
      */
-    public String getContextPath() {
-        return callingRequest.getContextPath();
+    public String getPathInfo() {
+        return this.uri.getPath();
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequest#getCookies()
+     * @see javax.servlet.http.HttpServletRequest#getPathTranslated()
      */
-    public Cookie[] getCookies() {
+    public String getPathTranslated() {
+        // TODO This is legal but more info might be possible
         return null;
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequest#getDateHeader(java.lang.String)
+     * @see javax.servlet.http.HttpServletRequest#getQueryString()
      */
-    public long getDateHeader(String name) {
-        String header = getHeader(name);
-        if (header == null) return -1;
-        try {
-            return dateFormat.parse(header).getTime();
-        } catch (ParseException e) {
-            throw new RuntimeException(e);
-        }
+    public String getQueryString() {
+        return this.uri.getQuery();
     }
-    
+
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletResponse#setDateHeader(java.lang.String, long)
+     * @see javax.servlet.http.HttpServletRequest#getRequestURI()
      */
-    public void setDateHeader(String name, long date) {
-        setHeader(name, dateFormat.format(new Date(date)));
+    public String getRequestURI() {
+        // TODO Is this right?
+        return getContextPath() + getServletPath() + getPathInfo();
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequest#getHeader(java.lang.String)
+     * @see javax.servlet.http.HttpServletRequest#getRequestURL()
      */
-    public String getHeader(String name) {
-        return (String)headers.get(name);
+    public StringBuffer getRequestURL() {
+        return new StringBuffer(getScheme()).append(':').append(getRequestURI());
     }
     
-    public void setHeader(String name, String value) {
-        headers.put(name, value);
-    }
+    //
+    // Request headers
+    //
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequest#getHeaderNames()
+     * @see javax.servlet.http.HttpServletRequest#getHeader(java.lang.String)
      */
-    public Enumeration getHeaderNames() {
-        return new IteratorEnumeration(headers.keySet().iterator());
+    public String getHeader(String name) {
+        return (String) headers.get(name);
     }
 
     /* (non-Javadoc)
@@ -187,19 +236,28 @@
         return new IteratorEnumeration(headers.values().iterator());
     }
 
+    public void setHeader(String name, String value) {
+        headers.put(name, value);
+    }
+
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getInputStream()
+     * @see javax.servlet.http.HttpServletRequest#getDateHeader(java.lang.String)
      */
-    public ServletInputStream getInputStream() throws IOException {
-        return requestBody;
+    public long getDateHeader(String name) {
+        String header = getHeader(name);
+        if (header == null) {
+            return -1;
+        }
+
+        try {
+            return dateFormat.parse(header).getTime();
+        } catch (ParseException e) {
+            throw new RuntimeException(e);
+        }
     }
     
-    public void setInputStream(final InputStream inputStream) {
-        requestBody = new ServletInputStream() {
-            public int read() throws IOException {
-                return inputStream.read();
-            }
-        };
+    public void setDateHeader(String name, long date) {
+        setHeader(name, dateFormat.format(new Date(date)));
     }
 
     /* (non-Javadoc)
@@ -214,191 +272,235 @@
         return Integer.parseInt(header);
     }
 
-    /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletResponse#setIntHeader(java.lang.String, int)
-     */
     public void setIntHeader(String name, int value) {
         setHeader(name, String.valueOf(value));
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getLocale()
+     * @see javax.servlet.http.HttpServletRequest#getHeaderNames()
      */
-    public Locale getLocale() {
-        // TODO Implement this
-        throw new UnsupportedOperationException();
+    public Enumeration getHeaderNames() {
+        return new IteratorEnumeration(headers.keySet().iterator());
     }
 
+    //
+    // Request parameters
+    //
+
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getLocales()
+     * @see javax.servlet.ServletRequest#getParameter(java.lang.String)
      */
-    public Enumeration getLocales() {
-        // TODO Implement this
-        throw new UnsupportedOperationException();
+    public String getParameter(String name) {
+        return this.parameters.getParameter(name);
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequest#getMethod()
+     * @see javax.servlet.ServletRequest#getParameterValues(java.lang.String)
      */
-    public String getMethod() {
-        return method;
-    }
-    
-    public void setMethod(String method) {
-        this.method = method;
+    public String[] getParameterValues(String name) {
+        return this.parameters.getParameterValues(name);
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequestWrapper#getParameter(java.lang.String)
+     * @see javax.servlet.ServletRequest#getParameterNames()
      */
-    public String getParameter(String name) {
-        return this.parameters.getParameter(name);
+    public Enumeration getParameterNames() {
+        return this.parameters.getParameterNames();
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequestWrapper#getParameterMap()
+     * @see javax.servlet.ServletRequest#getParameterMap()
      */
     public Map getParameterMap() {
-        // TODO Implement this
-        throw new UnsupportedOperationException();
+        return this.parameters.getParameterMap();
     }
 
+    //
+    // Request body
+    //
+
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequestWrapper#getParameterNames()
+     * @see javax.servlet.ServletRequest#getCharacterEncoding()
      */
-    public Enumeration getParameterNames() {
-        return this.parameters.getParameterNames();
+    public String getCharacterEncoding() {
+        return this.encoding;
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequestWrapper#getParameterValues(java.lang.String)
+     * @see javax.servlet.ServletRequest#setCharacterEncoding(java.lang.String)
      */
-    public String[] getParameterValues(String name) {
-        return this.parameters.getParameterValues(name);
+    public void setCharacterEncoding(String encoding) throws UnsupportedEncodingException {
+        this.encoding = encoding;
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequestWrapper#getPathInfo()
+     * @see javax.servlet.ServletRequest#getContentLength()
      */
-    public String getPathInfo() {
-        return this.uri.getPath();
+    public int getContentLength() {
+        return contentLength;
     }
 
+    public void setContentLength(int contentLength) {
+        this.contentLength = contentLength;
+    }
+    
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequest#getPathTranslated()
+     * @see javax.servlet.ServletRequest#getContentType()
      */
-    public String getPathTranslated() {
-        // TODO This is legal but more info might be possible
+    public String getContentType() {
+        // TODO Doesn't handle input streams yet
         return null;
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getProtocol()
+     * @see javax.servlet.ServletRequest#getInputStream()
      */
-    public String getProtocol() {
-        return this.PROTOCOL;
+    public ServletInputStream getInputStream() throws IOException {
+        return content;
     }
 
-    /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequestWrapper#getQueryString()
-     */
-    public String getQueryString() {
-        return this.uri.getQuery();
+    public void setInputStream(final InputStream inputStream) {
+        try {
+            contentLength = inputStream.available();
+        } catch (IOException e) {
+            contentLength = -1;
+        }
+
+        content = new ServletInputStream() {
+            public int read() throws IOException {
+                return inputStream.read();
+            }
+        };
     }
 
     /* (non-Javadoc)
      * @see javax.servlet.ServletRequest#getReader()
      */
     public BufferedReader getReader() throws IOException {
-        // TODO No input handling yet
-        throw new UnsupportedOperationException();
+        Reader reader;
+        String encoding = getCharacterEncoding();
+        if (encoding == null) {
+            reader = new InputStreamReader(getInputStream());
+        } else {
+            reader = new InputStreamReader(getInputStream(), encoding);
+        }
+
+        return new BufferedReader(reader);
     }
 
+    //
+    // Request attributes
+    //
+
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getRealPath(java.lang.String)
+     * @see javax.servlet.ServletRequest#getAttribute(java.lang.String)
      */
-    public String getRealPath(String path) {
-        // Deprecated
-        return null;
+    public Object getAttribute(String name) {
+        return this.attributes.get(name);
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getRemoteAddr()
+     * @see javax.servlet.ServletRequest#getAttributeNames()
      */
-    public String getRemoteAddr() {
-        // TODO The URI of the current block might be an appropriate choice.
-        throw new UnsupportedOperationException();
+    public Enumeration getAttributeNames() {
+        return new IteratorEnumeration(this.attributes.keySet().iterator());
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getRemoteHost()
+     * @see javax.servlet.ServletRequest#setAttribute(java.lang.String, java.lang.Object)
      */
-    public String getRemoteHost() {
-        // TODO Local host might be an appropriate choice
-        throw new UnsupportedOperationException();
+    public void setAttribute(String name, Object value) {
+        if (value != null) {
+            this.attributes.put(name, value);
+        } else {
+            removeAttribute(name);
+        }
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequest#getRemoteUser()
+     * @see javax.servlet.ServletRequest#removeAttribute(java.lang.String)
      */
-    public String getRemoteUser() {
-        return null;
+    public void removeAttribute(String name) {
+        this.attributes.remove(name);
     }
 
+    //
+    //
+    //
+
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getRequestDispatcher(java.lang.String)
+     * @see javax.servlet.http.HttpServletRequest#getAuthType()
      */
-    public RequestDispatcher getRequestDispatcher(String path) {
+    public String getAuthType() {
         return null;
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequest#getRequestedSessionId()
+     * @see javax.servlet.http.HttpServletRequest#getCookies()
      */
-    public String getRequestedSessionId() {
+    public Cookie[] getCookies() {
         return null;
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequestWrapper#getRequestURI()
+     * @see javax.servlet.ServletRequest#getLocale()
      */
-    public String getRequestURI() {
-        return this.getContextPath() + this.getServletPath() + this.getPathInfo();
+    public Locale getLocale() {
+        // TODO Implement this
+        throw new UnsupportedOperationException();
     }
+
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequestWrapper#getRequestURL()
+     * @see javax.servlet.ServletRequest#getLocales()
      */
-    public StringBuffer getRequestURL() {
-        return new StringBuffer(this.getScheme()).append(':').append(this.getRequestURI());
+    public Enumeration getLocales() {
+        // TODO Implement this
+        throw new UnsupportedOperationException();
     }
+
+    /**
+     * @deprecated
+     * @see javax.servlet.ServletRequest#getRealPath(java.lang.String)
+     */
+    public String getRealPath(String path) {
+        return null;
+    }
+
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getScheme()
+     * @see javax.servlet.ServletRequest#getRemoteAddr()
      */
-    public String getScheme() {
-        return this.uri.getScheme();
+    public String getRemoteAddr() {
+        // TODO The URI of the current block might be an appropriate choice.
+        throw new UnsupportedOperationException();
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getServerName()
+     * @see javax.servlet.ServletRequest#getRemoteHost()
      */
-    public String getServerName() {
-        // TODO implement this
-        return "";
+    public String getRemoteHost() {
+        // TODO Local host might be an appropriate choice
+        throw new UnsupportedOperationException();
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#getServerPort()
+     * @see javax.servlet.http.HttpServletRequest#getRemoteUser()
      */
-    public int getServerPort() {
-        // TODO implement this
-        return 80;
+    public String getRemoteUser() {
+        return null;
     }
 
     /* (non-Javadoc)
-     * @see javax.servlet.http.HttpServletRequestWrapper#getServletPath()
+     * @see javax.servlet.ServletRequest#getRequestDispatcher(java.lang.String)
      */
-    public String getServletPath() {
-        return "";
+    public RequestDispatcher getRequestDispatcher(String path) {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.servlet.http.HttpServletRequest#getRequestedSessionId()
+     */
+    public String getRequestedSessionId() {
+        return null;
     }
 
     /* (non-Javadoc)
@@ -560,30 +662,6 @@
     public boolean isUserInRole(String role) {
         // TODO No authentication handling between blocks yet
         return false;
-    }
-
-    /* (non-Javadoc)
-     * @see javax.servlet.ServletRequestWrapper#removeAttribute(java.lang.String)
-     */
-    public void removeAttribute(String name) {
-        this.attributes.remove(name);
-    }
-
-    /* (non-Javadoc)
-     * @see javax.servlet.ServletRequestWrapper#setAttribute(java.lang.String, java.lang.Object)
-     */
-    public void setAttribute(String name, Object value) {
-        if (value != null)
-            this.attributes.put(name, value);
-        else
-            this.removeAttribute(name);
-    }
-
-    /* (non-Javadoc)
-     * @see javax.servlet.ServletRequest#setCharacterEncoding(java.lang.String)
-     */
-    public void setCharacterEncoding(String encoding) throws UnsupportedEncodingException {
-        this.encoding = encoding;
     }
 
     public String getLocalAddr() {

Added: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/NullServletInputStream.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/NullServletInputStream.java?rev=577519&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/NullServletInputStream.java (added)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/NullServletInputStream.java Wed Sep 19 20:05:26 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.cocoon.servletservice.util;
+
+import javax.servlet.ServletInputStream;
+
+import java.io.IOException;
+
+/**
+ * Always empty stream.
+ *
+ * @version $Id$
+ */
+public class NullServletInputStream extends ServletInputStream {
+
+    public static final NullServletInputStream INSTANCE = new NullServletInputStream();
+
+    public int read() throws IOException {
+        return -1;
+    }
+}

Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/NullServletInputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/main/java/org/apache/cocoon/servletservice/util/NullServletInputStream.java
------------------------------------------------------------------------------
    svn:keywords = Id Revision Author Date

Propchange: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/ServletServiceContextTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id Revision Author Date

Modified: cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/util/RequestParametersTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/util/RequestParametersTestCase.java?rev=577519&r1=577518&r2=577519&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/util/RequestParametersTestCase.java (original)
+++ cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-impl/src/test/java/org/apache/cocoon/servletservice/util/RequestParametersTestCase.java Wed Sep 19 20:05:26 2007
@@ -1,20 +1,19 @@
 /*
-* 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.
-*/
-
+ * 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.cocoon.servletservice.util;
 
 import junit.framework.TestCase;