geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1858615 [10/32] - in /geronimo/specs/branches/jakarta: geronimo-jakarta-jsp_spec/ geronimo-jakarta-jsp_spec/src/main/java/jakarta/servlet/jsp/ geronimo-jakarta-jsp_spec/src/main/java/jakarta/servlet/jsp/el/ geronimo-jakarta-jsp_spec/src/ma...
Date Sat, 04 May 2019 21:29:41 GMT
Modified: geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestAttributeEvent.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestAttributeEvent.java?rev=1858615&r1=1858614&r2=1858615&view=diff
==============================================================================
--- geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestAttributeEvent.java (original)
+++ geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestAttributeEvent.java Sat May  4 21:29:39 2019
@@ -1,49 +1,50 @@
 /*
- * 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
+ * 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
+ *     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.
+ * 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 javax.servlet;
-
+package jakarta.servlet;
 
 /**
- * This is the event class for notifications of changes to the
- * attributes of the servlet request in an application.
+ * This is the event class for notifications of changes to the attributes of the
+ * servlet request in an application.
  *
- * @since Servlet 2.4
  * @see ServletRequestAttributeListener
- * @version $Rev$ $Date$
+ * @since Servlet 2.4
  */
-
 public class ServletRequestAttributeEvent extends ServletRequestEvent {
+    private static final long serialVersionUID = 1L;
+
     private final String name;
     private final Object value;
 
     /**
-     * Construct a ServletRequestAttributeEvent giving the servlet context
-     * of this web application, the ServletRequest whose attributes are
-     * changing and the name and value of the attribute.
+     * Construct a ServletRequestAttributeEvent giving the servlet context of
+     * this web application, the ServletRequest whose attributes are changing
+     * and the name and value of the attribute.
      *
-     * @param sc      the ServletContext that is sending the event.
-     * @param request the ServletRequest that is sending the event.
-     * @param name    the name of the request attribute.
-     * @param value   the value of the request attribute.
+     * @param sc
+     *            the ServletContext that is sending the event.
+     * @param request
+     *            the ServletRequest that is sending the event.
+     * @param name
+     *            the name of the request attribute.
+     * @param value
+     *            the value of the request attribute.
      */
-    public ServletRequestAttributeEvent(ServletContext sc, ServletRequest request, String name, Object value) {
+    public ServletRequestAttributeEvent(ServletContext sc,
+            ServletRequest request, String name, Object value) {
         super(sc, request);
         this.name = name;
         this.value = value;
@@ -60,14 +61,13 @@ public class ServletRequestAttributeEven
 
     /**
      * Returns the value of the attribute that has been added, removed or
-     * replaced. If the attribute was added, this is the value of the
-     * attribute. If the attribute was removed, this is the value of the
-     * removed attribute. If the attribute was replaced, this is the old
-     * value of the attribute.
+     * replaced. If the attribute was added, this is the value of the attribute.
+     * If the attribute was removed, this is the value of the removed attribute.
+     * If the attribute was replaced, this is the old value of the attribute.
      *
      * @return the value of the changed request attribute
      */
     public Object getValue() {
-        return this.value;   
+        return this.value;
     }
 }

Modified: geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestAttributeListener.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestAttributeListener.java?rev=1858615&r1=1858614&r2=1858615&view=diff
==============================================================================
--- geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestAttributeListener.java (original)
+++ geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestAttributeListener.java Sat May  4 21:29:39 2019
@@ -1,23 +1,20 @@
 /*
- * 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 javax.servlet;
+* 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 jakarta.servlet;
 
 import java.util.EventListener;
 
@@ -32,29 +29,33 @@ import java.util.EventListener;
  * or the first filter in the chain.
  *
  * @since Servlet 2.4
- * @version $Rev$ $Date$
  */
-
 public interface ServletRequestAttributeListener extends EventListener {
     /**
      * Notification that a new attribute was added to the
-     * * servlet request. Called after the attribute is added.
-     * @param srae event for attribute added
+     * servlet request. Called after the attribute is added.
+     * The default implementation is a NO-OP.
+     * @param srae Information about the new request attribute
      */
-    void attributeAdded(ServletRequestAttributeEvent srae);
+    public default void attributeAdded(ServletRequestAttributeEvent srae) {
+    }
 
     /**
      * Notification that an existing attribute has been removed from the
-     * * servlet request. Called after the attribute is removed.
-     * @param srae event for attribute removed
+     * servlet request. Called after the attribute is removed.
+     * The default implementation is a NO-OP.
+     * @param srae Information about the removed request attribute
      */
-    void attributeRemoved(ServletRequestAttributeEvent srae);
+    public default void attributeRemoved(ServletRequestAttributeEvent srae) {
+    }
 
     /**
      * Notification that an attribute was replaced on the
-     * * servlet request. Called after the attribute is replaced.
-     * @param srae event for attribute replaced
+     * servlet request. Called after the attribute is replaced.
+     * The default implementation is a NO-OP.
+     * @param srae Information about the replaced request attribute
      */
-    void attributeReplaced(ServletRequestAttributeEvent srae);
+    public default void attributeReplaced(ServletRequestAttributeEvent srae) {
+    }
 }
 

Modified: geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestEvent.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestEvent.java?rev=1858615&r1=1858614&r2=1858615&view=diff
==============================================================================
--- geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestEvent.java (original)
+++ geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestEvent.java Sat May  4 21:29:39 2019
@@ -1,46 +1,41 @@
 /*
- * 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
+ * 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
+ *     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.
+ * 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 javax.servlet;
-
+package jakarta.servlet;
 
 /**
- * Events of this kind indicate lifecycle
- * events for a ServletRequest.
- * The source of the event
- * is the ServletContext of this web application.
+ * Events of this kind indicate lifecycle events for a ServletRequest. The
+ * source of the event is the ServletContext of this web application.
  *
- * @since Servlet 2.4
  * @see ServletRequestListener
- * @version $Rev$ $Date$
+ * @since Servlet 2.4
  */
-
 public class ServletRequestEvent extends java.util.EventObject {
+    private static final long serialVersionUID = 1L;
 
-    private final ServletRequest request;
+    private final transient ServletRequest request;
 
     /**
-     * Construct a ServletRequestEvent for the given ServletContext
-     * and ServletRequest.
+     * Construct a ServletRequestEvent for the given ServletContext and
+     * ServletRequest.
      *
-     * @param sc      the ServletContext of the web application.
-     * @param request the ServletRequest that is sending the event.
+     * @param sc
+     *            the ServletContext of the web application.
+     * @param request
+     *            the ServletRequest that is sending the event.
      */
     public ServletRequestEvent(ServletContext sc, ServletRequest request) {
         super(sc);
@@ -48,14 +43,16 @@ public class ServletRequestEvent extends
     }
 
     /**
-     * Returns the ServletRequest that is changing.
+     * Get the associated ServletRequest.
+     * @return the ServletRequest that is changing.
      */
     public ServletRequest getServletRequest() {
-        return request;
+        return this.request;
     }
 
     /**
-     * Returns the ServletContext of this web application.
+     * Get the associated ServletContext.
+     * @return the ServletContext that is changing.
      */
     public ServletContext getServletContext() {
         return (ServletContext) super.getSource();

Modified: geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestListener.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestListener.java?rev=1858615&r1=1858614&r2=1858615&view=diff
==============================================================================
--- geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestListener.java (original)
+++ geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestListener.java Sat May  4 21:29:39 2019
@@ -1,23 +1,20 @@
 /*
- * 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 javax.servlet;
+* 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 jakarta.servlet;
 
 import java.util.EventListener;
 
@@ -30,23 +27,22 @@ import java.util.EventListener;
  * the last servlet or the first filter in the chain.
  *
  * @since Servlet 2.4
- * @version $Rev$ $Date$
  */
-
 public interface ServletRequestListener extends EventListener {
 
     /**
      * The request is about to go out of scope of the web application.
-     *
-     * @param sre event containing request
+     * The default implementation is a NO-OP.
+     * @param sre Information about the request
      */
-    void requestDestroyed(ServletRequestEvent sre);
+    public default void requestDestroyed (ServletRequestEvent sre) {
+    }
 
     /**
      * The request is about to come into scope of the web application.
-     *
-     * @param sre event containing request
+     * The default implementation is a NO-OP.
+     * @param sre Information about the request
      */
-    void requestInitialized(ServletRequestEvent sre);
-
+    public default void requestInitialized (ServletRequestEvent sre) {
+    }
 }

Modified: geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestWrapper.java?rev=1858615&r1=1858614&r2=1858615&view=diff
==============================================================================
--- geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestWrapper.java (original)
+++ geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletRequestWrapper.java Sat May  4 21:29:39 2019
@@ -1,63 +1,61 @@
 /*
- * 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
+ * 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
+ *     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.
+ * 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 javax.servlet;
+package jakarta.servlet;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.Map;
-
+import java.util.ResourceBundle;
 
 /**
- * Provides a convenient implementation of the ServletRequest interface that
- * can be subclassed by developers wishing to adapt the request to a Servlet.
- * This class implements the Wrapper or Decorator pattern. Methods default to
- * calling through to the wrapped request object.
+ * Provides a convenient implementation of the ServletRequest interface that can
+ * be subclassed by developers wishing to adapt the request to a Servlet. This
+ * class implements the Wrapper or Decorator pattern. Methods default to calling
+ * through to the wrapped request object.
  *
- * @version $Rev$ $Date$
+ * @since Servlet 2.3
  * @see javax.servlet.ServletRequest
- * @since v 2.3
  */
-
 public class ServletRequestWrapper implements ServletRequest {
+    private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
+    private static final ResourceBundle lStrings =
+        ResourceBundle.getBundle(LSTRING_FILE);
+
     private ServletRequest request;
 
     /**
      * Creates a ServletRequest adaptor wrapping the given request object.
      *
-     * @param request request for this wrapper
-     * @throws java.lang.IllegalArgumentException
-     *          if the request is null
+     * @param request The request to wrap
+     *
+     * @throws IllegalArgumentException if the request is null
      */
     public ServletRequestWrapper(ServletRequest request) {
         if (request == null) {
-            throw new IllegalArgumentException("Request cannot be null");
+            throw new IllegalArgumentException(lStrings.getString("wrapper.nullRequest"));
         }
         this.request = request;
     }
 
     /**
-     * Return the wrapped request object.
-     *
-     * @return the request for this wrapper
+     * Get the wrapped request.
+     * @return the wrapped request object
      */
     public ServletRequest getRequest() {
         return this.request;
@@ -65,14 +63,13 @@ public class ServletRequestWrapper imple
 
     /**
      * Sets the request object being wrapped.
+     * @param request The new wrapped request.
      *
-     * @param request request to set
-     * @throws java.lang.IllegalArgumentException
-     *          if the request is null.
+     * @throws IllegalArgumentException if the request is null.
      */
     public void setRequest(ServletRequest request) {
         if (request == null) {
-            throw new IllegalArgumentException("Request cannot be null");
+            throw new IllegalArgumentException(lStrings.getString("wrapper.nullRequest"));
         }
         this.request = request;
     }
@@ -81,14 +78,16 @@ public class ServletRequestWrapper imple
      * The default behavior of this method is to call getAttribute(String name)
      * on the wrapped request object.
      */
+    @Override
     public Object getAttribute(String name) {
         return this.request.getAttribute(name);
     }
 
     /**
-     * The default behavior of this method is to return getAttributeNames()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getAttributeNames() on
+     * the wrapped request object.
      */
+    @Override
     public Enumeration<String> getAttributeNames() {
         return this.request.getAttributeNames();
     }
@@ -97,30 +96,34 @@ public class ServletRequestWrapper imple
      * The default behavior of this method is to return getCharacterEncoding()
      * on the wrapped request object.
      */
+    @Override
     public String getCharacterEncoding() {
         return this.request.getCharacterEncoding();
     }
 
     /**
-     * The default behavior of this method is to set the character encoding
-     * on the wrapped request object.
+     * The default behavior of this method is to set the character encoding on
+     * the wrapped request object.
      */
-    public void setCharacterEncoding(String enc) throws java.io.UnsupportedEncodingException {
+    @Override
+    public void setCharacterEncoding(String enc)
+            throws java.io.UnsupportedEncodingException {
         this.request.setCharacterEncoding(enc);
     }
 
     /**
-     * The default behavior of this method is to return getContentLength()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getContentLength() on
+     * the wrapped request object.
      */
+    @Override
     public int getContentLength() {
         return this.request.getContentLength();
     }
 
     /**
-     * The default behavior of this method is to return getContentLengthLong() on the wrapped request object.
-     * 
-     * @return a long containing the length of the request body or -1L if the length is not known
+     * The default behavior of this method is to return getContentLengthLong()
+     * on the wrapped request object.
+     *
      * @since Servlet 3.1
      */
     @Override
@@ -129,153 +132,172 @@ public class ServletRequestWrapper imple
     }
 
     /**
-     * The default behavior of this method is to return getContentType()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getContentType() on the
+     * wrapped request object.
      */
+    @Override
     public String getContentType() {
         return this.request.getContentType();
     }
 
     /**
-     * The default behavior of this method is to return getInputStream()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getInputStream() on the
+     * wrapped request object.
      */
+    @Override
     public ServletInputStream getInputStream() throws IOException {
         return this.request.getInputStream();
     }
 
     /**
-     * The default behavior of this method is to return getParameter(String name)
-     * on the wrapped request object.
+     * The default behavior of this method is to return getParameter(String
+     * name) on the wrapped request object.
      */
+    @Override
     public String getParameter(String name) {
         return this.request.getParameter(name);
     }
 
     /**
-     * The default behavior of this method is to return getParameterMap()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getParameterMap() on the
+     * wrapped request object.
      */
+    @Override
     public Map<String, String[]> getParameterMap() {
         return this.request.getParameterMap();
     }
 
     /**
-     * The default behavior of this method is to return getParameterNames()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getParameterNames() on
+     * the wrapped request object.
      */
+    @Override
     public Enumeration<String> getParameterNames() {
         return this.request.getParameterNames();
     }
 
     /**
-     * The default behavior of this method is to return getParameterValues(String name)
-     * on the wrapped request object.
+     * The default behavior of this method is to return
+     * getParameterValues(String name) on the wrapped request object.
      */
+    @Override
     public String[] getParameterValues(String name) {
         return this.request.getParameterValues(name);
     }
 
     /**
-     * The default behavior of this method is to return getProtocol()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getProtocol() on the
+     * wrapped request object.
      */
+    @Override
     public String getProtocol() {
         return this.request.getProtocol();
     }
 
     /**
-     * The default behavior of this method is to return getScheme()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getScheme() on the
+     * wrapped request object.
      */
+    @Override
     public String getScheme() {
         return this.request.getScheme();
     }
 
     /**
-     * The default behavior of this method is to return getServerName()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getServerName() on the
+     * wrapped request object.
      */
+    @Override
     public String getServerName() {
         return this.request.getServerName();
     }
 
     /**
-     * The default behavior of this method is to return getServerPort()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getServerPort() on the
+     * wrapped request object.
      */
+    @Override
     public int getServerPort() {
         return this.request.getServerPort();
     }
 
     /**
-     * The default behavior of this method is to return getReader()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getReader() on the
+     * wrapped request object.
      */
+    @Override
     public BufferedReader getReader() throws IOException {
         return this.request.getReader();
     }
 
     /**
-     * The default behavior of this method is to return getRemoteAddr()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getRemoteAddr() on the
+     * wrapped request object.
      */
+    @Override
     public String getRemoteAddr() {
         return this.request.getRemoteAddr();
     }
 
     /**
-     * The default behavior of this method is to return getRemoteHost()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getRemoteHost() on the
+     * wrapped request object.
      */
+    @Override
     public String getRemoteHost() {
         return this.request.getRemoteHost();
     }
 
     /**
-     * The default behavior of this method is to return setAttribute(String name, Object o)
-     * on the wrapped request object.
+     * The default behavior of this method is to return setAttribute(String
+     * name, Object o) on the wrapped request object.
      */
+    @Override
     public void setAttribute(String name, Object o) {
         this.request.setAttribute(name, o);
     }
 
     /**
-     * The default behavior of this method is to call removeAttribute(String name)
-     * on the wrapped request object.
+     * The default behavior of this method is to call removeAttribute(String
+     * name) on the wrapped request object.
      */
+    @Override
     public void removeAttribute(String name) {
         this.request.removeAttribute(name);
     }
 
     /**
-     * The default behavior of this method is to return getLocale()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getLocale() on the
+     * wrapped request object.
      */
+    @Override
     public Locale getLocale() {
         return this.request.getLocale();
     }
 
     /**
-     * The default behavior of this method is to return getLocales()
-     * on the wrapped request object.
+     * The default behavior of this method is to return getLocales() on the
+     * wrapped request object.
      */
+    @Override
     public Enumeration<Locale> getLocales() {
         return this.request.getLocales();
     }
 
     /**
-     * The default behavior of this method is to return isSecure()
-     * on the wrapped request object.
+     * The default behavior of this method is to return isSecure() on the
+     * wrapped request object.
      */
+    @Override
     public boolean isSecure() {
         return this.request.isSecure();
     }
 
     /**
-     * The default behavior of this method is to return getRequestDispatcher(String path)
-     * on the wrapped request object.
+     * The default behavior of this method is to return
+     * getRequestDispatcher(String path) on the wrapped request object.
      */
+    @Override
     public RequestDispatcher getRequestDispatcher(String path) {
         return this.request.getRequestDispatcher(path);
     }
@@ -283,104 +305,181 @@ public class ServletRequestWrapper imple
     /**
      * The default behavior of this method is to return getRealPath(String path)
      * on the wrapped request object.
+     *
+     * @deprecated As of Version 3.0 of the Java Servlet API
      */
+    @Override
+    @Deprecated
     public String getRealPath(String path) {
         return this.request.getRealPath(path);
     }
 
     /**
-     * The default behavior of this method is to return
-     * getRemotePort() on the wrapped request object.
+     * The default behavior of this method is to return getRemotePort() on the
+     * wrapped request object.
      *
-     * @since 2.4
+     * @since Servlet 2.4
      */
+    @Override
     public int getRemotePort() {
         return this.request.getRemotePort();
     }
 
     /**
-     * The default behavior of this method is to return
-     * getLocalName() on the wrapped request object.
+     * The default behavior of this method is to return getLocalName() on the
+     * wrapped request object.
      *
-     * @since 2.4
+     * @since Servlet 2.4
      */
+    @Override
     public String getLocalName() {
         return this.request.getLocalName();
     }
 
     /**
-     * The default behavior of this method is to return
-     * getLocalAddr() on the wrapped request object.
+     * The default behavior of this method is to return getLocalAddr() on the
+     * wrapped request object.
      *
-     * @since 2.4
+     * @since Servlet 2.4
      */
+    @Override
     public String getLocalAddr() {
         return this.request.getLocalAddr();
     }
 
     /**
-     * The default behavior of this method is to return
-     * getLocalPort() on the wrapped request object.
+     * The default behavior of this method is to return getLocalPort() on the
+     * wrapped request object.
      *
-     * @since 2.4
+     * @since Servlet 2.4
      */
+    @Override
     public int getLocalPort() {
         return this.request.getLocalPort();
     }
 
     /**
-     * Get the servlet context the request-response pair was last dispatched through.
+     * The default behavior of this method is to return getServletContext() on
+     * the wrapped request object.
      *
-     * @return the latest ServletContext on the dispatch chain.
-     * @since 3.0
+     * @since Servlet 3.0
      */
+    @Override
     public ServletContext getServletContext() {
-        return this.request.getServletContext();
+        return request.getServletContext();
     }
 
-    public AsyncContext getAsyncContext() {
-        return this.request.getAsyncContext();
-    }
-
-    public boolean isAsyncStarted() {
-        return this.request.isAsyncStarted();
+    /**
+     * The default behavior of this method is to return startAsync() on the
+     * wrapped request object.
+     *
+     * @throws IllegalStateException If asynchronous processing is not supported
+     *         for this request or if the request is already in asynchronous
+     *         mode
+     * @since Servlet 3.0
+     */
+    @Override
+    public AsyncContext startAsync() throws IllegalStateException {
+        return request.startAsync();
     }
 
-    public boolean isAsyncSupported() {
-        return this.request.isAsyncSupported();
+    /**
+     * The default behavior of this method is to return startAsync(Runnable) on
+     * the wrapped request object.
+     *
+     * @param servletRequest    The ServletRequest with which to initialise the
+     *                          asynchronous context
+     * @param servletResponse   The ServletResponse with which to initialise the
+     *                          asynchronous context
+     * @throws IllegalStateException If asynchronous processing is not supported
+     *         for this request or if the request is already in asynchronous
+     *         mode
+     * @since Servlet 3.0
+     */
+    @Override
+    public AsyncContext startAsync(ServletRequest servletRequest,
+            ServletResponse servletResponse) throws IllegalStateException {
+        return request.startAsync(servletRequest, servletResponse);
     }
 
-    public AsyncContext startAsync() {
-        return this.request.startAsync();
+    /**
+     * The default behavior of this method is to return isAsyncStarted() on the
+     * wrapped request object.
+     *
+     * @since Servlet 3.0
+     */
+    @Override
+    public boolean isAsyncStarted() {
+        return request.isAsyncStarted();
     }
 
-    public AsyncContext startAsync(ServletRequest request, ServletResponse response) {
-        return this.request.startAsync(request, response);
+    /**
+     * The default behavior of this method is to return isAsyncSupported() on
+     * the wrapped request object.
+     *
+     * @since Servlet 3.0
+     */
+    @Override
+    public boolean isAsyncSupported() {
+        return request.isAsyncSupported();
     }
 
-    public DispatcherType getDispatcherType() {
-        return this.request.getDispatcherType();
+    /**
+     * The default behavior of this method is to return getAsyncContext() on the
+     * wrapped request object.
+     *
+     * @since Servlet 3.0
+     */
+    @Override
+    public AsyncContext getAsyncContext() {
+        return request.getAsyncContext();
     }
 
-    public boolean isWrapperFor(Class wrappedType) {
-        if (this.request.getClass().isAssignableFrom(wrappedType)) {
+    /**
+     * TODO SERVLET3 - Add comments
+     * @param wrapped The request to compare to the wrapped request
+     * @return <code>true</code> if the request wrapped by this wrapper (or
+     *         series of wrappers) is the same as the supplied request,
+     *         otherwise <code>false</code>
+     * @since Servlet 3.0
+     */
+    public boolean isWrapperFor(ServletRequest wrapped) {
+        if (request == wrapped) {
             return true;
         }
-        if (this.request instanceof ServletRequestWrapper) {
-            return ((ServletRequestWrapper)this.request).isWrapperFor(wrappedType);
+        if (request instanceof ServletRequestWrapper) {
+            return ((ServletRequestWrapper) request).isWrapperFor(wrapped);
         }
         return false;
     }
 
-    public boolean isWrapperFor(ServletRequest instance) {
-        if (instance == this.request) {
+    /**
+     * TODO SERVLET3 - Add comments
+     * @param wrappedType The class to compare to the class of the wrapped
+     *                    request
+     * @return <code>true</code> if the request wrapped by this wrapper (or
+     *         series of wrappers) is the same type as the supplied type,
+     *         otherwise <code>false</code>
+     * @since Servlet 3.0
+     */
+    public boolean isWrapperFor(Class<?> wrappedType) {
+        if (wrappedType.isAssignableFrom(request.getClass())) {
             return true;
         }
-        if (this.request instanceof ServletRequestWrapper) {
-            return ((ServletRequestWrapper)this.request).isWrapperFor(instance);
+        if (request instanceof ServletRequestWrapper) {
+            return ((ServletRequestWrapper) request).isWrapperFor(wrappedType);
         }
         return false;
     }
 
+    /**
+     * The default behavior of this method is to call getDispatcherType() on the
+     * wrapped request object.
+     *
+     * @since Servlet 3.0
+     */
+    @Override
+    public DispatcherType getDispatcherType() {
+        return this.request.getDispatcherType();
+    }
 }
-

Modified: geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletResponse.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletResponse.java?rev=1858615&r1=1858614&r2=1858615&view=diff
==============================================================================
--- geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletResponse.java (original)
+++ geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletResponse.java Sat May  4 21:29:39 2019
@@ -1,382 +1,370 @@
 /*
- * 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
+ * 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
+ *     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.
+ * 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 javax.servlet;
+package jakarta.servlet;
 
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Locale;
 
-
 /**
  * Defines an object to assist a servlet in sending a response to the client.
  * The servlet container creates a <code>ServletResponse</code> object and
  * passes it as an argument to the servlet's <code>service</code> method.
- * <p/>
- * <p>To send binary data in a MIME body response, use
- * the {@link ServletOutputStream} returned by {@link #getOutputStream}.
- * To send character data, use the <code>PrintWriter</code> object
- * returned by {@link #getWriter}. To mix binary and text data,
- * for example, to create a multipart response, use a
- * <code>ServletOutputStream</code> and manage the character sections
- * manually.
- * <p/>
- * <p>The charset for the MIME body response can be specified
- * explicitly using the {@link #setCharacterEncoding} and
- * {@link #setContentType} methods, or implicitly
- * using the {@link #setLocale} method.
- * Explicit specifications take precedence over
- * implicit specifications. If no charset is specified, ISO-8859-1 will be
- * used. The <code>setCharacterEncoding</code>,
- * <code>setContentType</code>, or <code>setLocale</code> method must
- * be called before <code>getWriter</code> and before committing
- * the response for the character encoding to be used.
- * <p/>
- * <p>See the Internet RFCs such as
- * <a href="http://www.ietf.org/rfc/rfc2045.txt">
- * RFC 2045</a> for more information on MIME. Protocols such as SMTP
- * and HTTP define profiles of MIME, and those standards
- * are still evolving.
+ * <p>
+ * To send binary data in a MIME body response, use the
+ * {@link ServletOutputStream} returned by {@link #getOutputStream}. To send
+ * character data, use the <code>PrintWriter</code> object returned by
+ * {@link #getWriter}. To mix binary and text data, for example, to create a
+ * multipart response, use a <code>ServletOutputStream</code> and manage the
+ * character sections manually.
+ * <p>
+ * The charset for the MIME body response can be specified explicitly or
+ * implicitly. The priority order for specifying the response body is:
+ * <ol>
+ * <li>explicitly per request using {@link #setCharacterEncoding} and
+ *    {@link #setContentType}</li>
+ * <li>implicitly per request using {@link #setLocale}</li>
+ * <li>per web application via the deployment descriptor or
+ *     {@link ServletContext#setRequestCharacterEncoding(String)}</li>
+ * <li>container default via vendor specific configuration</li>
+ * <li>ISO-8859-1</li>
+ * </ol>
+ * The <code>setCharacterEncoding</code>, <code>setContentType</code>, or
+ * <code>setLocale</code> method must be called before <code>getWriter</code>
+ * and before committing the response for the character encoding to be used.
+ * <p>
+ * See the Internet RFCs such as <a href="http://www.ietf.org/rfc/rfc2045.txt">
+ * RFC 2045</a> for more information on MIME. Protocols such as SMTP and HTTP
+ * define profiles of MIME, and those standards are still evolving.
  *
- * @version $Rev$ $Date$
- * @see                ServletOutputStream
+ * @see ServletOutputStream
  */
-
 public interface ServletResponse {
 
     /**
-     * Forces any content in the buffer to be written to the client.  A call
-     * to this method automatically commits the response, meaning the status
-     * code and headers will be written.
+     * Returns the name of the character encoding (MIME charset) used for the
+     * body sent in this response.
+     * The charset for the MIME body response can be specified explicitly or
+     * implicitly. The priority order for specifying the response body is:
+     * <ol>
+     * <li>explicitly per request using {@link #setCharacterEncoding} and
+     *    {@link #setContentType}</li>
+     * <li>implicitly per request using {@link #setLocale}</li>
+     * <li>per web application via the deployment descriptor or
+     *     {@link ServletContext#setRequestCharacterEncoding(String)}</li>
+     * <li>container default via vendor specific configuration</li>
+     * <li>ISO-8859-1</li>
+     * </ol>
+     * Calls made to {@link #setCharacterEncoding}, {@link #setContentType} or
+     * {@link #setLocale} after <code>getWriter</code> has been called or after
+     * the response has been committed have no effect on the character encoding.
+     * If no character encoding has been specified, <code>ISO-8859-1</code> is
+     * returned.
+     * <p>
+     * See RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt) for more information
+     * about character encoding and MIME.
+     *
+     * @return a <code>String</code> specifying the name of the character
+     *         encoding, for example, <code>UTF-8</code>
+     */
+    public String getCharacterEncoding();
+
+    /**
+     * Returns the content type used for the MIME body sent in this response.
+     * The content type proper must have been specified using
+     * {@link #setContentType} before the response is committed. If no content
+     * type has been specified, this method returns null. If a content type has
+     * been specified and a character encoding has been explicitly or implicitly
+     * specified as described in {@link #getCharacterEncoding}, the charset
+     * parameter is included in the string returned. If no character encoding
+     * has been specified, the charset parameter is omitted.
      *
-     * @see #setBufferSize
-     * @see #getBufferSize
-     * @see #isCommitted
-     * @see #reset
+     * @return a <code>String</code> specifying the content type, for example,
+     *         <code>text/html; charset=UTF-8</code>, or null
+     * @since 2.4
      */
-    void flushBuffer() throws IOException;
+    public String getContentType();
 
     /**
-     * Returns the actual buffer size used for the response.  If no buffering
-     * is used, this method returns 0.
+     * Returns a {@link ServletOutputStream} suitable for writing binary data in
+     * the response. The servlet container does not encode the binary data.
+     * <p>
+     * Calling flush() on the ServletOutputStream commits the response. Either
+     * this method or {@link #getWriter} may be called to write the body, not
+     * both.
      *
-     * @return the actual buffer size used
-     * @see #setBufferSize
-     * @see #flushBuffer
-     * @see #isCommitted
-     * @see #reset
+     * @return a {@link ServletOutputStream} for writing binary data
+     * @exception IllegalStateException
+     *                if the <code>getWriter</code> method has been called on
+     *                this response
+     * @exception IOException
+     *                if an input or output exception occurred
+     * @see #getWriter
+     */
+    public ServletOutputStream getOutputStream() throws IOException;
+
+    /**
+     * Returns a <code>PrintWriter</code> object that can send character text to
+     * the client. The <code>PrintWriter</code> uses the character encoding
+     * returned by {@link #getCharacterEncoding}. If the response's character
+     * encoding has not been specified as described in
+     * <code>getCharacterEncoding</code> (i.e., the method just returns the
+     * default value <code>ISO-8859-1</code>), <code>getWriter</code> updates it
+     * to <code>ISO-8859-1</code>.
+     * <p>
+     * Calling flush() on the <code>PrintWriter</code> commits the response.
+     * <p>
+     * Either this method or {@link #getOutputStream} may be called to write the
+     * body, not both.
+     *
+     * @return a <code>PrintWriter</code> object that can return character data
+     *         to the client
+     * @exception java.io.UnsupportedEncodingException
+     *                if the character encoding returned by
+     *                <code>getCharacterEncoding</code> cannot be used
+     * @exception IllegalStateException
+     *                if the <code>getOutputStream</code> method has already
+     *                been called for this response object
+     * @exception IOException
+     *                if an input or output exception occurred
+     * @see #getOutputStream
+     * @see #setCharacterEncoding
      */
-    int getBufferSize();
+    public PrintWriter getWriter() throws IOException;
 
     /**
-     * Returns the name of the character encoding (MIME charset)
-     * used for the body sent in this response.
-     * The character encoding may have been specified explicitly
-     * using the {@link #setCharacterEncoding} or
-     * {@link #setContentType} methods, or implicitly using the
-     * {@link #setLocale} method. Explicit specifications take
-     * precedence over implicit specifications. Calls made
-     * to these methods after <code>getWriter</code> has been
-     * called or after the response has been committed have no
-     * effect on the character encoding. If no character encoding
-     * has been specified, <code>ISO-8859-1</code> is returned.
-     * <p>See RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)
-     * for more information about character encoding and MIME.
-     *
-     * @return a <code>String</code> specifying the
-     * name of the character encoding, for
-     * example, <code>UTF-8</code>
-     */
-    String getCharacterEncoding();
-
-    /**
-     * Returns the content type used for the MIME body
-     * sent in this response. The content type proper must
-     * have been specified using {@link #setContentType}
-     * before the response is committed. If no content type
-     * has been specified, this method returns null.
-     * If a content type has been specified and a
-     * character encoding has been explicitly or implicitly
-     * specified as described in {@link #getCharacterEncoding},
-     * the charset parameter is included in the string returned.
-     * If no character encoding has been specified, the
-     * charset parameter is omitted.
-     *
-     * @return a <code>String</code> specifying the
-     * content type, for example,
-     * <code>text/html; charset=UTF-8</code>,
-     * or null
+     * Sets the character encoding (MIME charset) of the response being sent to
+     * the client, for example, to UTF-8. If the character encoding has already
+     * been set by container default, ServletContext default,
+     * {@link #setContentType} or {@link #setLocale}, this method overrides it.
+     * Calling {@link #setContentType} with the <code>String</code> of
+     * <code>text/html</code> and calling this method with the
+     * <code>String</code> of <code>UTF-8</code> is equivalent with calling
+     * <code>setContentType</code> with the <code>String</code> of
+     * <code>text/html; charset=UTF-8</code>.
+     * <p>
+     * This method can be called repeatedly to change the character encoding.
+     * This method has no effect if it is called after <code>getWriter</code>
+     * has been called or after the response has been committed.
+     * <p>
+     * Containers must communicate the character encoding used for the servlet
+     * response's writer to the client if the protocol provides a way for doing
+     * so. In the case of HTTP, the character encoding is communicated as part
+     * of the <code>Content-Type</code> header for text media types. Note that
+     * the character encoding cannot be communicated via HTTP headers if the
+     * servlet does not specify a content type; however, it is still used to
+     * encode text written via the servlet response's writer.
+     *
+     * @param charset
+     *            a String specifying only the character set defined by IANA
+     *            Character Sets
+     *            (http://www.iana.org/assignments/character-sets)
+     * @see #setContentType #setLocale
      * @since 2.4
      */
-    String getContentType();
+    public void setCharacterEncoding(String charset);
 
     /**
-     * Returns the locale specified for this response
-     * using the {@link #setLocale} method. Calls made to
-     * <code>setLocale</code> after the response is committed
-     * have no effect. If no locale has been specified,
-     * the container's default locale is returned.
+     * Sets the length of the content body in the response In HTTP servlets,
+     * this method sets the HTTP Content-Length header.
      *
-     * @return locale specified for this response
-     * @see #setLocale
+     * @param len
+     *            an integer specifying the length of the content being returned
+     *            to the client; sets the Content-Length header
      */
-    Locale getLocale();
+    public void setContentLength(int len);
 
     /**
-     * Returns a {@link ServletOutputStream} suitable for writing binary
-     * data in the response. The servlet container does not encode the
-     * binary data.
-     * <p/>
-     * <p> Calling flush() on the ServletOutputStream commits the response.
-     * <p/>
-     * Either this method or {@link #getWriter} may
-     * be called to write the body, not both.
-     *
-     * @throws IllegalStateException if the <code>getWriter</code> method
-     *                               has been called on this response
-     * @throws IOException           if an input or output exception occurred
-     * @return a {@link ServletOutputStream} for writing binary data
-     * @see #getWriter
+     * Sets the length of the content body in the response In HTTP servlets,
+     * this method sets the HTTP Content-Length header.
+     *
+     * @param length
+     *            an integer specifying the length of the content being returned
+     *            to the client; sets the Content-Length header
+     *
+     * @since Servlet 3.1
      */
-    ServletOutputStream getOutputStream() throws IOException;
+    public void setContentLengthLong(long length);
 
     /**
-     * Returns a <code>PrintWriter</code> object that
-     * can send character text to the client.
-     * The <code>PrintWriter</code> uses the character
-     * encoding returned by {@link #getCharacterEncoding}.
-     * If the response's character encoding has not been
-     * specified as described in <code>getCharacterEncoding</code>
-     * (i.e., the method just returns the default value
-     * <code>ISO-8859-1</code>), <code>getWriter</code>
-     * updates it to <code>ISO-8859-1</code>.
-     * <p>Calling flush() on the <code>PrintWriter</code>
-     * commits the response.
-     * <p>Either this method or {@link #getOutputStream} may be called
-     * to write the body, not both.
-     *
-     * @return a <code>PrintWriter</code> object that
-     *         can return character data to the client
-     * @throws java.io.UnsupportedEncodingException
-     *                               if the character encoding returned
-     *                               by <code>getCharacterEncoding</code> cannot be used
-     * @throws IllegalStateException if the <code>getOutputStream</code>
-     *                               method has already been called for this
-     *                               response object
-     * @throws IOException           if an input or output exception occurred
-     * @see #getOutputStream
+     * Sets the content type of the response being sent to the client, if the
+     * response has not been committed yet. The given content type may include a
+     * character encoding specification, for example,
+     * <code>text/html;charset=UTF-8</code>. The response's character encoding
+     * is only set from the given content type if this method is called before
+     * <code>getWriter</code> is called.
+     * <p>
+     * This method may be called repeatedly to change content type and character
+     * encoding. This method has no effect if called after the response has been
+     * committed. It does not set the response's character encoding if it is
+     * called after <code>getWriter</code> has been called or after the response
+     * has been committed.
+     * <p>
+     * Containers must communicate the content type and the character encoding
+     * used for the servlet response's writer to the client if the protocol
+     * provides a way for doing so. In the case of HTTP, the
+     * <code>Content-Type</code> header is used.
+     *
+     * @param type
+     *            a <code>String</code> specifying the MIME type of the content
+     * @see #setLocale
      * @see #setCharacterEncoding
+     * @see #getOutputStream
+     * @see #getWriter
      */
-    PrintWriter getWriter() throws IOException;
+    public void setContentType(String type);
 
     /**
-     * Returns a boolean indicating if the response has been
-     * committed.  A committed response has already had its status
-     * code and headers written.
-     *
-     * @return a boolean indicating if the response has been
-     * committed
-     * @see #setBufferSize
+     * Sets the preferred buffer size for the body of the response. The servlet
+     * container will use a buffer at least as large as the size requested. The
+     * actual buffer size used can be found using <code>getBufferSize</code>.
+     * <p>
+     * A larger buffer allows more content to be written before anything is
+     * actually sent, thus providing the servlet with more time to set
+     * appropriate status codes and headers. A smaller buffer decreases server
+     * memory load and allows the client to start receiving data more quickly.
+     * <p>
+     * This method must be called before any response body content is written;
+     * if content has been written or the response object has been committed,
+     * this method throws an <code>IllegalStateException</code>.
+     *
+     * @param size
+     *            the preferred buffer size
+     * @exception IllegalStateException
+     *                if this method is called after content has been written
      * @see #getBufferSize
      * @see #flushBuffer
+     * @see #isCommitted
      * @see #reset
      */
-    boolean isCommitted();
+    public void setBufferSize(int size);
 
     /**
-     * Clears any data that exists in the buffer as well as the status code and
-     * headers.  If the response has been committed, this method throws an
-     * <code>IllegalStateException</code>.
+     * Returns the actual buffer size used for the response. If no buffering is
+     * used, this method returns 0.
      *
-     * @throws IllegalStateException if the response has already been
-     *                               committed
+     * @return the actual buffer size used
      * @see #setBufferSize
-     * @see #getBufferSize
      * @see #flushBuffer
      * @see #isCommitted
+     * @see #reset
      */
-    void reset();
+    public int getBufferSize();
 
     /**
-     * Clears the content of the underlying buffer in the response without
-     * clearing headers or status code. If the
-     * response has been committed, this method throws an
-     * <code>IllegalStateException</code>.
+     * Forces any content in the buffer to be written to the client. A call to
+     * this method automatically commits the response, meaning the status code
+     * and headers will be written.
+     *
+     * @throws IOException if an I/O occurs during the flushing of the response
      *
      * @see #setBufferSize
      * @see #getBufferSize
      * @see #isCommitted
      * @see #reset
-     * @since 2.3
      */
-    void resetBuffer();
+    public void flushBuffer() throws IOException;
 
     /**
-     * Sets the preferred buffer size for the body of the response.
-     * The servlet container will use a buffer at least as large as
-     * the size requested.  The actual buffer size used can be found
-     * using <code>getBufferSize</code>.
-     * <p/>
-     * <p>A larger buffer allows more content to be written before anything is
-     * actually sent, thus providing the servlet with more time to set
-     * appropriate status codes and headers.  A smaller buffer decreases
-     * server memory load and allows the client to start receiving data more
-     * quickly.
-     * <p/>
-     * <p>This method must be called before any response body content is
-     * written; if content has been written or the response object has
-     * been committed, this method throws an
-     * <code>IllegalStateException</code>.
+     * Clears the content of the underlying buffer in the response without
+     * clearing headers or status code. If the response has been committed, this
+     * method throws an <code>IllegalStateException</code>.
      *
-     * @param size the preferred buffer size
-     * @throws IllegalStateException if this method is called after
-     *                               content has been written
+     * @see #setBufferSize
      * @see #getBufferSize
-     * @see #flushBuffer
      * @see #isCommitted
      * @see #reset
+     * @since 2.3
      */
-    void setBufferSize(int size);
-
-    /**
-     * Sets the character encoding (MIME charset) of the response
-     * being sent to the client, for example, to UTF-8.
-     * If the character encoding has already been set by
-     * {@link #setContentType} or {@link #setLocale},
-     * this method overrides it.
-     * Calling {@link #setContentType} with the <code>String</code>
-     * of <code>text/html</code> and calling
-     * this method with the <code>String</code> of <code>UTF-8</code>
-     * is equivalent with calling
-     * <code>setContentType</code> with the <code>String</code> of
-     * <code>text/html; charset=UTF-8</code>.
-     * <p>This method can be called repeatedly to change the character
-     * encoding.
-     * This method has no effect if it is called after
-     * <code>getWriter</code> has been
-     * called or after the response has been committed.
-     * <p>Containers must communicate the character encoding used for
-     * the servlet response's writer to the client if the protocol
-     * provides a way for doing so. In the case of HTTP, the character
-     * encoding is communicated as part of the <code>Content-Type</code>
-     * header for text media types. Note that the character encoding
-     * cannot be communicated via HTTP headers if the servlet does not
-     * specify a content type; however, it is still used to encode text
-     * written via the servlet response's writer.
-     *
-     * @param charset a String specifying only the character set
-     *                defined by IANA Character Sets
-     *                (http://www.iana.org/assignments/character-sets)
-     * @see                #setContentType #setLocale
-     * @since 2.4
-     */
-    void setCharacterEncoding(String charset);
+    public void resetBuffer();
 
     /**
-     * Sets the length of the content body in the response
-     * In HTTP servlets, this method sets the HTTP Content-Length header.
+     * Returns a boolean indicating if the response has been committed. A
+     * committed response has already had its status code and headers written.
      *
-     * @param len an integer specifying the length of the
-     *            content being returned to the client; sets
-     *            the Content-Length header
-     */
-    void setContentLength(int len);
-
-    /**
-     * Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length
-     * header.
-     * 
-     * @param len
-     *            - a long specifying the length of the content being returned to the client; sets the Content-Length
-     *            header
-     * @since Servlet 3.1
+     * @return a boolean indicating if the response has been committed
+     * @see #setBufferSize
+     * @see #getBufferSize
+     * @see #flushBuffer
+     * @see #reset
      */
-    void setContentLengthLong(long len);
+    public boolean isCommitted();
 
     /**
-     * Sets the content type of the response being sent to
-     * the client, if the response has not been committed yet.
-     * The given content type may include a character encoding
-     * specification, for example, <code>text/html;charset=UTF-8</code>.
-     * The response's character encoding is only set from the given
-     * content type if this method is called before <code>getWriter</code>
-     * is called.
-     * <p>This method may be called repeatedly to change content type and
-     * character encoding.
-     * This method has no effect if called after the response
-     * has been committed. It does not set the response's character
-     * encoding if it is called after <code>getWriter</code>
-     * has been called or after the response has been committed.
-     * <p>Containers must communicate the content type and the character
-     * encoding used for the servlet response's writer to the client if
-     * the protocol provides a way for doing so. In the case of HTTP,
-     * the <code>Content-Type</code> header is used.
+     * Clears any data that exists in the buffer as well as the status code and
+     * headers. If the response has been committed, this method throws an
+     * <code>IllegalStateException</code>.
      *
-     * @param type a <code>String</code> specifying the MIME
-     *             type of the content
-     * @see #setLocale
-     * @see #setCharacterEncoding
-     * @see #getOutputStream
-     * @see #getWriter
+     * @exception IllegalStateException
+     *                if the response has already been committed
+     * @see #setBufferSize
+     * @see #getBufferSize
+     * @see #flushBuffer
+     * @see #isCommitted
      */
-    void setContentType(String type);
-
+    public void reset();
 
     /**
-     * Sets the locale of the response, if the response has not been
-     * committed yet. It also sets the response's character encoding
-     * appropriately for the locale, if the character encoding has not
-     * been explicitly set using {@link #setContentType} or
-     * {@link #setCharacterEncoding}, <code>getWriter</code> hasn't
-     * been called yet, and the response hasn't been committed yet.
-     * If the deployment descriptor contains a
-     * <code>locale-encoding-mapping-list</code> element, and that
-     * element provides a mapping for the given locale, that mapping
-     * is used. Otherwise, the mapping from locale to character
-     * encoding is container dependent.
-     * <p>This method may be called repeatedly to change locale and
-     * character encoding. The method has no effect if called after the
-     * response has been committed. It does not set the response's
-     * character encoding if it is called after {@link #setContentType}
-     * has been called with a charset specification, after
-     * {@link #setCharacterEncoding} has been called, after
-     * <code>getWriter</code> has been called, or after the response
-     * has been committed.
-     * <p>Containers must communicate the locale and the character encoding
-     * used for the servlet response's writer to the client if the protocol
-     * provides a way for doing so. In the case of HTTP, the locale is
-     * communicated via the <code>Content-Language</code> header,
-     * the character encoding as part of the <code>Content-Type</code>
-     * header for text media types. Note that the character encoding
-     * cannot be communicated via HTTP headers if the servlet does not
-     * specify a content type; however, it is still used to encode text
-     * written via the servlet response's writer.
+     * Sets the locale of the response, if the response has not been committed
+     * yet. It also sets the response's character encoding appropriately for the
+     * locale, if the character encoding has not been explicitly set using
+     * {@link #setContentType} or {@link #setCharacterEncoding},
+     * <code>getWriter</code> hasn't been called yet, and the response hasn't
+     * been committed yet. If the deployment descriptor contains a
+     * <code>locale-encoding-mapping-list</code> element, and that element
+     * provides a mapping for the given locale, that mapping is used. Otherwise,
+     * the mapping from locale to character encoding is container dependent.
+     * <p>
+     * This method may be called repeatedly to change locale and character
+     * encoding. The method has no effect if called after the response has been
+     * committed. It does not set the response's character encoding if it is
+     * called after {@link #setContentType} has been called with a charset
+     * specification, after {@link #setCharacterEncoding} has been called, after
+     * <code>getWriter</code> has been called, or after the response has been
+     * committed.
+     * <p>
+     * Containers must communicate the locale and the character encoding used
+     * for the servlet response's writer to the client if the protocol provides
+     * a way for doing so. In the case of HTTP, the locale is communicated via
+     * the <code>Content-Language</code> header, the character encoding as part
+     * of the <code>Content-Type</code> header for text media types. Note that
+     * the character encoding cannot be communicated via HTTP headers if the
+     * servlet does not specify a content type; however, it is still used to
+     * encode text written via the servlet response's writer.
      *
-     * @param loc the locale of the response
+     * @param loc
+     *            the locale of the response
      * @see #getLocale
      * @see #setContentType
      * @see #setCharacterEncoding
      */
-    void setLocale(Locale loc);
-}
-
-
-
+    public void setLocale(Locale loc);
 
+    /**
+     * Returns the locale specified for this response using the
+     * {@link #setLocale} method. Calls made to <code>setLocale</code> after the
+     * response is committed have no effect.
+     *
+     * @return The locale specified for this response using the
+     *          {@link #setLocale} method. If no locale has been specified, the
+     *          container's default locale is returned.
+     *
+     * @see #setLocale
+     */
+    public Locale getLocale();
 
+}

Modified: geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletResponseWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletResponseWrapper.java?rev=1858615&r1=1858614&r2=1858615&view=diff
==============================================================================
--- geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletResponseWrapper.java (original)
+++ geronimo/specs/branches/jakarta/geronimo-jakarta-servlet_spec/src/main/java/jakarta/servlet/ServletResponseWrapper.java Sat May  4 21:29:39 2019
@@ -1,27 +1,25 @@
 /*
- * 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
+ * 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
+ *     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.
+ * 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 javax.servlet;
+package jakarta.servlet;
 
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Locale;
+import java.util.ResourceBundle;
 
 /**
  * Provides a convenient implementation of the ServletResponse interface that
@@ -29,24 +27,27 @@ import java.util.Locale;
  * This class implements the Wrapper or Decorator pattern. Methods default to
  * calling through to the wrapped response object.
  *
- * @version $Rev$ $Date$
- * @see javax.servlet.ServletResponse
  * @since v 2.3
+ * @see javax.servlet.ServletResponse
  */
-
 public class ServletResponseWrapper implements ServletResponse {
+    private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
+    private static final ResourceBundle lStrings =
+        ResourceBundle.getBundle(LSTRING_FILE);
+
     private ServletResponse response;
 
     /**
      * Creates a ServletResponse adaptor wrapping the given response object.
      *
-     * @param response response to wrap
+     * @param response The response to wrap
+     *
      * @throws java.lang.IllegalArgumentException
-     *          if the response is null.
+     *             if the response is null.
      */
     public ServletResponseWrapper(ServletResponse response) {
         if (response == null) {
-            throw new IllegalArgumentException("Response cannot be null");
+            throw new IllegalArgumentException(lStrings.getString("wrapper.nullResponse"));
         }
         this.response = response;
     }
@@ -54,7 +55,7 @@ public class ServletResponseWrapper impl
     /**
      * Return the wrapped ServletResponse object.
      *
-     * @return wrapped response
+     * @return The wrapped ServletResponse object.
      */
     public ServletResponse getResponse() {
         return this.response;
@@ -63,23 +64,25 @@ public class ServletResponseWrapper impl
     /**
      * Sets the response being wrapped.
      *
-     * @param response response to wrap
+     * @param response The new response to wrap
+     *
      * @throws java.lang.IllegalArgumentException
-     *          if the response is null.
+     *             if the response is null.
      */
     public void setResponse(ServletResponse response) {
         if (response == null) {
-            throw new IllegalArgumentException("Response cannot be null");
+            throw new IllegalArgumentException(lStrings.getString("wrapper.nullResponse"));
         }
         this.response = response;
     }
 
     /**
-     * The default behavior of this method is to call setCharacterEncoding(String charset)
-     * on the wrapped response object.
+     * The default behavior of this method is to call
+     * setCharacterEncoding(String charset) on the wrapped response object.
      *
      * @since 2.4
      */
+    @Override
     public void setCharacterEncoding(String charset) {
         this.response.setCharacterEncoding(charset);
     }
@@ -88,22 +91,25 @@ public class ServletResponseWrapper impl
      * The default behavior of this method is to return getCharacterEncoding()
      * on the wrapped response object.
      */
+    @Override
     public String getCharacterEncoding() {
         return this.response.getCharacterEncoding();
     }
 
     /**
-     * The default behavior of this method is to return getOutputStream()
-     * on the wrapped response object.
+     * The default behavior of this method is to return getOutputStream() on the
+     * wrapped response object.
      */
+    @Override
     public ServletOutputStream getOutputStream() throws IOException {
         return this.response.getOutputStream();
     }
 
     /**
-     * The default behavior of this method is to return getWriter()
-     * on the wrapped response object.
+     * The default behavior of this method is to return getWriter() on the
+     * wrapped response object.
      */
+    @Override
     public PrintWriter getWriter() throws IOException {
         return this.response.getWriter();
     }
@@ -112,126 +118,149 @@ public class ServletResponseWrapper impl
      * The default behavior of this method is to call setContentLength(int len)
      * on the wrapped response object.
      */
+    @Override
     public void setContentLength(int len) {
         this.response.setContentLength(len);
     }
 
     /**
-     * The default behavior of this method is to call setContentLengthLong(long len) on the wrapped response object.
-     * @param len - a long specifying the length of the content being returned to the client; sets the Content-Length header
+     * The default behavior of this method is to call setContentLengthLong(long len)
+     * on the wrapped response object.
+     *
      * @since Servlet 3.1
      */
     @Override
-    public void setContentLengthLong(long len) {
-        this.response.setContentLengthLong(len);
+    public void setContentLengthLong(long length) {
+        this.response.setContentLengthLong(length);
     }
 
     /**
-     * The default behavior of this method is to call setContentType(String type)
-     * on the wrapped response object.
+     * The default behavior of this method is to call setContentType(String
+     * type) on the wrapped response object.
      */
+    @Override
     public void setContentType(String type) {
         this.response.setContentType(type);
     }
 
     /**
-     * The default behavior of this method is to return getContentType()
-     * on the wrapped response object.
+     * The default behavior of this method is to return getContentType() on the
+     * wrapped response object.
      *
      * @since 2.4
      */
+    @Override
     public String getContentType() {
         return this.response.getContentType();
     }
 
     /**
-     * The default behavior of this method is to call setBufferSize(int size)
-     * on the wrapped response object.
+     * The default behavior of this method is to call setBufferSize(int size) on
+     * the wrapped response object.
      */
+    @Override
     public void setBufferSize(int size) {
         this.response.setBufferSize(size);
     }
 
     /**
-     * The default behavior of this method is to return getBufferSize()
-     * on the wrapped response object.
+     * The default behavior of this method is to return getBufferSize() on the
+     * wrapped response object.
      */
+    @Override
     public int getBufferSize() {
         return this.response.getBufferSize();
     }
 
     /**
-     * The default behavior of this method is to call flushBuffer()
-     * on the wrapped response object.
+     * The default behavior of this method is to call flushBuffer() on the
+     * wrapped response object.
      */
+    @Override
     public void flushBuffer() throws IOException {
         this.response.flushBuffer();
     }
 
     /**
-     * The default behavior of this method is to return isCommitted()
-     * on the wrapped response object.
+     * The default behavior of this method is to return isCommitted() on the
+     * wrapped response object.
      */
+    @Override
     public boolean isCommitted() {
         return this.response.isCommitted();
     }
 
     /**
-     * The default behavior of this method is to call reset()
-     * on the wrapped response object.
+     * The default behavior of this method is to call reset() on the wrapped
+     * response object.
      */
+    @Override
     public void reset() {
         this.response.reset();
     }
 
     /**
-     * The default behavior of this method is to call resetBuffer()
-     * on the wrapped response object.
+     * The default behavior of this method is to call resetBuffer() on the
+     * wrapped response object.
      */
+    @Override
     public void resetBuffer() {
         this.response.resetBuffer();
     }
 
     /**
-     * The default behavior of this method is to call setLocale(Locale loc)
-     * on the wrapped response object.
+     * The default behavior of this method is to call setLocale(Locale loc) on
+     * the wrapped response object.
      */
+    @Override
     public void setLocale(Locale loc) {
         this.response.setLocale(loc);
     }
 
     /**
-     * The default behavior of this method is to return getLocale()
-     * on the wrapped response object.
+     * The default behavior of this method is to return getLocale() on the
+     * wrapped response object.
      */
+    @Override
     public Locale getLocale() {
         return this.response.getLocale();
     }
 
-    public boolean isWrapperFor(Class wrappedType) {
-        if (this.response.getClass().isAssignableFrom(wrappedType)) {
+    /**
+     * TODO SERVLET3 - Add comments
+     * @param wrapped The response to compare to the wrapped response
+     * @return <code>true</code> if the response wrapped by this wrapper (or
+     *         series of wrappers) is the same as the supplied response,
+     *         otherwise <code>false</code>
+     * @since Servlet 3.0
+     */
+    public boolean isWrapperFor(ServletResponse wrapped) {
+        if (response == wrapped) {
             return true;
         }
-        if (this.response instanceof ServletResponseWrapper) {
-            return ((ServletResponseWrapper)this.response).isWrapperFor(wrappedType);
+        if (response instanceof ServletResponseWrapper) {
+            return ((ServletResponseWrapper) response).isWrapperFor(wrapped);
         }
         return false;
     }
 
-    public boolean isWrapperFor(ServletResponse instance) {
-        if (instance == this.response) {
+    /**
+     * TODO SERVLET3 - Add comments
+     * @param wrappedType The class to compare to the class of the wrapped
+     *                    response
+     * @return <code>true</code> if the response wrapped by this wrapper (or
+     *         series of wrappers) is the same type as the supplied type,
+     *         otherwise <code>false</code>
+     * @since Servlet 3.0
+     */
+    public boolean isWrapperFor(Class<?> wrappedType) {
+        if (wrappedType.isAssignableFrom(response.getClass())) {
             return true;
         }
-        if (this.response instanceof ServletResponseWrapper) {
-            return ((ServletResponseWrapper)this.response).isWrapperFor(instance);
+        if (response instanceof ServletResponseWrapper) {
+            return ((ServletResponseWrapper) response).isWrapperFor(wrappedType);
         }
         return false;
     }
 
-
 }
-
-
-
-
-



Mime
View raw message