You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/02/13 17:14:58 UTC
[tomcat] branch main updated: Code clean-up (reformatting) - no functional change
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 398066626c Code clean-up (reformatting) - no functional change
398066626c is described below
commit 398066626ce7d278cbc1b44f3b24c175aa3c0341
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Feb 13 17:14:50 2023 +0000
Code clean-up (reformatting) - no functional change
---
java/jakarta/servlet/http/Cookie.java | 195 +++----
java/jakarta/servlet/http/HttpFilter.java | 66 +--
java/jakarta/servlet/http/HttpServlet.java | 587 +++++++--------------
java/jakarta/servlet/http/HttpServletMapping.java | 14 +-
java/jakarta/servlet/http/HttpServletRequest.java | 492 ++++++++---------
.../servlet/http/HttpServletRequestWrapper.java | 153 ++----
java/jakarta/servlet/http/HttpServletResponse.java | 439 +++++++--------
.../servlet/http/HttpServletResponseWrapper.java | 92 ++--
java/jakarta/servlet/http/HttpSession.java | 213 ++++----
.../http/HttpSessionActivationListener.java | 14 +-
.../servlet/http/HttpSessionAttributeListener.java | 19 +-
.../servlet/http/HttpSessionBindingEvent.java | 62 +--
.../servlet/http/HttpSessionBindingListener.java | 26 +-
java/jakarta/servlet/http/HttpSessionEvent.java | 5 +-
.../servlet/http/HttpSessionIdListener.java | 12 +-
java/jakarta/servlet/http/HttpSessionListener.java | 20 +-
java/jakarta/servlet/http/HttpUpgradeHandler.java | 9 +-
java/jakarta/servlet/http/MappingMatch.java | 9 +-
java/jakarta/servlet/http/Part.java | 77 ++-
java/jakarta/servlet/http/PushBuilder.java | 97 ++--
java/jakarta/servlet/http/WebConnection.java | 9 +-
21 files changed, 1038 insertions(+), 1572 deletions(-)
diff --git a/java/jakarta/servlet/http/Cookie.java b/java/jakarta/servlet/http/Cookie.java
index 49b7d5f269..f3c4446859 100644
--- a/java/jakarta/servlet/http/Cookie.java
+++ b/java/jakarta/servlet/http/Cookie.java
@@ -26,30 +26,24 @@ import java.util.ResourceBundle;
import java.util.TreeMap;
/**
- * Creates a cookie, a small amount of information sent by a servlet to a Web
- * browser, saved by the browser, and later sent back to the server. A cookie's
- * value can uniquely identify a client, so cookies are commonly used for
- * session management.
+ * Creates a cookie, a small amount of information sent by a servlet to a Web browser, saved by the browser, and later
+ * sent back to the server. A cookie's value can uniquely identify a client, so cookies are commonly used for session
+ * management.
* <p>
- * A cookie has a name, a single value, and optional attributes such as a
- * comment, path and domain qualifiers, a maximum age, and a version number.
- * Some Web browsers have bugs in how they handle the optional attributes, so
- * use them sparingly to improve the interoperability of your servlets.
+ * A cookie has a name, a single value, and optional attributes such as a comment, path and domain qualifiers, a maximum
+ * age, and a version number. Some Web browsers have bugs in how they handle the optional attributes, so use them
+ * sparingly to improve the interoperability of your servlets.
* <p>
- * The servlet sends cookies to the browser by using the
- * {@link HttpServletResponse#addCookie} method, which adds fields to HTTP
- * response headers to send cookies to the browser, one at a time. The browser
- * is expected to support 20 cookies for each Web server, 300 cookies total, and
- * may limit cookie size to 4 KB each.
+ * The servlet sends cookies to the browser by using the {@link HttpServletResponse#addCookie} method, which adds fields
+ * to HTTP response headers to send cookies to the browser, one at a time. The browser is expected to support 20 cookies
+ * for each Web server, 300 cookies total, and may limit cookie size to 4 KB each.
* <p>
- * The browser returns cookies to the servlet by adding fields to HTTP request
- * headers. Cookies can be retrieved from a request by using the
- * {@link HttpServletRequest#getCookies} method. Several cookies might have the
- * same name but different path attributes.
+ * The browser returns cookies to the servlet by adding fields to HTTP request headers. Cookies can be retrieved from a
+ * request by using the {@link HttpServletRequest#getCookies} method. Several cookies might have the same name but
+ * different path attributes.
* <p>
- * Cookies affect the caching of the Web pages that use them. HTTP 1.0 does not
- * cache pages that use cookies created with this class. This class does not
- * support the cache control defined with HTTP 1.1.
+ * Cookies affect the caching of the Web pages that use them. HTTP 1.0 does not cache pages that use cookies created
+ * with this class. This class does not support the cache control defined with HTTP 1.1.
* <p>
* This class supports both the RFC 6265 specification.
*/
@@ -75,7 +69,7 @@ public class Cookie implements Cloneable, Serializable {
/**
* Attributes encoded in the header's cookie fields.
*/
- private volatile Map<String,String> attributes;
+ private volatile Map<String, String> attributes;
private static final String DOMAIN = "Domain";
private static final String MAX_AGE = "Max-Age";
@@ -88,16 +82,14 @@ public class Cookie implements Cloneable, Serializable {
* <p>
* The cookie's name cannot be changed after creation.
* <p>
- * The value can be anything the server chooses to send. Its value is
- * probably of interest only to the server. The cookie's value can be
- * changed after creation with the <code>setValue</code> method.
- *
- * @param name
- * a <code>String</code> specifying the name of the cookie
- * @param value
- * a <code>String</code> specifying the value of the cookie
- * @throws IllegalArgumentException
- * if the cookie name contains illegal characters
+ * The value can be anything the server chooses to send. Its value is probably of interest only to the server. The
+ * cookie's value can be changed after creation with the <code>setValue</code> method.
+ *
+ * @param name a <code>String</code> specifying the name of the cookie
+ * @param value a <code>String</code> specifying the value of the cookie
+ *
+ * @throws IllegalArgumentException if the cookie name contains illegal characters
+ *
* @see #setValue
*/
public Cookie(String name, String value) {
@@ -110,7 +102,7 @@ public class Cookie implements Cloneable, Serializable {
/**
* If called, this method has no effect.
*
- * @param purpose ignored
+ * @param purpose ignored
*
* @see #getComment
*
@@ -142,9 +134,8 @@ public class Cookie implements Cloneable, Serializable {
* <p>
* By default, cookies are only returned to the server that sent them.
*
- * @param pattern
- * a <code>String</code> containing the domain name within which
- * this cookie is visible
+ * @param pattern a <code>String</code> containing the domain name within which this cookie is visible
+ *
* @see #getDomain
*/
public void setDomain(String pattern) {
@@ -161,6 +152,7 @@ public class Cookie implements Cloneable, Serializable {
* Returns the domain name set for this cookie.
*
* @return a <code>String</code> containing the domain name
+ *
* @see #setDomain
*/
public String getDomain() {
@@ -171,18 +163,15 @@ public class Cookie implements Cloneable, Serializable {
/**
* Sets the maximum age of the cookie in seconds.
* <p>
- * A positive value indicates that the cookie will expire after that many
- * seconds have passed. Note that the value is the <i>maximum</i> age when
- * the cookie will expire, not the cookie's current age.
+ * A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value
+ * is the <i>maximum</i> age when the cookie will expire, not the cookie's current age.
* <p>
- * A negative value means that the cookie is not stored persistently and
- * will be deleted when the Web browser exits. A zero value causes the
- * cookie to be deleted.
- *
- * @param expiry
- * an integer specifying the maximum age of the cookie in
- * seconds; if negative, means the cookie is not stored; if zero,
- * deletes the cookie
+ * A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits.
+ * A zero value causes the cookie to be deleted.
+ *
+ * @param expiry an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie is
+ * not stored; if zero, deletes the cookie
+ *
* @see #getMaxAge
*/
public void setMaxAge(int expiry) {
@@ -191,12 +180,12 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Returns the maximum age of the cookie, specified in seconds, By default,
- * <code>-1</code> indicating the cookie will persist until browser
- * shutdown.
+ * Returns the maximum age of the cookie, specified in seconds, By default, <code>-1</code> indicating the cookie
+ * will persist until browser shutdown.
+ *
+ * @return an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie persists
+ * until browser shutdown
*
- * @return an integer specifying the maximum age of the cookie in seconds; if
- * negative, means the cookie persists until browser shutdown
* @see #setMaxAge
*/
public int getMaxAge() {
@@ -210,17 +199,14 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Specifies a path for the cookie to which the client should return the
- * cookie.
+ * Specifies a path for the cookie to which the client should return the cookie.
* <p>
- * The cookie is visible to all the pages in the directory you specify, and
- * all the pages in that directory's subdirectories. A cookie's path must
- * include the servlet that set the cookie, for example, <i>/catalog</i>,
- * which makes the cookie visible to all directories on the server under
- * <i>/catalog</i>.
- *
- * @param uri
- * a <code>String</code> specifying a path
+ * The cookie is visible to all the pages in the directory you specify, and all the pages in that directory's
+ * subdirectories. A cookie's path must include the servlet that set the cookie, for example, <i>/catalog</i>, which
+ * makes the cookie visible to all directories on the server under <i>/catalog</i>.
+ *
+ * @param uri a <code>String</code> specifying a path
+ *
* @see #getPath
*/
public void setPath(String uri) {
@@ -229,11 +215,11 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Returns the path on the server to which the browser returns this cookie.
- * The cookie is visible to all subpaths on the server.
+ * Returns the path on the server to which the browser returns this cookie. The cookie is visible to all subpaths on
+ * the server.
+ *
+ * @return a <code>String</code> specifying a path that contains a servlet name, for example, <i>/catalog</i>
*
- * @return a <code>String</code> specifying a path that contains a servlet
- * name, for example, <i>/catalog</i>
* @see #setPath
*/
public String getPath() {
@@ -242,15 +228,13 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Indicates to the browser whether the cookie should only be sent using a
- * secure protocol, such as HTTPS or SSL.
+ * Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.
* <p>
* The default value is <code>false</code>.
*
- * @param flag
- * if <code>true</code>, sends the cookie from the browser to the
- * server only when using a secure protocol; if
- * <code>false</code>, sent on any protocol
+ * @param flag if <code>true</code>, sends the cookie from the browser to the server only when using a secure
+ * protocol; if <code>false</code>, sent on any protocol
+ *
* @see #getSecure
*/
public void setSecure(boolean flag) {
@@ -259,12 +243,11 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Returns <code>true</code> if the browser is sending cookies only over a
- * secure protocol, or <code>false</code> if the browser can send cookies
- * using any protocol.
+ * Returns <code>true</code> if the browser is sending cookies only over a secure protocol, or <code>false</code> if
+ * the browser can send cookies using any protocol.
+ *
+ * @return <code>true</code> if the browser uses a secure protocol; otherwise, <code>false</code>
*
- * @return <code>true</code> if the browser uses a secure protocol;
- * otherwise, <code>false</code>
* @see #setSecure
*/
public boolean getSecure() {
@@ -273,8 +256,7 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Returns the name of the cookie. The name cannot be changed after
- * creation.
+ * Returns the name of the cookie. The name cannot be changed after creation.
*
* @return a <code>String</code> specifying the cookie's name
*/
@@ -284,16 +266,15 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Assigns a new value to a cookie after the cookie is created. If you use a
- * binary value, you may want to use BASE64 encoding.
+ * Assigns a new value to a cookie after the cookie is created. If you use a binary value, you may want to use
+ * BASE64 encoding.
* <p>
- * With Version 0 cookies, values should not contain white space, brackets,
- * parentheses, equals signs, commas, double quotes, slashes, question
- * marks, at signs, colons, and semicolons. Empty values may not behave the
- * same way on all browsers.
+ * With Version 0 cookies, values should not contain white space, brackets, parentheses, equals signs, commas,
+ * double quotes, slashes, question marks, at signs, colons, and semicolons. Empty values may not behave the same
+ * way on all browsers.
+ *
+ * @param newValue a <code>String</code> specifying the new value
*
- * @param newValue
- * a <code>String</code> specifying the new value
* @see #getValue
* @see Cookie
*/
@@ -306,6 +287,7 @@ public class Cookie implements Cloneable, Serializable {
* Returns the value of the cookie.
*
* @return a <code>String</code> containing the cookie's present value
+ *
* @see #setValue
* @see Cookie
*/
@@ -345,8 +327,7 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Overrides the standard <code>java.lang.Object.clone</code> method to
- * return a copy of this cookie.
+ * Overrides the standard <code>java.lang.Object.clone</code> method to return a copy of this cookie.
*/
@Override
public Object clone() {
@@ -359,10 +340,9 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Sets the flag that controls if this cookie will be hidden from scripts on
- * the client side.
+ * Sets the flag that controls if this cookie will be hidden from scripts on the client side.
*
- * @param httpOnly The new value of the flag
+ * @param httpOnly The new value of the flag
*
* @since Servlet 3.0
*/
@@ -372,11 +352,10 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Gets the flag that controls if this cookie will be hidden from scripts on
- * the client side.
+ * Gets the flag that controls if this cookie will be hidden from scripts on the client side.
+ *
+ * @return <code>true</code> if the cookie is hidden from scripts, else <code>false</code>
*
- * @return <code>true</code> if the cookie is hidden from scripts, else
- * <code>false</code>
* @since Servlet 3.0
*/
public boolean isHttpOnly() {
@@ -385,18 +364,16 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Sets the value for the given cookie attribute. When a value is set via
- * this method, the value returned by the attribute specific getter (if any)
- * must be consistent with the value set via this method.
+ * Sets the value for the given cookie attribute. When a value is set via this method, the value returned by the
+ * attribute specific getter (if any) must be consistent with the value set via this method.
*
* @param name Name of attribute to set
* @param value Value of attribute
*
- * @throws IllegalArgumentException If the attribute name is null or
- * contains any characters not permitted for use in Cookie names.
- *
- * @throws NumberFormatException If the attribute is known to be numerical
- * but the provided value cannot be parsed to a number.
+ * @throws IllegalArgumentException If the attribute name is null or contains any characters not permitted for use
+ * in Cookie names.
+ * @throws NumberFormatException If the attribute is known to be numerical but the provided value cannot be
+ * parsed to a number.
*
* @since Servlet 6.0
*/
@@ -437,11 +414,10 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Obtain the value for a given attribute. Values returned from this method
- * must be consistent with the values set and returned by the attribute
- * specific getters and setters in this class.
+ * Obtain the value for a given attribute. Values returned from this method must be consistent with the values set
+ * and returned by the attribute specific getters and setters in this class.
*
- * @param name Name of attribute to return
+ * @param name Name of attribute to return
*
* @return Value of specified attribute
*
@@ -457,14 +433,13 @@ public class Cookie implements Cloneable, Serializable {
/**
- * Obtain the Map of attributes and values (excluding version) for this
- * cookie.
+ * Obtain the Map of attributes and values (excluding version) for this cookie.
*
* @return A read-only Map of attributes to values, excluding version.
*
* @since Servlet 6.0
*/
- public Map<String,String> getAttributes() {
+ public Map<String, String> getAttributes() {
if (attributes == null) {
return Collections.emptyMap();
} else {
diff --git a/java/jakarta/servlet/http/HttpFilter.java b/java/jakarta/servlet/http/HttpFilter.java
index a8477a152e..4c7154bea6 100644
--- a/java/jakarta/servlet/http/HttpFilter.java
+++ b/java/jakarta/servlet/http/HttpFilter.java
@@ -25,25 +25,21 @@ import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
/**
- * Provides a base class that implements the Filter interface and ensures
- * that the Request and Response are of type HttpServletRequest and
- * HttpServletResponse respectively.
+ * Provides a base class that implements the Filter interface and ensures that the Request and Response are of type
+ * HttpServletRequest and HttpServletResponse respectively.
*/
public abstract class HttpFilter extends GenericFilter {
private static final long serialVersionUID = 1L;
/**
- * {@inheritDoc}
+ * {@inheritDoc} This implementation tests the request and response to see if they are instances of
+ * {@link HttpServletRequest} and {@link HttpServletResponse} respectively. If they are then they are passed to
+ * {@link #doFilter(HttpServletRequest, HttpServletResponse, FilterChain)}. If not, a {@link ServletException} is
+ * thrown.
*
- * This implementation tests the request and response to see if they are
- * instances of {@link HttpServletRequest} and {@link HttpServletResponse}
- * respectively. If they are then they are passed to
- * {@link #doFilter(HttpServletRequest, HttpServletResponse, FilterChain)}.
- * If not, a {@link ServletException} is thrown.
- *
- * @throws ServletException If either the request or response are not of the
- * expected types or any other error occurs
+ * @throws ServletException If either the request or response are not of the expected types or any other error
+ * occurs
*/
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
@@ -59,41 +55,33 @@ public abstract class HttpFilter extends GenericFilter {
/**
- * The <code>doFilter</code> method of the Filter is called by the container
- * each time a request/response pair is passed through the chain due to a
- * client request for a resource at the end of the chain. The FilterChain
- * passed in to this method allows the Filter to pass on the request and
- * response to the next entity in the chain.
+ * The <code>doFilter</code> method of the Filter is called by the container each time a request/response pair is
+ * passed through the chain due to a client request for a resource at the end of the chain. The FilterChain passed
+ * in to this method allows the Filter to pass on the request and response to the next entity in the chain.
* <p>
- * A typical implementation of this method would follow the following
- * pattern:- <br>
+ * A typical implementation of this method would follow the following pattern:- <br>
* 1. Examine the request<br>
- * 2. Optionally wrap the request object with a custom implementation to
- * filter content or headers for input filtering <br>
- * 3. Optionally wrap the response object with a custom implementation to
- * filter content or headers for output filtering <br>
- * 4. a) <strong>Either</strong> invoke the next entity in the chain using
- * the FilterChain object (<code>chain.doFilter()</code>), <br>
- * 4. b) <strong>or</strong> not pass on the request/response pair to the
- * next entity in the filter chain to block the request processing<br>
- * 5. Directly set headers on the response after invocation of the next
- * entity in the filter chain.
- *
- * This default implementation simply calls the next filter in the filter
- * chain.
+ * 2. Optionally wrap the request object with a custom implementation to filter content or headers for input
+ * filtering <br>
+ * 3. Optionally wrap the response object with a custom implementation to filter content or headers for output
+ * filtering <br>
+ * 4. a) <strong>Either</strong> invoke the next entity in the chain using the FilterChain object
+ * (<code>chain.doFilter()</code>), <br>
+ * 4. b) <strong>or</strong> not pass on the request/response pair to the next entity in the filter chain to block
+ * the request processing<br>
+ * 5. Directly set headers on the response after invocation of the next entity in the filter chain. This default
+ * implementation simply calls the next filter in the filter chain.
*
* @param request The request to process
* @param response The response associated with the request
- * @param chain Provides access to the next filter in the chain for this
- * filter to pass the request and response to for further
- * processing
+ * @param chain Provides access to the next filter in the chain for this filter to pass the request and response
+ * to for further processing
*
- * @throws IOException if an I/O error occurs during this filter's
- * processing of the request
+ * @throws IOException if an I/O error occurs during this filter's processing of the request
* @throws ServletException if the processing fails for any other reason
*/
- protected void doFilter(HttpServletRequest request, HttpServletResponse response,
- FilterChain chain) throws IOException, ServletException {
+ protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
+ throws IOException, ServletException {
chain.doFilter(request, response);
}
}
diff --git a/java/jakarta/servlet/http/HttpServlet.java b/java/jakarta/servlet/http/HttpServlet.java
index cf384b85fb..930529fdde 100644
--- a/java/jakarta/servlet/http/HttpServlet.java
+++ b/java/jakarta/servlet/http/HttpServlet.java
@@ -43,42 +43,28 @@ import jakarta.servlet.WriteListener;
/**
- * Provides an abstract class to be subclassed to create
- * an HTTP servlet suitable for a Web site. A subclass of
- * <code>HttpServlet</code> must override at least
- * one method, usually one of these:
- *
+ * Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A subclass of
+ * <code>HttpServlet</code> must override at least one method, usually one of these:
* <ul>
- * <li> <code>doGet</code>, if the servlet supports HTTP GET requests
- * <li> <code>doPost</code>, for HTTP POST requests
- * <li> <code>doPut</code>, for HTTP PUT requests
- * <li> <code>doDelete</code>, for HTTP DELETE requests
- * <li> <code>init</code> and <code>destroy</code>,
- * to manage resources that are held for the life of the servlet
- * <li> <code>getServletInfo</code>, which the servlet uses to
- * provide information about itself
+ * <li><code>doGet</code>, if the servlet supports HTTP GET requests
+ * <li><code>doPost</code>, for HTTP POST requests
+ * <li><code>doPut</code>, for HTTP PUT requests
+ * <li><code>doDelete</code>, for HTTP DELETE requests
+ * <li><code>init</code> and <code>destroy</code>, to manage resources that are held for the life of the servlet
+ * <li><code>getServletInfo</code>, which the servlet uses to provide information about itself
* </ul>
- *
- * <p>There's almost no reason to override the <code>service</code>
- * method. <code>service</code> handles standard HTTP
- * requests by dispatching them to the handler methods
- * for each HTTP request type (the <code>do</code><i>Method</i>
+ * <p>
+ * There's almost no reason to override the <code>service</code> method. <code>service</code> handles standard HTTP
+ * requests by dispatching them to the handler methods for each HTTP request type (the <code>do</code><i>Method</i>
* methods listed above).
- *
- * <p>Likewise, there's almost no reason to override the
- * <code>doOptions</code> and <code>doTrace</code> methods.
- *
- * <p>Servlets typically run on multithreaded servers,
- * so be aware that a servlet must handle concurrent
- * requests and be careful to synchronize access to shared resources.
- * Shared resources include in-memory data such as
- * instance or class variables and external objects
- * such as files, database connections, and network
- * connections.
- * See the
- * <a href="http://java.sun.com/Series/Tutorial/java/threads/multithreaded.html">
- * Java Tutorial on Multithreaded Programming</a> for more
- * information on handling multiple threads in a Java program.
+ * <p>
+ * Likewise, there's almost no reason to override the <code>doOptions</code> and <code>doTrace</code> methods.
+ * <p>
+ * Servlets typically run on multithreaded servers, so be aware that a servlet must handle concurrent requests and be
+ * careful to synchronize access to shared resources. Shared resources include in-memory data such as instance or class
+ * variables and external objects such as files, database connections, and network connections. See the
+ * <a href="http://java.sun.com/Series/Tutorial/java/threads/multithreaded.html"> Java Tutorial on Multithreaded
+ * Programming</a> for more information on handling multiple threads in a Java program.
*/
public abstract class HttpServlet extends GenericServlet {
@@ -116,8 +102,7 @@ public abstract class HttpServlet extends GenericServlet {
private volatile String cachedAllowHeaderValue = null;
/**
- * Cached value read from {@link HttpServlet#LEGACY_DO_HEAD} system
- * property.
+ * Cached value read from {@link HttpServlet#LEGACY_DO_HEAD} system property.
*/
private volatile boolean cachedUseLegacyDoHead;
@@ -143,97 +128,63 @@ public abstract class HttpServlet extends GenericServlet {
/**
- * Called by the server (via the <code>service</code> method) to
- * allow a servlet to handle a GET request.
- *
- * <p>Overriding this method to support a GET request also
- * automatically supports an HTTP HEAD request. A HEAD
- * request is a GET request that returns no body in the
- * response, only the request header fields.
- *
- * <p>When overriding this method, read the request data,
- * write the response headers, get the response's noBodyWriter or
- * output stream object, and finally, write the response data.
- * It's best to include content type and encoding. When using
- * a <code>PrintWriter</code> object to return the response,
- * set the content type before accessing the
+ * Called by the server (via the <code>service</code> method) to allow a servlet to handle a GET request.
+ * <p>
+ * Overriding this method to support a GET request also automatically supports an HTTP HEAD request. A HEAD request
+ * is a GET request that returns no body in the response, only the request header fields.
+ * <p>
+ * When overriding this method, read the request data, write the response headers, get the response's noBodyWriter
+ * or output stream object, and finally, write the response data. It's best to include content type and encoding.
+ * When using a <code>PrintWriter</code> object to return the response, set the content type before accessing the
* <code>PrintWriter</code> object.
- *
- * <p>The servlet container must write the headers before
- * committing the response, because in HTTP the headers must be sent
- * before the response body.
- *
- * <p>Where possible, set the Content-Length header (with the
- * {@link jakarta.servlet.ServletResponse#setContentLength} method),
- * to allow the servlet container to use a persistent connection
- * to return its response to the client, improving performance.
- * The content length is automatically set if the entire response fits
- * inside the response buffer.
- *
- * <p>When using HTTP 1.1 chunked encoding (which means that the response
- * has a Transfer-Encoding header), do not set the Content-Length header.
- *
- * <p>The GET method should be safe, that is, without
- * any side effects for which users are held responsible.
- * For example, most form queries have no side effects.
- * If a client request is intended to change stored data,
- * the request should use some other HTTP method.
- *
- * <p>The GET method should also be idempotent, meaning
- * that it can be safely repeated. Sometimes making a
- * method safe also makes it idempotent. For example,
- * repeating queries is both safe and idempotent, but
- * buying a product online or modifying data is neither
- * safe nor idempotent.
- *
- * <p>If the request is incorrectly formatted, <code>doGet</code>
- * returns an HTTP "Bad Request" message.
- *
- * @param req an {@link HttpServletRequest} object that
- * contains the request the client has made
- * of the servlet
- *
- * @param resp an {@link HttpServletResponse} object that
- * contains the response the servlet sends
- * to the client
- *
- * @exception IOException if an input or output error is
- * detected when the servlet handles
- * the GET request
- *
- * @exception ServletException if the request for the GET
- * could not be handled
+ * <p>
+ * The servlet container must write the headers before committing the response, because in HTTP the headers must be
+ * sent before the response body.
+ * <p>
+ * Where possible, set the Content-Length header (with the {@link jakarta.servlet.ServletResponse#setContentLength}
+ * method), to allow the servlet container to use a persistent connection to return its response to the client,
+ * improving performance. The content length is automatically set if the entire response fits inside the response
+ * buffer.
+ * <p>
+ * When using HTTP 1.1 chunked encoding (which means that the response has a Transfer-Encoding header), do not set
+ * the Content-Length header.
+ * <p>
+ * The GET method should be safe, that is, without any side effects for which users are held responsible. For
+ * example, most form queries have no side effects. If a client request is intended to change stored data, the
+ * request should use some other HTTP method.
+ * <p>
+ * The GET method should also be idempotent, meaning that it can be safely repeated. Sometimes making a method safe
+ * also makes it idempotent. For example, repeating queries is both safe and idempotent, but buying a product online
+ * or modifying data is neither safe nor idempotent.
+ * <p>
+ * If the request is incorrectly formatted, <code>doGet</code> returns an HTTP "Bad Request" message.
+ *
+ * @param req an {@link HttpServletRequest} object that contains the request the client has made of the servlet
+ * @param resp an {@link HttpServletResponse} object that contains the response the servlet sends to the client
+ *
+ * @exception IOException if an input or output error is detected when the servlet handles the GET request
+ * @exception ServletException if the request for the GET could not be handled
*
* @see jakarta.servlet.ServletResponse#setContentType
*/
- protected void doGet(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException
- {
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String msg = lStrings.getString("http.method_get_not_supported");
sendMethodNotAllowed(req, resp, msg);
}
/**
- * Returns the time the <code>HttpServletRequest</code>
- * object was last modified,
- * in milliseconds since midnight January 1, 1970 GMT.
- * If the time is unknown, this method returns a negative
- * number (the default).
- *
- * <p>Servlets that support HTTP GET requests and can quickly determine
- * their last modification time should override this method.
- * This makes browser and proxy caches work more effectively,
- * reducing the load on server and network resources.
+ * Returns the time the <code>HttpServletRequest</code> object was last modified, in milliseconds since midnight
+ * January 1, 1970 GMT. If the time is unknown, this method returns a negative number (the default).
+ * <p>
+ * Servlets that support HTTP GET requests and can quickly determine their last modification time should override
+ * this method. This makes browser and proxy caches work more effectively, reducing the load on server and network
+ * resources.
*
- * @param req the <code>HttpServletRequest</code>
- * object that is sent to the servlet
+ * @param req the <code>HttpServletRequest</code> object that is sent to the servlet
*
- * @return a <code>long</code> integer specifying
- * the time the <code>HttpServletRequest</code>
- * object was last modified, in milliseconds
- * since midnight, January 1, 1970 GMT, or
- * -1 if the time is not known
+ * @return a <code>long</code> integer specifying the time the <code>HttpServletRequest</code> object was last
+ * modified, in milliseconds since midnight, January 1, 1970 GMT, or -1 if the time is not known
*/
protected long getLastModified(HttpServletRequest req) {
return -1;
@@ -241,38 +192,24 @@ public abstract class HttpServlet extends GenericServlet {
/**
- * <p>Receives an HTTP HEAD request from the protected
- * <code>service</code> method and handles the
- * request.
- * The client sends a HEAD request when it wants
- * to see only the headers of a response, such as
- * Content-Type or Content-Length. The HTTP HEAD
- * method counts the output bytes in the response
- * to set the Content-Length header accurately.
- *
- * <p>If you override this method, you can avoid computing
- * the response body and just set the response headers
- * directly to improve performance. Make sure that the
- * <code>doHead</code> method you write is both safe
- * and idempotent (that is, protects itself from being
- * called multiple times for one HTTP HEAD request).
- *
- * <p>If the HTTP HEAD request is incorrectly formatted,
- * <code>doHead</code> returns an HTTP "Bad Request"
- * message.
- *
- * @param req the request object that is passed to the servlet
- *
- * @param resp the response object that the servlet
- * uses to return the headers to the client
- *
- * @exception IOException if an input or output error occurs
- *
- * @exception ServletException if the request for the HEAD
- * could not be handled
+ * <p>
+ * Receives an HTTP HEAD request from the protected <code>service</code> method and handles the request. The client
+ * sends a HEAD request when it wants to see only the headers of a response, such as Content-Type or Content-Length.
+ * The HTTP HEAD method counts the output bytes in the response to set the Content-Length header accurately.
+ * <p>
+ * If you override this method, you can avoid computing the response body and just set the response headers directly
+ * to improve performance. Make sure that the <code>doHead</code> method you write is both safe and idempotent (that
+ * is, protects itself from being called multiple times for one HTTP HEAD request).
+ * <p>
+ * If the HTTP HEAD request is incorrectly formatted, <code>doHead</code> returns an HTTP "Bad Request" message.
+ *
+ * @param req the request object that is passed to the servlet
+ * @param resp the response object that the servlet uses to return the headers to the client
+ *
+ * @exception IOException if an input or output error occurs
+ * @exception ServletException if the request for the HEAD could not be handled
*/
- protected void doHead(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
+ protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (DispatcherType.INCLUDE.equals(req.getDispatcherType()) || !cachedUseLegacyDoHead) {
doGet(req, resp);
@@ -289,64 +226,41 @@ public abstract class HttpServlet extends GenericServlet {
/**
- * Called by the server (via the <code>service</code> method)
- * to allow a servlet to handle a POST request.
- *
- * The HTTP POST method allows the client to send
- * data of unlimited length to the Web server a single time
- * and is useful when posting information such as
- * credit card numbers.
- *
- * <p>When overriding this method, read the request data,
- * write the response headers, get the response's noBodyWriter or output
- * stream object, and finally, write the response data. It's best
- * to include content type and encoding. When using a
- * <code>PrintWriter</code> object to return the response, set the
- * content type before accessing the <code>PrintWriter</code> object.
- *
- * <p>The servlet container must write the headers before committing the
- * response, because in HTTP the headers must be sent before the
- * response body.
- *
- * <p>Where possible, set the Content-Length header (with the
- * {@link jakarta.servlet.ServletResponse#setContentLength} method),
- * to allow the servlet container to use a persistent connection
- * to return its response to the client, improving performance.
- * The content length is automatically set if the entire response fits
- * inside the response buffer.
- *
- * <p>When using HTTP 1.1 chunked encoding (which means that the response
- * has a Transfer-Encoding header), do not set the Content-Length header.
- *
- * <p>This method does not need to be either safe or idempotent.
- * Operations requested through POST can have side effects for
- * which the user can be held accountable, for example,
- * updating stored data or buying items online.
- *
- * <p>If the HTTP POST request is incorrectly formatted,
- * <code>doPost</code> returns an HTTP "Bad Request" message.
- *
- *
- * @param req an {@link HttpServletRequest} object that
- * contains the request the client has made
- * of the servlet
- *
- * @param resp an {@link HttpServletResponse} object that
- * contains the response the servlet sends
- * to the client
- *
- * @exception IOException if an input or output error is
- * detected when the servlet handles
- * the request
- *
- * @exception ServletException if the request for the POST
- * could not be handled
+ * Called by the server (via the <code>service</code> method) to allow a servlet to handle a POST request. The HTTP
+ * POST method allows the client to send data of unlimited length to the Web server a single time and is useful when
+ * posting information such as credit card numbers.
+ * <p>
+ * When overriding this method, read the request data, write the response headers, get the response's noBodyWriter
+ * or output stream object, and finally, write the response data. It's best to include content type and encoding.
+ * When using a <code>PrintWriter</code> object to return the response, set the content type before accessing the
+ * <code>PrintWriter</code> object.
+ * <p>
+ * The servlet container must write the headers before committing the response, because in HTTP the headers must be
+ * sent before the response body.
+ * <p>
+ * Where possible, set the Content-Length header (with the {@link jakarta.servlet.ServletResponse#setContentLength}
+ * method), to allow the servlet container to use a persistent connection to return its response to the client,
+ * improving performance. The content length is automatically set if the entire response fits inside the response
+ * buffer.
+ * <p>
+ * When using HTTP 1.1 chunked encoding (which means that the response has a Transfer-Encoding header), do not set
+ * the Content-Length header.
+ * <p>
+ * This method does not need to be either safe or idempotent. Operations requested through POST can have side
+ * effects for which the user can be held accountable, for example, updating stored data or buying items online.
+ * <p>
+ * If the HTTP POST request is incorrectly formatted, <code>doPost</code> returns an HTTP "Bad Request" message.
+ *
+ * @param req an {@link HttpServletRequest} object that contains the request the client has made of the servlet
+ * @param resp an {@link HttpServletResponse} object that contains the response the servlet sends to the client
+ *
+ * @exception IOException if an input or output error is detected when the servlet handles the request
+ * @exception ServletException if the request for the POST could not be handled
*
* @see jakarta.servlet.ServletOutputStream
* @see jakarta.servlet.ServletResponse#setContentType
*/
- protected void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String msg = lStrings.getString("http.method_post_not_supported");
sendMethodNotAllowed(req, resp, msg);
@@ -354,49 +268,28 @@ public abstract class HttpServlet extends GenericServlet {
/**
- * Called by the server (via the <code>service</code> method)
- * to allow a servlet to handle a PUT request.
- *
- * The PUT operation allows a client to
- * place a file on the server and is similar to
- * sending a file by FTP.
- *
- * <p>When overriding this method, leave intact
- * any content headers sent with the request (including
- * Content-Length, Content-Type, Content-Transfer-Encoding,
- * Content-Encoding, Content-Base, Content-Language, Content-Location,
- * Content-MD5, and Content-Range). If your method cannot
- * handle a content header, it must issue an error message
- * (HTTP 501 - Not Implemented) and discard the request.
- * For more information on HTTP 1.1, see RFC 2616
+ * Called by the server (via the <code>service</code> method) to allow a servlet to handle a PUT request. The PUT
+ * operation allows a client to place a file on the server and is similar to sending a file by FTP.
+ * <p>
+ * When overriding this method, leave intact any content headers sent with the request (including Content-Length,
+ * Content-Type, Content-Transfer-Encoding, Content-Encoding, Content-Base, Content-Language, Content-Location,
+ * Content-MD5, and Content-Range). If your method cannot handle a content header, it must issue an error message
+ * (HTTP 501 - Not Implemented) and discard the request. For more information on HTTP 1.1, see RFC 2616
* <a href="http://www.ietf.org/rfc/rfc2616.txt"></a>.
- *
- * <p>This method does not need to be either safe or idempotent.
- * Operations that <code>doPut</code> performs can have side
- * effects for which the user can be held accountable. When using
- * this method, it may be useful to save a copy of the
- * affected URL in temporary storage.
- *
- * <p>If the HTTP PUT request is incorrectly formatted,
- * <code>doPut</code> returns an HTTP "Bad Request" message.
- *
- * @param req the {@link HttpServletRequest} object that
- * contains the request the client made of
- * the servlet
- *
- * @param resp the {@link HttpServletResponse} object that
- * contains the response the servlet returns
- * to the client
- *
- * @exception IOException if an input or output error occurs
- * while the servlet is handling the
- * PUT request
- *
- * @exception ServletException if the request for the PUT
- * cannot be handled
+ * <p>
+ * This method does not need to be either safe or idempotent. Operations that <code>doPut</code> performs can have
+ * side effects for which the user can be held accountable. When using this method, it may be useful to save a copy
+ * of the affected URL in temporary storage.
+ * <p>
+ * If the HTTP PUT request is incorrectly formatted, <code>doPut</code> returns an HTTP "Bad Request" message.
+ *
+ * @param req the {@link HttpServletRequest} object that contains the request the client made of the servlet
+ * @param resp the {@link HttpServletResponse} object that contains the response the servlet returns to the client
+ *
+ * @exception IOException if an input or output error occurs while the servlet is handling the PUT request
+ * @exception ServletException if the request for the PUT cannot be handled
*/
- protected void doPut(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
+ protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String msg = lStrings.getString("http.method_put_not_supported");
sendMethodNotAllowed(req, resp, msg);
@@ -404,42 +297,22 @@ public abstract class HttpServlet extends GenericServlet {
/**
- * Called by the server (via the <code>service</code> method)
- * to allow a servlet to handle a DELETE request.
- *
- * The DELETE operation allows a client to remove a document
- * or Web page from the server.
- *
- * <p>This method does not need to be either safe
- * or idempotent. Operations requested through
- * DELETE can have side effects for which users
- * can be held accountable. When using
- * this method, it may be useful to save a copy of the
+ * Called by the server (via the <code>service</code> method) to allow a servlet to handle a DELETE request. The
+ * DELETE operation allows a client to remove a document or Web page from the server.
+ * <p>
+ * This method does not need to be either safe or idempotent. Operations requested through DELETE can have side
+ * effects for which users can be held accountable. When using this method, it may be useful to save a copy of the
* affected URL in temporary storage.
+ * <p>
+ * If the HTTP DELETE request is incorrectly formatted, <code>doDelete</code> returns an HTTP "Bad Request" message.
*
- * <p>If the HTTP DELETE request is incorrectly formatted,
- * <code>doDelete</code> returns an HTTP "Bad Request"
- * message.
- *
- * @param req the {@link HttpServletRequest} object that
- * contains the request the client made of
- * the servlet
- *
- *
- * @param resp the {@link HttpServletResponse} object that
- * contains the response the servlet returns
- * to the client
- *
- * @exception IOException if an input or output error occurs
- * while the servlet is handling the
- * DELETE request
+ * @param req the {@link HttpServletRequest} object that contains the request the client made of the servlet
+ * @param resp the {@link HttpServletResponse} object that contains the response the servlet returns to the client
*
- * @exception ServletException if the request for the
- * DELETE cannot be handled
+ * @exception IOException if an input or output error occurs while the servlet is handling the DELETE request
+ * @exception ServletException if the request for the DELETE cannot be handled
*/
- protected void doDelete(HttpServletRequest req,
- HttpServletResponse resp)
- throws ServletException, IOException {
+ protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String msg = lStrings.getString("http.method_delete_not_supported");
sendMethodNotAllowed(req, resp, msg);
@@ -449,7 +322,7 @@ public abstract class HttpServlet extends GenericServlet {
private void sendMethodNotAllowed(HttpServletRequest req, HttpServletResponse resp, String msg) throws IOException {
String protocol = req.getProtocol();
// Note: Tomcat reports "" for HTTP/0.9 although some implementations
- // may report HTTP/0.9
+ // may report HTTP/0.9
if (protocol.length() == 0 || protocol.endsWith("0.9") || protocol.endsWith("1.0")) {
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
} else {
@@ -562,38 +435,22 @@ public abstract class HttpServlet extends GenericServlet {
/**
- * Called by the server (via the <code>service</code> method)
- * to allow a servlet to handle an OPTIONS request.
- *
- * The OPTIONS request determines which HTTP methods
- * the server supports and
- * returns an appropriate header. For example, if a servlet
- * overrides <code>doGet</code>, this method returns the
- * following header:
- *
- * <p><code>Allow: GET, HEAD, TRACE, OPTIONS</code>
- *
- * <p>There's no need to override this method unless the
- * servlet implements new HTTP methods, beyond those
- * implemented by HTTP 1.1.
- *
- * @param req the {@link HttpServletRequest} object that
- * contains the request the client made of
- * the servlet
- *
- * @param resp the {@link HttpServletResponse} object that
- * contains the response the servlet returns
- * to the client
- *
- * @exception IOException if an input or output error occurs
- * while the servlet is handling the
- * OPTIONS request
- *
- * @exception ServletException if the request for the
- * OPTIONS cannot be handled
+ * Called by the server (via the <code>service</code> method) to allow a servlet to handle an OPTIONS request. The
+ * OPTIONS request determines which HTTP methods the server supports and returns an appropriate header. For example,
+ * if a servlet overrides <code>doGet</code>, this method returns the following header:
+ * <p>
+ * <code>Allow: GET, HEAD, TRACE, OPTIONS</code>
+ * <p>
+ * There's no need to override this method unless the servlet implements new HTTP methods, beyond those implemented
+ * by HTTP 1.1.
+ *
+ * @param req the {@link HttpServletRequest} object that contains the request the client made of the servlet
+ * @param resp the {@link HttpServletResponse} object that contains the response the servlet returns to the client
+ *
+ * @exception IOException if an input or output error occurs while the servlet is handling the OPTIONS request
+ * @exception ServletException if the request for the OPTIONS cannot be handled
*/
- protected void doOptions(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
+ protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String allow = getCachedAllowHeaderValue();
@@ -611,35 +468,23 @@ public abstract class HttpServlet extends GenericServlet {
/**
- * Called by the server (via the <code>service</code> method)
- * to allow a servlet to handle a TRACE request.
- *
- * A TRACE returns the headers sent with the TRACE
- * request to the client, so that they can be used in
- * debugging. There's no need to override this method.
- *
- * @param req the {@link HttpServletRequest} object that
- * contains the request the client made of
- * the servlet
- *
- * @param resp the {@link HttpServletResponse} object that
- * contains the response the servlet returns
- * to the client
+ * Called by the server (via the <code>service</code> method) to allow a servlet to handle a TRACE request. A TRACE
+ * returns the headers sent with the TRACE request to the client, so that they can be used in debugging. There's no
+ * need to override this method.
*
- * @exception IOException if an input or output error occurs
- * while the servlet is handling the
- * TRACE request
+ * @param req the {@link HttpServletRequest} object that contains the request the client made of the servlet
+ * @param resp the {@link HttpServletResponse} object that contains the response the servlet returns to the client
*
- * @exception ServletException if the request for the
- * TRACE cannot be handled
+ * @exception IOException if an input or output error occurs while the servlet is handling the TRACE request
+ * @exception ServletException if the request for the TRACE cannot be handled
*/
protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
int responseLength;
String CRLF = "\r\n";
- StringBuilder buffer =
- new StringBuilder("TRACE ").append(req.getRequestURI()).append(" ").append(req.getProtocol());
+ StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI()).append(" ")
+ .append(req.getProtocol());
Enumeration<String> reqHeaderNames = req.getHeaderNames();
@@ -668,32 +513,19 @@ public abstract class HttpServlet extends GenericServlet {
/**
- * Receives standard HTTP requests from the public
- * <code>service</code> method and dispatches
- * them to the <code>do</code><i>Method</i> methods defined in
- * this class. This method is an HTTP-specific version of the
- * {@link jakarta.servlet.Servlet#service} method. There's no
- * need to override this method.
+ * Receives standard HTTP requests from the public <code>service</code> method and dispatches them to the
+ * <code>do</code><i>Method</i> methods defined in this class. This method is an HTTP-specific version of the
+ * {@link jakarta.servlet.Servlet#service} method. There's no need to override this method.
*
- * @param req the {@link HttpServletRequest} object that
- * contains the request the client made of
- * the servlet
+ * @param req the {@link HttpServletRequest} object that contains the request the client made of the servlet
+ * @param resp the {@link HttpServletResponse} object that contains the response the servlet returns to the client
*
- * @param resp the {@link HttpServletResponse} object that
- * contains the response the servlet returns
- * to the client
- *
- * @exception IOException if an input or output error occurs
- * while the servlet is handling the
- * HTTP request
- *
- * @exception ServletException if the HTTP request
- * cannot be handled
+ * @exception IOException if an input or output error occurs while the servlet is handling the HTTP request
+ * @exception ServletException if the HTTP request cannot be handled
*
* @see jakarta.servlet.Servlet#service
*/
- protected void service(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String method = req.getMethod();
@@ -737,10 +569,10 @@ public abstract class HttpServlet extends GenericServlet {
doDelete(req, resp);
} else if (method.equals(METHOD_OPTIONS)) {
- doOptions(req,resp);
+ doOptions(req, resp);
} else if (method.equals(METHOD_TRACE)) {
- doTrace(req,resp);
+ doTrace(req, resp);
} else {
//
@@ -759,14 +591,11 @@ public abstract class HttpServlet extends GenericServlet {
/*
- * Sets the Last-Modified entity header field, if it has not
- * already been set and if the value is meaningful. Called before
- * doGet, to ensure that headers are set before response data is
- * written. A subclass might have set this header already, so we
- * check.
+ * Sets the Last-Modified entity header field, if it has not already been set and if the value is meaningful. Called
+ * before doGet, to ensure that headers are set before response data is written. A subclass might have set this
+ * header already, so we check.
*/
- private void maybeSetLastModified(HttpServletResponse resp,
- long lastModified) {
+ private void maybeSetLastModified(HttpServletResponse resp, long lastModified) {
if (resp.containsHeader(HEADER_LASTMOD)) {
return;
}
@@ -777,32 +606,20 @@ public abstract class HttpServlet extends GenericServlet {
/**
- * Dispatches client requests to the protected
- * <code>service</code> method. There's no need to
- * override this method.
- *
- * @param req the {@link HttpServletRequest} object that
- * contains the request the client made of
- * the servlet
- *
- * @param res the {@link HttpServletResponse} object that
- * contains the response the servlet returns
- * to the client
+ * Dispatches client requests to the protected <code>service</code> method. There's no need to override this method.
*
- * @exception IOException if an input or output error occurs
- * while the servlet is handling the
- * HTTP request
+ * @param req the {@link HttpServletRequest} object that contains the request the client made of the servlet
+ * @param res the {@link HttpServletResponse} object that contains the response the servlet returns to the client
*
- * @exception ServletException if the HTTP request cannot
- * be handled
+ * @exception IOException if an input or output error occurs while the servlet is handling the HTTP request
+ * @exception ServletException if the HTTP request cannot be handled
*
* @see jakarta.servlet.Servlet#service
*/
@Override
- public void service(ServletRequest req, ServletResponse res)
- throws ServletException, IOException {
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
- HttpServletRequest request;
+ HttpServletRequest request;
HttpServletResponse response;
try {
@@ -851,10 +668,8 @@ public abstract class HttpServlet extends GenericServlet {
/*
- * A response wrapper for use in (dumb) "HEAD" support.
- * This just swallows that body, counting the bytes in order to set
- * the content length appropriately. All other methods delegate to the
- * wrapped HTTP Servlet Response object.
+ * A response wrapper for use in (dumb) "HEAD" support. This just swallows that body, counting the bytes in order to
+ * set the content length appropriately. All other methods delegate to the wrapped HTTP Servlet Response object.
*/
private static class NoBodyResponse extends HttpServletResponseWrapper {
private final NoBodyOutputStream noBodyOutputStream;
@@ -980,11 +795,10 @@ public abstract class HttpServlet extends GenericServlet {
@Override
public void write(byte buf[], int offset, int len) throws IOException {
if (buf == null) {
- throw new NullPointerException(
- lStrings.getString("err.io.nullArray"));
+ throw new NullPointerException(lStrings.getString("err.io.nullArray"));
}
- if (offset < 0 || len < 0 || offset+len > buf.length) {
+ if (offset < 0 || len < 0 || offset + len > buf.length) {
String msg = lStrings.getString("err.io.indexOutOfBounds");
Object[] msgArgs = new Object[3];
msgArgs[0] = Integer.valueOf(offset);
@@ -1026,11 +840,9 @@ public abstract class HttpServlet extends GenericServlet {
/*
- * On reset() and resetBuffer() need to clear the data buffered in the
- * OutputStreamWriter. No easy way to do that so NoBodyPrintWriter wraps a
- * PrintWriter than can be thrown away on reset()/resetBuffer() and a new
- * one constructed while the application retains a reference to the
- * NoBodyPrintWriter instance.
+ * On reset() and resetBuffer() need to clear the data buffered in the OutputStreamWriter. No easy way to do that so
+ * NoBodyPrintWriter wraps a PrintWriter than can be thrown away on reset()/resetBuffer() and a new one constructed
+ * while the application retains a reference to the NoBodyPrintWriter instance.
*/
private static class NoBodyPrintWriter extends PrintWriter {
@@ -1200,8 +1012,7 @@ public abstract class HttpServlet extends GenericServlet {
/*
- * Calls NoBodyResponse.setContentLength() once the async request is
- * complete.
+ * Calls NoBodyResponse.setContentLength() once the async request is complete.
*/
private static class NoBodyAsyncContextListener implements AsyncListener {
diff --git a/java/jakarta/servlet/http/HttpServletMapping.java b/java/jakarta/servlet/http/HttpServletMapping.java
index 9bde749707..ae88d321de 100644
--- a/java/jakarta/servlet/http/HttpServletMapping.java
+++ b/java/jakarta/servlet/http/HttpServletMapping.java
@@ -19,8 +19,7 @@ package jakarta.servlet.http;
import jakarta.servlet.annotation.WebServlet;
/**
- * Represents how the request from which this object was obtained was mapped to
- * the associated servlet.
+ * Represents how the request from which this object was obtained was mapped to the associated servlet.
*
* @since Servlet 4.0
*/
@@ -32,17 +31,14 @@ public interface HttpServletMapping {
String getMatchValue();
/**
- * @return The {@code url-pattern} that matched this request or the empty
- * String if not known.
+ * @return The {@code url-pattern} that matched this request or the empty String if not known.
*/
String getPattern();
/**
- * @return The name of the servlet (as specified in web.xml,
- * {@link WebServlet#name()},
- * {@link jakarta.servlet.ServletContext#addServlet(String, Class)} or
- * one of the other <code>addServlet()</code> methods) that the
- * request was mapped to.
+ * @return The name of the servlet (as specified in web.xml, {@link WebServlet#name()},
+ * {@link jakarta.servlet.ServletContext#addServlet(String, Class)} or one of the other
+ * <code>addServlet()</code> methods) that the request was mapped to.
*/
String getServletName();
diff --git a/java/jakarta/servlet/http/HttpServletRequest.java b/java/jakarta/servlet/http/HttpServletRequest.java
index 20c15ca6d7..050620b735 100644
--- a/java/jakarta/servlet/http/HttpServletRequest.java
+++ b/java/jakarta/servlet/http/HttpServletRequest.java
@@ -26,12 +26,10 @@ import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
/**
- * Extends the {@link jakarta.servlet.ServletRequest} interface to provide request
- * information for HTTP servlets.
+ * Extends the {@link jakarta.servlet.ServletRequest} interface to provide request information for HTTP servlets.
* <p>
- * The servlet container creates an <code>HttpServletRequest</code> object and
- * passes it as an argument to the servlet's service methods
- * (<code>doGet</code>, <code>doPost</code>, etc).
+ * The servlet container creates an <code>HttpServletRequest</code> object and passes it as an argument to the servlet's
+ * service methods (<code>doGet</code>, <code>doPost</code>, etc).
*/
public interface HttpServletRequest extends ServletRequest {
@@ -44,8 +42,7 @@ public interface HttpServletRequest extends ServletRequest {
*/
public static final String FORM_AUTH = "FORM";
/**
- * String identifier for Client Certificate authentication. Value
- * "CLIENT_CERT"
+ * String identifier for Client Certificate authentication. Value "CLIENT_CERT"
*/
public static final String CLIENT_CERT_AUTH = "CLIENT_CERT";
/**
@@ -54,120 +51,103 @@ public interface HttpServletRequest extends ServletRequest {
public static final String DIGEST_AUTH = "DIGEST";
/**
- * Returns the name of the authentication scheme used to protect the
- * servlet. All servlet containers support basic, form and client
- * certificate authentication, and may additionally support digest
- * authentication. If the servlet is not authenticated <code>null</code> is
- * returned.
+ * Returns the name of the authentication scheme used to protect the servlet. All servlet containers support basic,
+ * form and client certificate authentication, and may additionally support digest authentication. If the servlet is
+ * not authenticated <code>null</code> is returned.
* <p>
* Same as the value of the CGI variable AUTH_TYPE.
*
- * @return one of the static members BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH,
- * DIGEST_AUTH (suitable for == comparison) or the
- * container-specific string indicating the authentication scheme,
- * or <code>null</code> if the request was not authenticated.
+ * @return one of the static members BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH (suitable for ==
+ * comparison) or the container-specific string indicating the authentication scheme, or
+ * <code>null</code> if the request was not authenticated.
*/
public String getAuthType();
/**
- * Returns an array containing all of the <code>Cookie</code> objects the
- * client sent with this request. This method returns <code>null</code> if
- * no cookies were sent.
+ * Returns an array containing all of the <code>Cookie</code> objects the client sent with this request. This method
+ * returns <code>null</code> if no cookies were sent.
*
- * @return an array of all the <code>Cookies</code> included with this
- * request, or <code>null</code> if the request has no cookies
+ * @return an array of all the <code>Cookies</code> included with this request, or <code>null</code> if the request
+ * has no cookies
*/
public Cookie[] getCookies();
/**
- * Returns the value of the specified request header as a <code>long</code>
- * value that represents a <code>Date</code> object. Use this method with
- * headers that contain dates, such as <code>If-Modified-Since</code>.
+ * Returns the value of the specified request header as a <code>long</code> value that represents a
+ * <code>Date</code> object. Use this method with headers that contain dates, such as
+ * <code>If-Modified-Since</code>.
* <p>
- * The date is returned as the number of milliseconds since January 1, 1970
- * GMT. The header name is case insensitive.
+ * The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case
+ * insensitive.
* <p>
- * If the request did not have a header of the specified name, this method
- * returns -1. If the header can't be converted to a date, the method throws
- * an <code>IllegalArgumentException</code>.
- *
- * @param name
- * a <code>String</code> specifying the name of the header
- * @return a <code>long</code> value representing the date specified in the
- * header expressed as the number of milliseconds since January 1,
- * 1970 GMT, or -1 if the named header was not included with the
- * request
- * @exception IllegalArgumentException
- * If the header value can't be converted to a date
+ * If the request did not have a header of the specified name, this method returns -1. If the header can't be
+ * converted to a date, the method throws an <code>IllegalArgumentException</code>.
+ *
+ * @param name a <code>String</code> specifying the name of the header
+ *
+ * @return a <code>long</code> value representing the date specified in the header expressed as the number of
+ * milliseconds since January 1, 1970 GMT, or -1 if the named header was not included with the request
+ *
+ * @exception IllegalArgumentException If the header value can't be converted to a date
*/
public long getDateHeader(String name);
/**
- * Returns the value of the specified request header as a
- * <code>String</code>. If the request did not include a header of the
- * specified name, this method returns <code>null</code>. If there are
- * multiple headers with the same name, this method returns the first head
- * in the request. The header name is case insensitive. You can use this
+ * Returns the value of the specified request header as a <code>String</code>. If the request did not include a
+ * header of the specified name, this method returns <code>null</code>. If there are multiple headers with the same
+ * name, this method returns the first head in the request. The header name is case insensitive. You can use this
* method with any request header.
*
- * @param name
- * a <code>String</code> specifying the header name
- * @return a <code>String</code> containing the value of the requested
- * header, or <code>null</code> if the request does not have a
- * header of that name
+ * @param name a <code>String</code> specifying the header name
+ *
+ * @return a <code>String</code> containing the value of the requested header, or <code>null</code> if the request
+ * does not have a header of that name
*/
public String getHeader(String name);
/**
- * Returns all the values of the specified request header as an
- * <code>Enumeration</code> of <code>String</code> objects.
+ * Returns all the values of the specified request header as an <code>Enumeration</code> of <code>String</code>
+ * objects.
* <p>
- * Some headers, such as <code>Accept-Language</code> can be sent by clients
- * as several headers each with a different value rather than sending the
- * header as a comma separated list.
+ * Some headers, such as <code>Accept-Language</code> can be sent by clients as several headers each with a
+ * different value rather than sending the header as a comma separated list.
* <p>
- * If the request did not include any headers of the specified name, this
- * method returns an empty <code>Enumeration</code>. The header name is case
- * insensitive. You can use this method with any request header.
+ * If the request did not include any headers of the specified name, this method returns an empty
+ * <code>Enumeration</code>. The header name is case insensitive. You can use this method with any request header.
*
- * @param name
- * a <code>String</code> specifying the header name
- * @return an <code>Enumeration</code> containing the values of the requested
- * header. If the request does not have any headers of that name
- * return an empty enumeration. If the container does not allow
- * access to header information, return null
+ * @param name a <code>String</code> specifying the header name
+ *
+ * @return an <code>Enumeration</code> containing the values of the requested header. If the request does not have
+ * any headers of that name return an empty enumeration. If the container does not allow access to
+ * header information, return null
*/
public Enumeration<String> getHeaders(String name);
/**
- * Returns an enumeration of all the header names this request contains. If
- * the request has no headers, this method returns an empty enumeration.
+ * Returns an enumeration of all the header names this request contains. If the request has no headers, this method
+ * returns an empty enumeration.
* <p>
- * Some servlet containers do not allow servlets to access headers using
- * this method, in which case this method returns <code>null</code>
+ * Some servlet containers do not allow servlets to access headers using this method, in which case this method
+ * returns <code>null</code>
*
- * @return an enumeration of all the header names sent with this request; if
- * the request has no headers, an empty enumeration; if the servlet
- * container does not allow servlets to use this method,
- * <code>null</code>
+ * @return an enumeration of all the header names sent with this request; if the request has no headers, an empty
+ * enumeration; if the servlet container does not allow servlets to use this method, <code>null</code>
*/
public Enumeration<String> getHeaderNames();
/**
- * Returns the value of the specified request header as an <code>int</code>.
- * If the request does not have a header of the specified name, this method
- * returns -1. If the header cannot be converted to an integer, this method
+ * Returns the value of the specified request header as an <code>int</code>. If the request does not have a header
+ * of the specified name, this method returns -1. If the header cannot be converted to an integer, this method
* throws a <code>NumberFormatException</code>.
* <p>
* The header name is case insensitive.
*
- * @param name
- * a <code>String</code> specifying the name of a request header
- * @return an integer expressing the value of the request header or -1 if the
- * request doesn't have a header of this name
- * @exception NumberFormatException
- * If the header value can't be converted to an
- * <code>int</code>
+ * @param name a <code>String</code> specifying the name of a request header
+ *
+ * @return an integer expressing the value of the request header or -1 if the request doesn't have a header of this
+ * name
+ *
+ * @exception NumberFormatException If the header value can't be converted to an <code>int</code>
*/
public int getIntHeader(String name);
@@ -202,61 +182,50 @@ public interface HttpServletRequest extends ServletRequest {
}
/**
- * Returns the name of the HTTP method with which this request was made, for
- * example, GET, POST, or PUT. Same as the value of the CGI variable
- * REQUEST_METHOD.
+ * Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. Same as the
+ * value of the CGI variable REQUEST_METHOD.
*
- * @return a <code>String</code> specifying the name of the method with
- * which this request was made
+ * @return a <code>String</code> specifying the name of the method with which this request was made
*/
public String getMethod();
/**
- * Returns any extra path information associated with the URL the client
- * sent when it made this request. The extra path information follows the
- * servlet path but precedes the query string and will start with a "/"
- * character.
+ * Returns any extra path information associated with the URL the client sent when it made this request. The extra
+ * path information follows the servlet path but precedes the query string and will start with a "/" character.
* <p>
- * This method returns <code>null</code> if there was no extra path
- * information.
+ * This method returns <code>null</code> if there was no extra path information.
* <p>
- * The URL will be canonicalized as per section 3.5 of the specification
- * before the path information, if any, is extracted.
+ * The URL will be canonicalized as per section 3.5 of the specification before the path information, if any, is
+ * extracted.
*
- * @return a <code>String</code>, canonicalized by the web container,
- * specifying extra path information that comes after the servlet
- * path but before the query string in the request URL; or
- * {@code null} if the URL does not have any extra path information
+ * @return a <code>String</code>, canonicalized by the web container, specifying extra path information that comes
+ * after the servlet path but before the query string in the request URL; or {@code null} if the URL
+ * does not have any extra path information
*/
public String getPathInfo();
/**
- * Returns any extra path information after the servlet name but before the
- * query string, and translates it to a real path. Same as the value of the
- * CGI variable PATH_TRANSLATED.
+ * Returns any extra path information after the servlet name but before the query string, and translates it to a
+ * real path. Same as the value of the CGI variable PATH_TRANSLATED.
* <p>
- * If the URL does not have any extra path information, this method returns
- * <code>null</code> or the servlet container cannot translate the virtual
- * path to a real path for any reason (such as when the web application is
+ * If the URL does not have any extra path information, this method returns <code>null</code> or the servlet
+ * container cannot translate the virtual path to a real path for any reason (such as when the web application is
* executed from an archive). The web container does not decode this string.
*
- * @return a <code>String</code> specifying the real path, or
- * <code>null</code> if the URL does not have any extra path
- * information
+ * @return a <code>String</code> specifying the real path, or <code>null</code> if the URL does not have any extra
+ * path information
*/
public String getPathTranslated();
/**
- * Obtain a builder for generating push requests. {@link PushBuilder}
- * documents how this request will be used as the basis for a push request.
- * Each call to this method will return a new instance, independent of any
- * previous instance obtained.
+ * Obtain a builder for generating push requests. {@link PushBuilder} documents how this request will be used as the
+ * basis for a push request. Each call to this method will return a new instance, independent of any previous
+ * instance obtained.
*
- * @return A builder that can be used to generate push requests based on
- * this request or {@code null} if push is not supported. Note that
- * even if a PushBuilder instance is returned, by the time that
- * {@link PushBuilder#push()} is called, it may no longer be valid
- * to push a request and the push request will be ignored.
+ * @return A builder that can be used to generate push requests based on this request or {@code null} if push is not
+ * supported. Note that even if a PushBuilder instance is returned, by the time that
+ * {@link PushBuilder#push()} is called, it may no longer be valid to push a request and the push
+ * request will be ignored.
*
* @since Servlet 4.0
*/
@@ -265,80 +234,68 @@ public interface HttpServletRequest extends ServletRequest {
}
/**
- * Returns the portion of the request URI that indicates the context of the
- * request. The context path always comes first in a request URI. The path
- * starts with a "/" character but does not end with a "/" character. For
- * servlets in the default (root) context, this method returns "". The
- * container does not decode this string.
+ * Returns the portion of the request URI that indicates the context of the request. The context path always comes
+ * first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets
+ * in the default (root) context, this method returns "". The container does not decode this string.
*
- * @return a <code>String</code> specifying the portion of the request URI
- * that indicates the context of the request
+ * @return a <code>String</code> specifying the portion of the request URI that indicates the context of the request
*/
public String getContextPath();
/**
- * Returns the query string that is contained in the request URL after the
- * path. This method returns <code>null</code> if the URL does not have a
- * query string. Same as the value of the CGI variable QUERY_STRING.
+ * Returns the query string that is contained in the request URL after the path. This method returns
+ * <code>null</code> if the URL does not have a query string. Same as the value of the CGI variable QUERY_STRING.
*
- * @return a <code>String</code> containing the query string or
- * <code>null</code> if the URL contains no query string. The value
- * is not decoded by the container.
+ * @return a <code>String</code> containing the query string or <code>null</code> if the URL contains no query
+ * string. The value is not decoded by the container.
*/
public String getQueryString();
/**
- * Returns the login of the user making this request, if the user has been
- * authenticated, or <code>null</code> if the user has not been
- * authenticated. Whether the user name is sent with each subsequent request
- * depends on the browser and type of authentication. Same as the value of
- * the CGI variable REMOTE_USER.
+ * Returns the login of the user making this request, if the user has been authenticated, or <code>null</code> if
+ * the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the
+ * browser and type of authentication. Same as the value of the CGI variable REMOTE_USER.
*
- * @return a <code>String</code> specifying the login of the user making
- * this request, or <code>null</code> if the user login is not known
+ * @return a <code>String</code> specifying the login of the user making this request, or <code>null</code> if the
+ * user login is not known
*/
public String getRemoteUser();
/**
- * Returns a boolean indicating whether the authenticated user is included
- * in the specified logical "role". Roles and role membership can be defined
- * using deployment descriptors. If the user has not been authenticated, the
+ * Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles
+ * and role membership can be defined using deployment descriptors. If the user has not been authenticated, the
* method returns <code>false</code>.
*
- * @param role
- * a <code>String</code> specifying the name of the role
- * @return a <code>boolean</code> indicating whether the user making this
- * request belongs to a given role; <code>false</code> if the user
- * has not been authenticated
+ * @param role a <code>String</code> specifying the name of the role
+ *
+ * @return a <code>boolean</code> indicating whether the user making this request belongs to a given role;
+ * <code>false</code> if the user has not been authenticated
*/
public boolean isUserInRole(String role);
/**
- * Returns a <code>java.security.Principal</code> object containing the name
- * of the current authenticated user. If the user has not been
- * authenticated, the method returns <code>null</code>.
+ * Returns a <code>java.security.Principal</code> object containing the name of the current authenticated user. If
+ * the user has not been authenticated, the method returns <code>null</code>.
*
- * @return a <code>java.security.Principal</code> containing the name of the
- * user making this request; <code>null</code> if the user has not
- * been authenticated
+ * @return a <code>java.security.Principal</code> containing the name of the user making this request;
+ * <code>null</code> if the user has not been authenticated
*/
public java.security.Principal getUserPrincipal();
/**
- * Returns the session ID specified by the client. This may not be the same
- * as the ID of the current valid session for this request. If the client
- * did not specify a session ID, this method returns <code>null</code>.
+ * Returns the session ID specified by the client. This may not be the same as the ID of the current valid session
+ * for this request. If the client did not specify a session ID, this method returns <code>null</code>.
+ *
+ * @return a <code>String</code> specifying the session ID, or <code>null</code> if the request did not specify a
+ * session ID
*
- * @return a <code>String</code> specifying the session ID, or
- * <code>null</code> if the request did not specify a session ID
* @see #isRequestedSessionIdValid
*/
public String getRequestedSessionId();
/**
- * Returns the part of this request's URL from the protocol name up to the
- * query string in the first line of the HTTP request. The web container
- * does not decode this String. For example:
+ * Returns the part of this request's URL from the protocol name up to the query string in the first line of the
+ * HTTP request. The web container does not decode this String. For example:
* <table>
* <caption>Examples of Returned Values</caption>
* <tr>
@@ -358,91 +315,82 @@ public interface HttpServletRequest extends ServletRequest {
* <td>/xyz
* </table>
* <p>
- * To reconstruct a URL with a scheme and host, use
- * {@link #getRequestURL}.
+ * To reconstruct a URL with a scheme and host, use {@link #getRequestURL}.
+ *
+ * @return a <code>String</code> containing the part of the URL from the protocol name up to the query string
*
- * @return a <code>String</code> containing the part of the URL from the
- * protocol name up to the query string
* @see #getRequestURL
*/
public String getRequestURI();
/**
- * Reconstructs the URL the client used to make the request. The returned
- * URL contains a protocol, server name, port number, and server path, but
- * it does not include query string parameters.
+ * Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port
+ * number, and server path, but it does not include query string parameters.
* <p>
- * Because this method returns a <code>StringBuffer</code>, not a string,
- * you can modify the URL easily, for example, to append query parameters.
+ * Because this method returns a <code>StringBuffer</code>, not a string, you can modify the URL easily, for
+ * example, to append query parameters.
* <p>
- * This method is useful for creating redirect messages and for reporting
- * errors.
+ * This method is useful for creating redirect messages and for reporting errors.
*
- * @return a <code>StringBuffer</code> object containing the reconstructed
- * URL
+ * @return a <code>StringBuffer</code> object containing the reconstructed URL
*/
public StringBuffer getRequestURL();
/**
- * Returns the part of this request's URL that calls the servlet. This path
- * starts with a "/" character and includes either the servlet name or a
- * path to the servlet, but does not include any extra path information or a
- * query string. Same as the value of the CGI variable SCRIPT_NAME.
+ * Returns the part of this request's URL that calls the servlet. This path starts with a "/" character and includes
+ * either the servlet name or a path to the servlet, but does not include any extra path information or a query
+ * string. Same as the value of the CGI variable SCRIPT_NAME.
* <p>
- * The URL will be canonicalized as per section 3.5 of the specification
- * before the path information, if any, is extracted.
+ * The URL will be canonicalized as per section 3.5 of the specification before the path information, if any, is
+ * extracted.
* <p>
- * This method will return an empty string ("") if the servlet used to
- * process this request was matched using the "/*" pattern.
+ * This method will return an empty string ("") if the servlet used to process this request was matched using the
+ * "/*" pattern.
*
- * @return a <code>String</code>, canonicalized by the web container,
- * containing the name or path of the servlet being called, as
- * specified in the request URL, or an empty string if the servlet
- * used to process the request is matched using the "/*" pattern.
+ * @return a <code>String</code>, canonicalized by the web container, containing the name or path of the servlet
+ * being called, as specified in the request URL, or an empty string if the servlet used to process the
+ * request is matched using the "/*" pattern.
*/
public String getServletPath();
/**
- * Returns the current <code>HttpSession</code> associated with this request
- * or, if there is no current session and <code>create</code> is true,
- * returns a new session.
+ * Returns the current <code>HttpSession</code> associated with this request or, if there is no current session and
+ * <code>create</code> is true, returns a new session.
* <p>
- * If <code>create</code> is <code>false</code> and the request has no valid
- * <code>HttpSession</code>, this method returns <code>null</code>.
+ * If <code>create</code> is <code>false</code> and the request has no valid <code>HttpSession</code>, this method
+ * returns <code>null</code>.
* <p>
- * To make sure the session is properly maintained, you must call this
- * method before the response is committed. If the container is using
- * cookies to maintain session integrity and is asked to create a new
- * session when the response is committed, an IllegalStateException is
- * thrown.
- *
- * @param create
- * <code>true</code> to create a new session for this request if
- * necessary; <code>false</code> to return <code>null</code> if
- * there's no current session
- * @return the <code>HttpSession</code> associated with this request or
- * <code>null</code> if <code>create</code> is <code>false</code>
- * and the request has no valid session
+ * To make sure the session is properly maintained, you must call this method before the response is committed. If
+ * the container is using cookies to maintain session integrity and is asked to create a new session when the
+ * response is committed, an IllegalStateException is thrown.
+ *
+ * @param create <code>true</code> to create a new session for this request if necessary; <code>false</code> to
+ * return <code>null</code> if there's no current session
+ *
+ * @return the <code>HttpSession</code> associated with this request or <code>null</code> if <code>create</code> is
+ * <code>false</code> and the request has no valid session
+ *
* @see #getSession()
*/
public HttpSession getSession(boolean create);
/**
- * Returns the current session associated with this request, or if the
- * request does not have a session, creates one.
+ * Returns the current session associated with this request, or if the request does not have a session, creates one.
*
* @return the <code>HttpSession</code> associated with this request
+ *
* @see #getSession(boolean)
*/
public HttpSession getSession();
/**
- * Changes the session ID of the session associated with this request. This
- * method does not create a new session object it only changes the ID of the
- * current session.
+ * Changes the session ID of the session associated with this request. This method does not create a new session
+ * object it only changes the ID of the current session.
*
* @return the new session ID allocated to the session
+ *
* @see HttpSessionIdListener
+ *
* @since Servlet 3.1
*/
public String changeSessionId();
@@ -450,8 +398,9 @@ public interface HttpServletRequest extends ServletRequest {
/**
* Checks whether the requested session ID is still valid.
*
- * @return <code>true</code> if this request has an id for a valid session
- * in the current session context; <code>false</code> otherwise
+ * @return <code>true</code> if this request has an id for a valid session in the current session context;
+ * <code>false</code> otherwise
+ *
* @see #getRequestedSessionId
* @see #getSession
*/
@@ -460,55 +409,49 @@ public interface HttpServletRequest extends ServletRequest {
/**
* Checks whether the requested session ID came in as a cookie.
*
- * @return <code>true</code> if the session ID came in as a cookie;
- * otherwise, <code>false</code>
+ * @return <code>true</code> if the session ID came in as a cookie; otherwise, <code>false</code>
+ *
* @see #getSession
*/
public boolean isRequestedSessionIdFromCookie();
/**
- * Checks whether the requested session ID came in as part of the request
- * URL.
+ * Checks whether the requested session ID came in as part of the request URL.
+ *
+ * @return <code>true</code> if the session ID came in as part of a URL; otherwise, <code>false</code>
*
- * @return <code>true</code> if the session ID came in as part of a URL;
- * otherwise, <code>false</code>
* @see #getSession
*/
public boolean isRequestedSessionIdFromURL();
/**
- * Triggers the same authentication process as would be triggered if the
- * request is for a resource that is protected by a security constraint.
+ * Triggers the same authentication process as would be triggered if the request is for a resource that is protected
+ * by a security constraint.
+ *
+ * @param response The response to use to return any authentication challenge
+ *
+ * @return <code>true</code> if the user is successfully authenticated and <code>false</code> if not
*
- * @param response The response to use to return any authentication
- * challenge
- * @return <code>true</code> if the user is successfully authenticated and
- * <code>false</code> if not
+ * @throws IOException if the authentication process attempted to read from the request or write to the
+ * response and an I/O error occurred
+ * @throws IllegalStateException if the authentication process attempted to write to the response after it had been
+ * committed
+ * @throws ServletException if the authentication failed and the caller is expected to handle the failure
*
- * @throws IOException if the authentication process attempted to read from
- * the request or write to the response and an I/O error occurred
- * @throws IllegalStateException if the authentication process attempted to
- * write to the response after it had been committed
- * @throws ServletException if the authentication failed and the caller is
- * expected to handle the failure
* @since Servlet 3.0
*/
- public boolean authenticate(HttpServletResponse response)
- throws IOException, ServletException;
+ public boolean authenticate(HttpServletResponse response) throws IOException, ServletException;
/**
- * Authenticate the provided user name and password and then associated the
- * authenticated user with the request.
+ * Authenticate the provided user name and password and then associated the authenticated user with the request.
*
- * @param username The user name to authenticate
- * @param password The password to use to authenticate the user
+ * @param username The user name to authenticate
+ * @param password The password to use to authenticate the user
+ *
+ * @throws ServletException If any of {@link #getRemoteUser()}, {@link #getUserPrincipal()} or
+ * {@link #getAuthType()} are non-null, if the configured authenticator does not
+ * support user name and password authentication or if the authentication fails
*
- * @throws ServletException
- * If any of {@link #getRemoteUser()},
- * {@link #getUserPrincipal()} or {@link #getAuthType()} are
- * non-null, if the configured authenticator does not support
- * user name and password authentication or if the
- * authentication fails
* @since Servlet 3.0
*/
public void login(String username, String password) throws ServletException;
@@ -516,8 +459,8 @@ public interface HttpServletRequest extends ServletRequest {
/**
* Removes any authenticated user from the request.
*
- * @throws ServletException
- * If the logout fails
+ * @throws ServletException If the logout fails
+ *
* @since Servlet 3.0
*/
public void logout() throws ServletException;
@@ -526,79 +469,66 @@ public interface HttpServletRequest extends ServletRequest {
* Return a collection of all uploaded Parts.
*
* @return A collection of all uploaded Parts.
- * @throws IOException
- * if an I/O error occurs
- * @throws IllegalStateException
- * if size limits are exceeded or no multipart configuration is
- * provided
- * @throws ServletException
- * if the request is not multipart/form-data
+ *
+ * @throws IOException if an I/O error occurs
+ * @throws IllegalStateException if size limits are exceeded or no multipart configuration is provided
+ * @throws ServletException if the request is not multipart/form-data
+ *
* @since Servlet 3.0
*/
- public Collection<Part> getParts() throws IOException,
- ServletException;
+ public Collection<Part> getParts() throws IOException, ServletException;
/**
- * Gets the named Part or null if the Part does not exist. Triggers upload
- * of all Parts.
+ * Gets the named Part or null if the Part does not exist. Triggers upload of all Parts.
*
* @param name The name of the Part to obtain
*
* @return The named Part or null if the Part does not exist
- * @throws IOException
- * if an I/O error occurs
- * @throws IllegalStateException
- * if size limits are exceeded
- * @throws ServletException
- * if the request is not multipart/form-data
+ *
+ * @throws IOException if an I/O error occurs
+ * @throws IllegalStateException if size limits are exceeded
+ * @throws ServletException if the request is not multipart/form-data
+ *
* @since Servlet 3.0
*/
- public Part getPart(String name) throws IOException,
- ServletException;
+ public Part getPart(String name) throws IOException, ServletException;
/**
- * Start the HTTP upgrade process and create and instance of the provided
- * protocol handler class. The connection will be passed this instance once
- * the current request/response pair has completed processing. Calling this
- * method sets the response status to
- * {@link HttpServletResponse#SC_SWITCHING_PROTOCOLS}.
+ * Start the HTTP upgrade process and create and instance of the provided protocol handler class. The connection
+ * will be passed this instance once the current request/response pair has completed processing. Calling this method
+ * sets the response status to {@link HttpServletResponse#SC_SWITCHING_PROTOCOLS}.
*
* @param <T> The type of the upgrade handler
- * @param httpUpgradeHandlerClass The class that implements the upgrade
- * handler
+ * @param httpUpgradeHandlerClass The class that implements the upgrade handler
*
* @return A newly created instance of the specified upgrade handler type
*
- * @throws IOException
- * if an I/O error occurred during the upgrade
- * @throws ServletException
- * if the given httpUpgradeHandlerClass fails to be instantiated
+ * @throws IOException if an I/O error occurred during the upgrade
+ * @throws ServletException if the given httpUpgradeHandlerClass fails to be instantiated
+ *
* @since Servlet 3.1
*/
- public <T extends HttpUpgradeHandler> T upgrade(
- Class<T> httpUpgradeHandlerClass) throws java.io.IOException, ServletException;
+ public <T extends HttpUpgradeHandler> T upgrade(Class<T> httpUpgradeHandlerClass)
+ throws java.io.IOException, ServletException;
/**
- * Obtain a Map of the trailer fields that is not backed by the request
- * object.
+ * Obtain a Map of the trailer fields that is not backed by the request object.
*
- * @return A Map of the received trailer fields with all keys lower case
- * or an empty Map if no trailers are present
+ * @return A Map of the received trailer fields with all keys lower case or an empty Map if no trailers are present
*
* @since Servlet 4.0
*/
- public default Map<String,String> getTrailerFields() {
+ public default Map<String, String> getTrailerFields() {
return Collections.emptyMap();
}
/**
- * Are trailer fields ready to be read (there may still be no trailers to
- * read). This method always returns {@code true} if the underlying protocol
- * does not support trailer fields. Otherwise, {@code true} is returned once
+ * Are trailer fields ready to be read (there may still be no trailers to read). This method always returns
+ * {@code true} if the underlying protocol does not support trailer fields. Otherwise, {@code true} is returned once
* all of the following are true:
* <ul>
- * <li>The application has ready all the request data and an EOF has been
- * received or the content-length is zero</li>
+ * <li>The application has ready all the request data and an EOF has been received or the content-length is
+ * zero</li>
* <li>All trailer fields, if any, have been received</li>
* </ul>
*
diff --git a/java/jakarta/servlet/http/HttpServletRequestWrapper.java b/java/jakarta/servlet/http/HttpServletRequestWrapper.java
index 3092f36176..02de8d5616 100644
--- a/java/jakarta/servlet/http/HttpServletRequestWrapper.java
+++ b/java/jakarta/servlet/http/HttpServletRequestWrapper.java
@@ -25,24 +25,22 @@ import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequestWrapper;
/**
- * Provides a convenient implementation of the HttpServletRequest 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 HttpServletRequest 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.
*
* @see jakarta.servlet.http.HttpServletRequest
+ *
* @since Servlet 2.3
*/
-public class HttpServletRequestWrapper extends ServletRequestWrapper implements
- HttpServletRequest {
+public class HttpServletRequestWrapper extends ServletRequestWrapper implements HttpServletRequest {
/**
* Constructs a request object wrapping the given request.
*
* @param request The request to wrap
*
- * @throws java.lang.IllegalArgumentException
- * if the request is null
+ * @throws java.lang.IllegalArgumentException if the request is null
*/
public HttpServletRequestWrapper(HttpServletRequest request) {
super(request);
@@ -53,8 +51,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getAuthType() on the
- * wrapped request object.
+ * The default behavior of this method is to return getAuthType() on the wrapped request object.
*/
@Override
public String getAuthType() {
@@ -62,8 +59,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getCookies() on the
- * wrapped request object.
+ * The default behavior of this method is to return getCookies() on the wrapped request object.
*/
@Override
public Cookie[] getCookies() {
@@ -71,8 +67,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getDateHeader(String
- * name) on the wrapped request object.
+ * The default behavior of this method is to return getDateHeader(String name) on the wrapped request object.
*/
@Override
public long getDateHeader(String name) {
@@ -80,8 +75,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getHeader(String name)
- * on the wrapped request object.
+ * The default behavior of this method is to return getHeader(String name) on the wrapped request object.
*/
@Override
public String getHeader(String name) {
@@ -89,8 +83,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getHeaders(String name)
- * on the wrapped request object.
+ * The default behavior of this method is to return getHeaders(String name) on the wrapped request object.
*/
@Override
public Enumeration<String> getHeaders(String name) {
@@ -98,8 +91,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getHeaderNames() on the
- * wrapped request object.
+ * The default behavior of this method is to return getHeaderNames() on the wrapped request object.
*/
@Override
public Enumeration<String> getHeaderNames() {
@@ -107,8 +99,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getIntHeader(String
- * name) on the wrapped request object.
+ * The default behavior of this method is to return getIntHeader(String name) on the wrapped request object.
*/
@Override
public int getIntHeader(String name) {
@@ -116,9 +107,8 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return
- * {@link HttpServletRequest#getHttpServletMapping()} on the wrapped request
- * object.
+ * The default behavior of this method is to return {@link HttpServletRequest#getHttpServletMapping()} on the
+ * wrapped request object.
*
* @since Servlet 4.0
*/
@@ -128,8 +118,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getMethod() on the
- * wrapped request object.
+ * The default behavior of this method is to return getMethod() on the wrapped request object.
*/
@Override
public String getMethod() {
@@ -137,8 +126,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getPathInfo() on the
- * wrapped request object.
+ * The default behavior of this method is to return getPathInfo() on the wrapped request object.
*/
@Override
public String getPathInfo() {
@@ -146,8 +134,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getPathTranslated() on
- * the wrapped request object.
+ * The default behavior of this method is to return getPathTranslated() on the wrapped request object.
*/
@Override
public String getPathTranslated() {
@@ -155,8 +142,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getContextPath() on the
- * wrapped request object.
+ * The default behavior of this method is to return getContextPath() on the wrapped request object.
*/
@Override
public String getContextPath() {
@@ -164,8 +150,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getQueryString() on the
- * wrapped request object.
+ * The default behavior of this method is to return getQueryString() on the wrapped request object.
*/
@Override
public String getQueryString() {
@@ -173,8 +158,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getRemoteUser() on the
- * wrapped request object.
+ * The default behavior of this method is to return getRemoteUser() on the wrapped request object.
*/
@Override
public String getRemoteUser() {
@@ -182,8 +166,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return isUserInRole(String
- * role) on the wrapped request object.
+ * The default behavior of this method is to return isUserInRole(String role) on the wrapped request object.
*/
@Override
public boolean isUserInRole(String role) {
@@ -191,8 +174,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getUserPrincipal() on
- * the wrapped request object.
+ * The default behavior of this method is to return getUserPrincipal() on the wrapped request object.
*/
@Override
public java.security.Principal getUserPrincipal() {
@@ -200,8 +182,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getRequestedSessionId()
- * on the wrapped request object.
+ * The default behavior of this method is to return getRequestedSessionId() on the wrapped request object.
*/
@Override
public String getRequestedSessionId() {
@@ -209,8 +190,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getRequestURI() on the
- * wrapped request object.
+ * The default behavior of this method is to return getRequestURI() on the wrapped request object.
*/
@Override
public String getRequestURI() {
@@ -218,8 +198,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getRequestURL() on the
- * wrapped request object.
+ * The default behavior of this method is to return getRequestURL() on the wrapped request object.
*/
@Override
public StringBuffer getRequestURL() {
@@ -227,8 +206,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getServletPath() on the
- * wrapped request object.
+ * The default behavior of this method is to return getServletPath() on the wrapped request object.
*/
@Override
public String getServletPath() {
@@ -236,8 +214,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getSession(boolean
- * create) on the wrapped request object.
+ * The default behavior of this method is to return getSession(boolean create) on the wrapped request object.
*/
@Override
public HttpSession getSession(boolean create) {
@@ -245,8 +222,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return getSession() on the
- * wrapped request object.
+ * The default behavior of this method is to return getSession() on the wrapped request object.
*/
@Override
public HttpSession getSession() {
@@ -254,8 +230,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to call changeSessionId() on the
- * wrapped request object.
+ * The default behavior of this method is to call changeSessionId() on the wrapped request object.
*
* @since Servlet 3.1
*/
@@ -265,8 +240,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return
- * isRequestedSessionIdValid() on the wrapped request object.
+ * The default behavior of this method is to return isRequestedSessionIdValid() on the wrapped request object.
*/
@Override
public boolean isRequestedSessionIdValid() {
@@ -274,8 +248,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return
- * isRequestedSessionIdFromCookie() on the wrapped request object.
+ * The default behavior of this method is to return isRequestedSessionIdFromCookie() on the wrapped request object.
*/
@Override
public boolean isRequestedSessionIdFromCookie() {
@@ -283,8 +256,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
}
/**
- * The default behavior of this method is to return
- * isRequestedSessionIdFromURL() on the wrapped request object.
+ * The default behavior of this method is to return isRequestedSessionIdFromURL() on the wrapped request object.
*/
@Override
public boolean isRequestedSessionIdFromURL() {
@@ -294,24 +266,21 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
/**
* {@inheritDoc}
* <p>
- * The default behavior of this method is to return
- * {@link HttpServletRequest#authenticate(HttpServletResponse)}
- * on the wrapped request object.
+ * The default behavior of this method is to return {@link HttpServletRequest#authenticate(HttpServletResponse)} on
+ * the wrapped request object.
*
* @since Servlet 3.0
*/
@Override
- public boolean authenticate(HttpServletResponse response)
- throws IOException, ServletException {
+ public boolean authenticate(HttpServletResponse response) throws IOException, ServletException {
return this._getHttpServletRequest().authenticate(response);
}
/**
* {@inheritDoc}
* <p>
- * The default behavior of this method is to return
- * {@link HttpServletRequest#login(String, String)}
- * on the wrapped request object.
+ * The default behavior of this method is to return {@link HttpServletRequest#login(String, String)} on the wrapped
+ * request object.
*
* @since Servlet 3.0
*/
@@ -323,9 +292,8 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
/**
* {@inheritDoc}
* <p>
- * The default behavior of this method is to return
- * {@link HttpServletRequest#logout()}
- * on the wrapped request object.
+ * The default behavior of this method is to return {@link HttpServletRequest#logout()} on the wrapped request
+ * object.
*
* @since Servlet 3.0
*/
@@ -337,53 +305,48 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
/**
* {@inheritDoc}
* <p>
- * The default behavior of this method is to return
- * {@link HttpServletRequest#getParts()}
- * on the wrapped request object.
+ * The default behavior of this method is to return {@link HttpServletRequest#getParts()} on the wrapped request
+ * object.
*
* @since Servlet 3.0
*/
@Override
- public Collection<Part> getParts() throws IOException,
- ServletException {
+ public Collection<Part> getParts() throws IOException, ServletException {
return this._getHttpServletRequest().getParts();
}
/**
* {@inheritDoc}
* <p>
- * The default behavior of this method is to return
- * {@link HttpServletRequest#getPart(String)}
- * on the wrapped request object.
+ * The default behavior of this method is to return {@link HttpServletRequest#getPart(String)} on the wrapped
+ * request object.
*
* @since Servlet 3.0
*/
@Override
- public Part getPart(String name) throws IOException,
- ServletException {
+ public Part getPart(String name) throws IOException, ServletException {
return this._getHttpServletRequest().getPart(name);
}
/**
* {@inheritDoc}
* <p>
- * The default behavior of this method is to return
- * {@link HttpServletRequest#upgrade(Class)} on the wrapped request object.
+ * The default behavior of this method is to return {@link HttpServletRequest#upgrade(Class)} on the wrapped request
+ * object.
*
* @since Servlet 3.1
*/
@Override
- public <T extends HttpUpgradeHandler> T upgrade(
- Class<T> httpUpgradeHandlerClass) throws IOException, ServletException {
+ public <T extends HttpUpgradeHandler> T upgrade(Class<T> httpUpgradeHandlerClass)
+ throws IOException, ServletException {
return this._getHttpServletRequest().upgrade(httpUpgradeHandlerClass);
}
/**
* {@inheritDoc}
* <p>
- * The default behavior of this method is to return
- * {@link HttpServletRequest#newPushBuilder()} on the wrapped request
- * object.
+ * The default behavior of this method is to return {@link HttpServletRequest#newPushBuilder()} on the wrapped
+ * request object.
*
* @since Servlet 4.0
*/
@@ -395,14 +358,13 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
/**
* {@inheritDoc}
* <p>
- * The default behavior of this method is to return
- * {@link HttpServletRequest#getTrailerFields()} on the wrapped request
- * object.
+ * The default behavior of this method is to return {@link HttpServletRequest#getTrailerFields()} on the wrapped
+ * request object.
*
* @since Servlet 4.0
*/
@Override
- public Map<String,String> getTrailerFields() {
+ public Map<String, String> getTrailerFields() {
return this._getHttpServletRequest().getTrailerFields();
}
@@ -410,9 +372,8 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements
/**
* {@inheritDoc}
* <p>
- * The default behavior of this method is to return
- * {@link HttpServletRequest#isTrailerFieldsReady()} on the wrapped request
- * object.
+ * The default behavior of this method is to return {@link HttpServletRequest#isTrailerFieldsReady()} on the wrapped
+ * request object.
*
* @since Servlet 4.0
*/
diff --git a/java/jakarta/servlet/http/HttpServletResponse.java b/java/jakarta/servlet/http/HttpServletResponse.java
index 816e2fa6ef..7b1e84e2fa 100644
--- a/java/jakarta/servlet/http/HttpServletResponse.java
+++ b/java/jakarta/servlet/http/HttpServletResponse.java
@@ -24,236 +24,194 @@ import java.util.function.Supplier;
import jakarta.servlet.ServletResponse;
/**
- * Extends the {@link ServletResponse} interface to provide HTTP-specific
- * functionality in sending a response. For example, it has methods to access
- * HTTP headers and cookies.
+ * Extends the {@link ServletResponse} interface to provide HTTP-specific functionality in sending a response. For
+ * example, it has methods to access HTTP headers and cookies.
* <p>
- * The servlet container creates an <code>HttpServletResponse</code> object and
- * passes it as an argument to the servlet's service methods (<code>doGet</code>, <code>doPost</code>, etc).
+ * The servlet container creates an <code>HttpServletResponse</code> object and passes it as an argument to the
+ * servlet's service methods (<code>doGet</code>, <code>doPost</code>, etc).
*
* @see jakarta.servlet.ServletResponse
*/
public interface HttpServletResponse extends ServletResponse {
/**
- * Adds the specified cookie to the response. This method can be called
- * multiple times to set more than one cookie.
+ * Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie.
*
- * @param cookie
- * the Cookie to return to the client
+ * @param cookie the Cookie to return to the client
*/
public void addCookie(Cookie cookie);
/**
- * Returns a boolean indicating whether the named response header has
- * already been set.
+ * Returns a boolean indicating whether the named response header has already been set.
*
- * @param name
- * the header name
- * @return <code>true</code> if the named response header has already been
- * set; <code>false</code> otherwise
+ * @param name the header name
+ *
+ * @return <code>true</code> if the named response header has already been set; <code>false</code> otherwise
*/
public boolean containsHeader(String name);
/**
- * Encodes the specified URL by including the session ID in it, or, if
- * encoding is not needed, returns the URL unchanged. The implementation of
- * this method includes the logic to determine whether the session ID needs
- * to be encoded in the URL. For example, if the browser supports cookies,
- * or session tracking is turned off, URL encoding is unnecessary.
+ * Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL
+ * unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be
+ * encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding
+ * is unnecessary.
* <p>
- * For robust session tracking, all URLs emitted by a servlet should be run
- * through this method. Otherwise, URL rewriting cannot be used with
- * browsers which do not support cookies.
+ * For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL
+ * rewriting cannot be used with browsers which do not support cookies.
+ *
+ * @param url the url to be encoded.
*
- * @param url
- * the url to be encoded.
- * @return the encoded URL if encoding is needed; the unchanged URL
- * otherwise.
+ * @return the encoded URL if encoding is needed; the unchanged URL otherwise.
*/
public String encodeURL(String url);
/**
- * Encodes the specified URL for use in the <code>sendRedirect</code> method
- * or, if encoding is not needed, returns the URL unchanged. The
- * implementation of this method includes the logic to determine whether the
- * session ID needs to be encoded in the URL. Because the rules for making
- * this determination can differ from those used to decide whether to encode
- * a normal link, this method is separated from the <code>encodeURL</code>
- * method.
+ * Encodes the specified URL for use in the <code>sendRedirect</code> method or, if encoding is not needed, returns
+ * the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs
+ * to be encoded in the URL. Because the rules for making this determination can differ from those used to decide
+ * whether to encode a normal link, this method is separated from the <code>encodeURL</code> method.
* <p>
- * All URLs sent to the <code>HttpServletResponse.sendRedirect</code> method
- * should be run through this method. Otherwise, URL rewriting cannot be
- * used with browsers which do not support cookies.
- *
- * @param url
- * the url to be encoded.
- * @return the encoded URL if encoding is needed; the unchanged URL
- * otherwise.
+ * All URLs sent to the <code>HttpServletResponse.sendRedirect</code> method should be run through this method.
+ * Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
+ *
+ * @param url the url to be encoded.
+ *
+ * @return the encoded URL if encoding is needed; the unchanged URL otherwise.
+ *
* @see #sendRedirect
*/
public String encodeRedirectURL(String url);
/**
- * Sends an error response to the client using the specified status code and
- * clears the output buffer. The server defaults to creating the response to
- * look like an HTML-formatted server error page containing the specified
- * message, setting the content type to "text/html", leaving cookies and
- * other headers unmodified. If an error-page declaration has been made for
- * the web application corresponding to the status code passed in, it will
- * be served back in preference to the suggested msg parameter.
+ * Sends an error response to the client using the specified status code and clears the output buffer. The server
+ * defaults to creating the response to look like an HTML-formatted server error page containing the specified
+ * message, setting the content type to "text/html", leaving cookies and other headers unmodified. If an error-page
+ * declaration has been made for the web application corresponding to the status code passed in, it will be served
+ * back in preference to the suggested msg parameter.
* <p>
- * If the response has already been committed, this method throws an
- * IllegalStateException. After using this method, the response should be
- * considered to be committed and should not be written to.
- *
- * @param sc
- * the error status code
- * @param msg
- * the descriptive message
- * @exception IOException
- * If an input or output exception occurs
- * @exception IllegalStateException
- * If the response was committed
+ * If the response has already been committed, this method throws an IllegalStateException. After using this method,
+ * the response should be considered to be committed and should not be written to.
+ *
+ * @param sc the error status code
+ * @param msg the descriptive message
+ *
+ * @exception IOException If an input or output exception occurs
+ * @exception IllegalStateException If the response was committed
*/
public void sendError(int sc, String msg) throws IOException;
/**
- * Sends an error response to the client using the specified status code and
- * clears the buffer. This is equivalent to calling {@link #sendError(int,
- * String)} with the same status code and <code>null</code> for the message.
+ * Sends an error response to the client using the specified status code and clears the buffer. This is equivalent
+ * to calling {@link #sendError(int, String)} with the same status code and <code>null</code> for the message.
*
- * @param sc
- * the error status code
- * @exception IOException
- * If an input or output exception occurs
- * @exception IllegalStateException
- * If the response was committed before this method call
+ * @param sc the error status code
+ *
+ * @exception IOException If an input or output exception occurs
+ * @exception IllegalStateException If the response was committed before this method call
*/
public void sendError(int sc) throws IOException;
/**
- * Sends a temporary redirect response to the client using the specified
- * redirect location URL. This method can accept relative URLs; the servlet
- * container must convert the relative URL to an absolute URL before sending
- * the response to the client. If the location is relative without a leading
- * '/' the container interprets it as relative to the current request URI.
- * If the location is relative with a leading '/' the container interprets
- * it as relative to the servlet container root.
+ * Sends a temporary redirect response to the client using the specified redirect location URL. This method can
+ * accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the
+ * response to the client. If the location is relative without a leading '/' the container interprets it as relative
+ * to the current request URI. If the location is relative with a leading '/' the container interprets it as
+ * relative to the servlet container root.
* <p>
- * If the response has already been committed, this method throws an
- * IllegalStateException. After using this method, the response should be
- * considered to be committed and should not be written to.
- *
- * @param location
- * the redirect location URL
- * @exception IOException
- * If an input or output exception occurs
- * @exception IllegalStateException
- * If the response was committed or if a partial URL is given
- * and cannot be converted into a valid URL
+ * If the response has already been committed, this method throws an IllegalStateException. After using this method,
+ * the response should be considered to be committed and should not be written to.
+ *
+ * @param location the redirect location URL
+ *
+ * @exception IOException If an input or output exception occurs
+ * @exception IllegalStateException If the response was committed or if a partial URL is given and cannot be
+ * converted into a valid URL
*/
public void sendRedirect(String location) throws IOException;
/**
- * Sets a response header with the given name and date-value. The date is
- * specified in terms of milliseconds since the epoch. If the header had
- * already been set, the new value overwrites the previous one. The
- * <code>containsHeader</code> method can be used to test for the presence
- * of a header before setting its value.
+ * Sets a response header with the given name and date-value. The date is specified in terms of milliseconds since
+ * the epoch. If the header had already been set, the new value overwrites the previous one. The
+ * <code>containsHeader</code> method can be used to test for the presence of a header before setting its value.
+ *
+ * @param name the name of the header to set
+ * @param date the assigned date value
*
- * @param name
- * the name of the header to set
- * @param date
- * the assigned date value
* @see #containsHeader
* @see #addDateHeader
*/
public void setDateHeader(String name, long date);
/**
- * Adds a response header with the given name and date-value. The date is
- * specified in terms of milliseconds since the epoch. This method allows
- * response headers to have multiple values.
+ * Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since
+ * the epoch. This method allows response headers to have multiple values.
+ *
+ * @param name the name of the header to set
+ * @param date the additional date value
*
- * @param name
- * the name of the header to set
- * @param date
- * the additional date value
* @see #setDateHeader
*/
public void addDateHeader(String name, long date);
/**
- * Sets a response header with the given name and value. If the header had
- * already been set, the new value overwrites the previous one. The
- * <code>containsHeader</code> method can be used to test for the presence
- * of a header before setting its value.
+ * Sets a response header with the given name and value. If the header had already been set, the new value
+ * overwrites the previous one. The <code>containsHeader</code> method can be used to test for the presence of a
+ * header before setting its value.
+ *
+ * @param name the name of the header
+ * @param value the header value If it contains octet string, it should be encoded according to RFC 2047
+ * (http://www.ietf.org/rfc/rfc2047.txt)
*
- * @param name
- * the name of the header
- * @param value
- * the header value If it contains octet string, it should be
- * encoded according to RFC 2047
- * (http://www.ietf.org/rfc/rfc2047.txt)
* @see #containsHeader
* @see #addHeader
*/
public void setHeader(String name, String value);
/**
- * Adds a response header with the given name and value. This method allows
- * response headers to have multiple values.
+ * Adds a response header with the given name and value. This method allows response headers to have multiple
+ * values.
+ *
+ * @param name the name of the header
+ * @param value the additional header value If it contains octet string, it should be encoded according to RFC 2047
+ * (http://www.ietf.org/rfc/rfc2047.txt)
*
- * @param name
- * the name of the header
- * @param value
- * the additional header value If it contains octet string, it
- * should be encoded according to RFC 2047
- * (http://www.ietf.org/rfc/rfc2047.txt)
* @see #setHeader
*/
public void addHeader(String name, String value);
/**
- * Sets a response header with the given name and integer value. If the
- * header had already been set, the new value overwrites the previous one.
- * The <code>containsHeader</code> method can be used to test for the
- * presence of a header before setting its value.
+ * Sets a response header with the given name and integer value. If the header had already been set, the new value
+ * overwrites the previous one. The <code>containsHeader</code> method can be used to test for the presence of a
+ * header before setting its value.
+ *
+ * @param name the name of the header
+ * @param value the assigned integer value
*
- * @param name
- * the name of the header
- * @param value
- * the assigned integer value
* @see #containsHeader
* @see #addIntHeader
*/
public void setIntHeader(String name, int value);
/**
- * Adds a response header with the given name and integer value. This method
- * allows response headers to have multiple values.
+ * Adds a response header with the given name and integer value. This method allows response headers to have
+ * multiple values.
+ *
+ * @param name the name of the header
+ * @param value the assigned integer value
*
- * @param name
- * the name of the header
- * @param value
- * the assigned integer value
* @see #setIntHeader
*/
public void addIntHeader(String name, int value);
/**
- * Sets the status code for this response. This method is used to set the
- * return status code when there is no error (for example, for the status
- * codes SC_OK or SC_MOVED_TEMPORARILY). If there is an error, and the
- * caller wishes to invoke an error-page defined in the web application, the
- * <code>sendError</code> method should be used instead.
+ * Sets the status code for this response. This method is used to set the return status code when there is no error
+ * (for example, for the status codes SC_OK or SC_MOVED_TEMPORARILY). If there is an error, and the caller wishes to
+ * invoke an error-page defined in the web application, the <code>sendError</code> method should be used instead.
* <p>
- * The container clears the buffer and sets the Location header, preserving
- * cookies and other headers.
+ * The container clears the buffer and sets the Location header, preserving cookies and other headers.
+ *
+ * @param sc the status code
*
- * @param sc
- * the status code
* @see #sendError
*/
public void setStatus(int sc);
@@ -268,30 +226,26 @@ public interface HttpServletResponse extends ServletResponse {
public int getStatus();
/**
- * Return the value for the specified header, or <code>null</code> if this
- * header has not been set. If more than one value was added for this
- * name, only the first is returned; use {@link #getHeaders(String)} to
- * retrieve all of them.
+ * Return the value for the specified header, or <code>null</code> if this header has not been set. If more than one
+ * value was added for this name, only the first is returned; use {@link #getHeaders(String)} to retrieve all of
+ * them.
*
* @param name Header name to look up
*
- * @return The first value for the specified header. This is the raw value
- * so if multiple values are specified in the first header then they
- * will be returned as a single header value .
+ * @return The first value for the specified header. This is the raw value so if multiple values are specified in
+ * the first header then they will be returned as a single header value .
*
* @since Servlet 3.0
*/
public String getHeader(String name);
/**
- * Return a Collection of all the header values associated with the
- * specified header name.
+ * Return a Collection of all the header values associated with the specified header name.
*
* @param name Header name to look up
*
- * @return The values for the specified header. These are the raw values so
- * if multiple values are specified in a single header that will be
- * returned as a single header value.
+ * @return The values for the specified header. These are the raw values so if multiple values are specified in a
+ * single header that will be returned as a single header value.
*
* @since Servlet 3.0
*/
@@ -307,19 +261,15 @@ public interface HttpServletResponse extends ServletResponse {
public Collection<String> getHeaderNames();
/**
- * Configure the supplier of the trailer headers. The supplier will be
- * called in the scope of the thread that completes the response.
- * <br>
- * Trailers that don't meet the requirements of RFC 7230, section 4.1.2 will
- * be ignored.
- * <br>
+ * Configure the supplier of the trailer headers. The supplier will be called in the scope of the thread that
+ * completes the response. <br>
+ * Trailers that don't meet the requirements of RFC 7230, section 4.1.2 will be ignored. <br>
* The default implementation is a NO-OP.
*
* @param supplier The supplier for the trailer headers
*
- * @throws IllegalStateException if this method is called when the
- * underlying protocol does not support trailer headers or if using
- * HTTP/1.1 and the response has already been committed
+ * @throws IllegalStateException if this method is called when the underlying protocol does not support trailer
+ * headers or if using HTTP/1.1 and the response has already been committed
*
* @since Servlet 4.0
*/
@@ -328,8 +278,7 @@ public interface HttpServletResponse extends ServletResponse {
}
/**
- * Obtain the supplier of the trailer headers.
- * <br>
+ * Obtain the supplier of the trailer headers. <br>
* The default implementation returns null.
*
* @return The supplier for the trailer headers
@@ -350,8 +299,7 @@ public interface HttpServletResponse extends ServletResponse {
public static final int SC_CONTINUE = 100;
/**
- * Status code (101) indicating the server is switching protocols according
- * to Upgrade header.
+ * Status code (101) indicating the server is switching protocols according to Upgrade header.
*/
public static final int SC_SWITCHING_PROTOCOLS = 101;
@@ -361,106 +309,92 @@ public interface HttpServletResponse extends ServletResponse {
public static final int SC_OK = 200;
/**
- * Status code (201) indicating the request succeeded and created a new
- * resource on the server.
+ * Status code (201) indicating the request succeeded and created a new resource on the server.
*/
public static final int SC_CREATED = 201;
/**
- * Status code (202) indicating that a request was accepted for processing,
- * but was not completed.
+ * Status code (202) indicating that a request was accepted for processing, but was not completed.
*/
public static final int SC_ACCEPTED = 202;
/**
- * Status code (203) indicating that the meta information presented by the
- * client did not originate from the server.
+ * Status code (203) indicating that the meta information presented by the client did not originate from the server.
*/
public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203;
/**
- * Status code (204) indicating that the request succeeded but that there
- * was no new information to return.
+ * Status code (204) indicating that the request succeeded but that there was no new information to return.
*/
public static final int SC_NO_CONTENT = 204;
/**
- * Status code (205) indicating that the agent <em>SHOULD</em> reset the
- * document view which caused the request to be sent.
+ * Status code (205) indicating that the agent <em>SHOULD</em> reset the document view which caused the request to
+ * be sent.
*/
public static final int SC_RESET_CONTENT = 205;
/**
- * Status code (206) indicating that the server has fulfilled the partial
- * GET request for the resource.
+ * Status code (206) indicating that the server has fulfilled the partial GET request for the resource.
*/
public static final int SC_PARTIAL_CONTENT = 206;
/**
- * Status code (300) indicating that the requested resource corresponds to
- * any one of a set of representations, each with its own specific location.
+ * Status code (300) indicating that the requested resource corresponds to any one of a set of representations, each
+ * with its own specific location.
*/
public static final int SC_MULTIPLE_CHOICES = 300;
/**
- * Status code (301) indicating that the resource has permanently moved to a
- * new location, and that future references should use a new URI with their
- * requests.
+ * Status code (301) indicating that the resource has permanently moved to a new location, and that future
+ * references should use a new URI with their requests.
*/
public static final int SC_MOVED_PERMANENTLY = 301;
/**
- * Status code (302) indicating that the resource has temporarily moved to
- * another location, but that future references should still use the
- * original URI to access the resource. This definition is being retained
- * for backwards compatibility. SC_FOUND is now the preferred definition.
+ * Status code (302) indicating that the resource has temporarily moved to another location, but that future
+ * references should still use the original URI to access the resource. This definition is being retained for
+ * backwards compatibility. SC_FOUND is now the preferred definition.
*/
public static final int SC_MOVED_TEMPORARILY = 302;
/**
- * Status code (302) indicating that the resource reside temporarily under a
- * different URI. Since the redirection might be altered on occasion, the
- * client should continue to use the Request-URI for future
- * requests.(HTTP/1.1) To represent the status code (302), it is recommended
- * to use this variable.
+ * Status code (302) indicating that the resource reside temporarily under a different URI. Since the redirection
+ * might be altered on occasion, the client should continue to use the Request-URI for future requests.(HTTP/1.1) To
+ * represent the status code (302), it is recommended to use this variable.
*/
public static final int SC_FOUND = 302;
/**
- * Status code (303) indicating that the response to the request can be
- * found under a different URI.
+ * Status code (303) indicating that the response to the request can be found under a different URI.
*/
public static final int SC_SEE_OTHER = 303;
/**
- * Status code (304) indicating that a conditional GET operation found that
- * the resource was available and not modified.
+ * Status code (304) indicating that a conditional GET operation found that the resource was available and not
+ * modified.
*/
public static final int SC_NOT_MODIFIED = 304;
/**
- * Status code (305) indicating that the requested resource <em>MUST</em> be
- * accessed through the proxy given by the <code><em>Location</em></code>
- * field.
+ * Status code (305) indicating that the requested resource <em>MUST</em> be accessed through the proxy given by the
+ * <code><em>Location</em></code> field.
*/
public static final int SC_USE_PROXY = 305;
/**
- * Status code (307) indicating that the requested resource resides
- * temporarily under a different URI. The temporary URI <em>SHOULD</em> be
- * given by the <code><em>Location</em></code> field in the response.
+ * Status code (307) indicating that the requested resource resides temporarily under a different URI. The temporary
+ * URI <em>SHOULD</em> be given by the <code><em>Location</em></code> field in the response.
*/
public static final int SC_TEMPORARY_REDIRECT = 307;
/**
- * Status code (400) indicating the request sent by the client was
- * syntactically incorrect.
+ * Status code (400) indicating the request sent by the client was syntactically incorrect.
*/
public static final int SC_BAD_REQUEST = 400;
/**
- * Status code (401) indicating that the request requires HTTP
- * authentication.
+ * Status code (401) indicating that the request requires HTTP authentication.
*/
public static final int SC_UNAUTHORIZED = 401;
@@ -470,137 +404,120 @@ public interface HttpServletResponse extends ServletResponse {
public static final int SC_PAYMENT_REQUIRED = 402;
/**
- * Status code (403) indicating the server understood the request but
- * refused to fulfill it.
+ * Status code (403) indicating the server understood the request but refused to fulfill it.
*/
public static final int SC_FORBIDDEN = 403;
/**
- * Status code (404) indicating that the requested resource is not
- * available.
+ * Status code (404) indicating that the requested resource is not available.
*/
public static final int SC_NOT_FOUND = 404;
/**
- * Status code (405) indicating that the method specified in the
- * <code><em>Request-Line</em></code> is not allowed for the resource
- * identified by the <code><em>Request-URI</em></code>.
+ * Status code (405) indicating that the method specified in the <code><em>Request-Line</em></code> is not allowed
+ * for the resource identified by the <code><em>Request-URI</em></code>.
*/
public static final int SC_METHOD_NOT_ALLOWED = 405;
/**
- * Status code (406) indicating that the resource identified by the request
- * is only capable of generating response entities which have content
- * characteristics not acceptable according to the accept headers sent in
- * the request.
+ * Status code (406) indicating that the resource identified by the request is only capable of generating response
+ * entities which have content characteristics not acceptable according to the accept headers sent in the request.
*/
public static final int SC_NOT_ACCEPTABLE = 406;
/**
- * Status code (407) indicating that the client <em>MUST</em> first
- * authenticate itself with the proxy.
+ * Status code (407) indicating that the client <em>MUST</em> first authenticate itself with the proxy.
*/
public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
/**
- * Status code (408) indicating that the client did not produce a request
- * within the time that the server was prepared to wait.
+ * Status code (408) indicating that the client did not produce a request within the time that the server was
+ * prepared to wait.
*/
public static final int SC_REQUEST_TIMEOUT = 408;
/**
- * Status code (409) indicating that the request could not be completed due
- * to a conflict with the current state of the resource.
+ * Status code (409) indicating that the request could not be completed due to a conflict with the current state of
+ * the resource.
*/
public static final int SC_CONFLICT = 409;
/**
- * Status code (410) indicating that the resource is no longer available at
- * the server and no forwarding address is known. This condition
- * <em>SHOULD</em> be considered permanent.
+ * Status code (410) indicating that the resource is no longer available at the server and no forwarding address is
+ * known. This condition <em>SHOULD</em> be considered permanent.
*/
public static final int SC_GONE = 410;
/**
- * Status code (411) indicating that the request cannot be handled without a
- * defined <code><em>Content-Length</em></code>.
+ * Status code (411) indicating that the request cannot be handled without a defined
+ * <code><em>Content-Length</em></code>.
*/
public static final int SC_LENGTH_REQUIRED = 411;
/**
- * Status code (412) indicating that the precondition given in one or more
- * of the request-header fields evaluated to false when it was tested on the
- * server.
+ * Status code (412) indicating that the precondition given in one or more of the request-header fields evaluated to
+ * false when it was tested on the server.
*/
public static final int SC_PRECONDITION_FAILED = 412;
/**
- * Status code (413) indicating that the server is refusing to process the
- * request because the request entity is larger than the server is willing
- * or able to process.
+ * Status code (413) indicating that the server is refusing to process the request because the request entity is
+ * larger than the server is willing or able to process.
*/
public static final int SC_REQUEST_ENTITY_TOO_LARGE = 413;
/**
- * Status code (414) indicating that the server is refusing to service the
- * request because the <code><em>Request-URI</em></code> is longer than the
- * server is willing to interpret.
+ * Status code (414) indicating that the server is refusing to service the request because the
+ * <code><em>Request-URI</em></code> is longer than the server is willing to interpret.
*/
public static final int SC_REQUEST_URI_TOO_LONG = 414;
/**
- * Status code (415) indicating that the server is refusing to service the
- * request because the entity of the request is in a format not supported by
- * the requested resource for the requested method.
+ * Status code (415) indicating that the server is refusing to service the request because the entity of the request
+ * is in a format not supported by the requested resource for the requested method.
*/
public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
/**
- * Status code (416) indicating that the server cannot serve the requested
- * byte range.
+ * Status code (416) indicating that the server cannot serve the requested byte range.
*/
public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
/**
- * Status code (417) indicating that the server could not meet the
- * expectation given in the Expect request header.
+ * Status code (417) indicating that the server could not meet the expectation given in the Expect request header.
*/
public static final int SC_EXPECTATION_FAILED = 417;
/**
- * Status code (500) indicating an error inside the HTTP server which
- * prevented it from fulfilling the request.
+ * Status code (500) indicating an error inside the HTTP server which prevented it from fulfilling the request.
*/
public static final int SC_INTERNAL_SERVER_ERROR = 500;
/**
- * Status code (501) indicating the HTTP server does not support the
- * functionality needed to fulfill the request.
+ * Status code (501) indicating the HTTP server does not support the functionality needed to fulfill the request.
*/
public static final int SC_NOT_IMPLEMENTED = 501;
/**
- * Status code (502) indicating that the HTTP server received an invalid
- * response from a server it consulted when acting as a proxy or gateway.
+ * Status code (502) indicating that the HTTP server received an invalid response from a server it consulted when
+ * acting as a proxy or gateway.
*/
public static final int SC_BAD_GATEWAY = 502;
/**
- * Status code (503) indicating that the HTTP server is temporarily
- * overloaded, and unable to handle the request.
+ * Status code (503) indicating that the HTTP server is temporarily overloaded, and unable to handle the request.
*/
public static final int SC_SERVICE_UNAVAILABLE = 503;
/**
- * Status code (504) indicating that the server did not receive a timely
- * response from the upstream server while acting as a gateway or proxy.
+ * Status code (504) indicating that the server did not receive a timely response from the upstream server while
+ * acting as a gateway or proxy.
*/
public static final int SC_GATEWAY_TIMEOUT = 504;
/**
- * Status code (505) indicating that the server does not support or refuses
- * to support the HTTP protocol version that was used in the request
- * message.
+ * Status code (505) indicating that the server does not support or refuses to support the HTTP protocol version
+ * that was used in the request message.
*/
public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
}
diff --git a/java/jakarta/servlet/http/HttpServletResponseWrapper.java b/java/jakarta/servlet/http/HttpServletResponseWrapper.java
index edbdc4b577..e6c491e55b 100644
--- a/java/jakarta/servlet/http/HttpServletResponseWrapper.java
+++ b/java/jakarta/servlet/http/HttpServletResponseWrapper.java
@@ -24,24 +24,22 @@ import java.util.function.Supplier;
import jakarta.servlet.ServletResponseWrapper;
/**
- * Provides a convenient implementation of the HttpServletResponse interface
- * that can be subclassed by developers wishing to adapt the response from a
- * Servlet. This class implements the Wrapper or Decorator pattern. Methods
- * default to calling through to the wrapped response object.
+ * Provides a convenient implementation of the HttpServletResponse interface that can be subclassed by developers
+ * wishing to adapt the response from a Servlet. This class implements the Wrapper or Decorator pattern. Methods default
+ * to calling through to the wrapped response object.
*
* @since Servlet 2.3
+ *
* @see jakarta.servlet.http.HttpServletResponse
*/
-public class HttpServletResponseWrapper extends ServletResponseWrapper
- implements HttpServletResponse {
+public class HttpServletResponseWrapper extends ServletResponseWrapper implements HttpServletResponse {
/**
* Constructs a response adaptor wrapping the given response.
*
* @param response The response to be wrapped
*
- * @throws java.lang.IllegalArgumentException
- * if the response is null
+ * @throws java.lang.IllegalArgumentException if the response is null
*/
public HttpServletResponseWrapper(HttpServletResponse response) {
super(response);
@@ -52,8 +50,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call addCookie(Cookie cookie)
- * on the wrapped response object.
+ * The default behavior of this method is to call addCookie(Cookie cookie) on the wrapped response object.
*/
@Override
public void addCookie(Cookie cookie) {
@@ -61,8 +58,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call containsHeader(String
- * name) on the wrapped response object.
+ * The default behavior of this method is to call containsHeader(String name) on the wrapped response object.
*/
@Override
public boolean containsHeader(String name) {
@@ -70,8 +66,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call encodeURL(String url) on
- * the wrapped response object.
+ * The default behavior of this method is to call encodeURL(String url) on the wrapped response object.
*/
@Override
public String encodeURL(String url) {
@@ -79,8 +74,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to return encodeRedirectURL(String
- * url) on the wrapped response object.
+ * The default behavior of this method is to return encodeRedirectURL(String url) on the wrapped response object.
*/
@Override
public String encodeRedirectURL(String url) {
@@ -88,8 +82,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call sendError(int sc, String
- * msg) on the wrapped response object.
+ * The default behavior of this method is to call sendError(int sc, String msg) on the wrapped response object.
*/
@Override
public void sendError(int sc, String msg) throws IOException {
@@ -97,8 +90,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call sendError(int sc) on the
- * wrapped response object.
+ * The default behavior of this method is to call sendError(int sc) on the wrapped response object.
*/
@Override
public void sendError(int sc) throws IOException {
@@ -106,8 +98,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to return sendRedirect(String
- * location) on the wrapped response object.
+ * The default behavior of this method is to return sendRedirect(String location) on the wrapped response object.
*/
@Override
public void sendRedirect(String location) throws IOException {
@@ -115,8 +106,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call setDateHeader(String name,
- * long date) on the wrapped response object.
+ * The default behavior of this method is to call setDateHeader(String name, long date) on the wrapped response
+ * object.
*/
@Override
public void setDateHeader(String name, long date) {
@@ -124,8 +115,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call addDateHeader(String name,
- * long date) on the wrapped response object.
+ * The default behavior of this method is to call addDateHeader(String name, long date) on the wrapped response
+ * object.
*/
@Override
public void addDateHeader(String name, long date) {
@@ -133,8 +124,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to return setHeader(String name,
- * String value) on the wrapped response object.
+ * The default behavior of this method is to return setHeader(String name, String value) on the wrapped response
+ * object.
*/
@Override
public void setHeader(String name, String value) {
@@ -142,8 +133,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to return addHeader(String name,
- * String value) on the wrapped response object.
+ * The default behavior of this method is to return addHeader(String name, String value) on the wrapped response
+ * object.
*/
@Override
public void addHeader(String name, String value) {
@@ -151,8 +142,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call setIntHeader(String name,
- * int value) on the wrapped response object.
+ * The default behavior of this method is to call setIntHeader(String name, int value) on the wrapped response
+ * object.
*/
@Override
public void setIntHeader(String name, int value) {
@@ -160,8 +151,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call addIntHeader(String name,
- * int value) on the wrapped response object.
+ * The default behavior of this method is to call addIntHeader(String name, int value) on the wrapped response
+ * object.
*/
@Override
public void addIntHeader(String name, int value) {
@@ -169,8 +160,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
}
/**
- * The default behavior of this method is to call setStatus(int sc) on the
- * wrapped response object.
+ * The default behavior of this method is to call setStatus(int sc) on the wrapped response object.
*/
@Override
public void setStatus(int sc) {
@@ -180,9 +170,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
/**
* {@inheritDoc}
* <p>
- * The default implementation is to call
- * {@link HttpServletResponse#getStatus()}
- * on the wrapped {@link HttpServletResponse}.
+ * The default implementation is to call {@link HttpServletResponse#getStatus()} on the wrapped
+ * {@link HttpServletResponse}.
*
* @since Servlet 3.0
*/
@@ -194,9 +183,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
/**
* {@inheritDoc}
* <p>
- * The default implementation is to call
- * {@link HttpServletResponse#getHeader(String)}
- * on the wrapped {@link HttpServletResponse}.
+ * The default implementation is to call {@link HttpServletResponse#getHeader(String)} on the wrapped
+ * {@link HttpServletResponse}.
*
* @since Servlet 3.0
*/
@@ -208,9 +196,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
/**
* {@inheritDoc}
* <p>
- * The default implementation is to call
- * {@link HttpServletResponse#getHeaders(String)}
- * on the wrapped {@link HttpServletResponse}.
+ * The default implementation is to call {@link HttpServletResponse#getHeaders(String)} on the wrapped
+ * {@link HttpServletResponse}.
*
* @since Servlet 3.0
*/
@@ -222,9 +209,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
/**
* {@inheritDoc}
* <p>
- * The default implementation is to call
- * {@link HttpServletResponse#getHeaderNames()}
- * on the wrapped {@link HttpServletResponse}.
+ * The default implementation is to call {@link HttpServletResponse#getHeaderNames()} on the wrapped
+ * {@link HttpServletResponse}.
*
* @since Servlet 3.0
*/
@@ -236,9 +222,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
/**
* {@inheritDoc}
* <p>
- * The default implementation is to call
- * {@link HttpServletResponse#setTrailerFields(Supplier)}
- * on the wrapped {@link HttpServletResponse}.
+ * The default implementation is to call {@link HttpServletResponse#setTrailerFields(Supplier)} on the wrapped
+ * {@link HttpServletResponse}.
*
* @since Servlet 4.0
*/
@@ -250,9 +235,8 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper
/**
* {@inheritDoc}
* <p>
- * The default implementation is to call
- * {@link HttpServletResponse#getTrailerFields()}
- * on the wrapped {@link HttpServletResponse}.
+ * The default implementation is to call {@link HttpServletResponse#getTrailerFields()} on the wrapped
+ * {@link HttpServletResponse}.
*
* @since Servlet 4.0
*/
diff --git a/java/jakarta/servlet/http/HttpSession.java b/java/jakarta/servlet/http/HttpSession.java
index 2883cdc503..fdea4e1365 100644
--- a/java/jakarta/servlet/http/HttpSession.java
+++ b/java/jakarta/servlet/http/HttpSession.java
@@ -21,85 +21,72 @@ import java.util.Enumeration;
import jakarta.servlet.ServletContext;
/**
- * Provides a way to identify a user across more than one page request or visit
- * to a Web site and to store information about that user.
+ * Provides a way to identify a user across more than one page request or visit to a Web site and to store information
+ * about that user.
* <p>
- * The servlet container uses this interface to create a session between an HTTP
- * client and an HTTP server. The session persists for a specified time period,
- * across more than one connection or page request from the user. A session
- * usually corresponds to one user, who may visit a site many times. The server
- * can maintain a session in many ways such as using cookies or rewriting URLs.
+ * The servlet container uses this interface to create a session between an HTTP client and an HTTP server. The session
+ * persists for a specified time period, across more than one connection or page request from the user. A session
+ * usually corresponds to one user, who may visit a site many times. The server can maintain a session in many ways such
+ * as using cookies or rewriting URLs.
* <p>
* This interface allows servlets to
* <ul>
- * <li>View and manipulate information about a session, such as the session
- * identifier, creation time, and last accessed time
- * <li>Bind objects to sessions, allowing user information to persist across
- * multiple user connections
+ * <li>View and manipulate information about a session, such as the session identifier, creation time, and last accessed
+ * time
+ * <li>Bind objects to sessions, allowing user information to persist across multiple user connections
* </ul>
* <p>
- * When an application stores an object in or removes an object from a session,
- * the session checks whether the object implements
- * {@link HttpSessionBindingListener}. If it does, the servlet notifies the
- * object that it has been bound to or unbound from the session. Notifications
- * are sent after the binding methods complete. For session that are invalidated
- * or expire, notifications are sent after the session has been invalidated or
- * expired.
+ * When an application stores an object in or removes an object from a session, the session checks whether the object
+ * implements {@link HttpSessionBindingListener}. If it does, the servlet notifies the object that it has been bound to
+ * or unbound from the session. Notifications are sent after the binding methods complete. For session that are
+ * invalidated or expire, notifications are sent after the session has been invalidated or expired.
* <p>
- * When container migrates a session between VMs in a distributed container
- * setting, all session attributes implementing the
- * {@link HttpSessionActivationListener} interface are notified.
+ * When container migrates a session between VMs in a distributed container setting, all session attributes implementing
+ * the {@link HttpSessionActivationListener} interface are notified.
* <p>
- * A servlet should be able to handle cases in which the client does not choose
- * to join a session, such as when cookies are intentionally turned off. Until
- * the client joins the session, <code>isNew</code> returns <code>true</code>.
- * If the client chooses not to join the session, <code>getSession</code> will
- * return a different session on each request, and <code>isNew</code> will
- * always return <code>true</code>.
+ * A servlet should be able to handle cases in which the client does not choose to join a session, such as when cookies
+ * are intentionally turned off. Until the client joins the session, <code>isNew</code> returns <code>true</code>. If
+ * the client chooses not to join the session, <code>getSession</code> will return a different session on each request,
+ * and <code>isNew</code> will always return <code>true</code>.
* <p>
- * Session information is scoped only to the current web application (
- * <code>ServletContext</code>), so information stored in one context will not
- * be directly visible in another.
+ * Session information is scoped only to the current web application ( <code>ServletContext</code>), so information
+ * stored in one context will not be directly visible in another.
*
* @see HttpSessionBindingListener
*/
public interface HttpSession {
/**
- * Returns the time when this session was created, measured in milliseconds
- * since midnight January 1, 1970 GMT.
+ * Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
*
- * @return a <code>long</code> specifying when this session was created,
- * expressed in milliseconds since 1/1/1970 GMT
- * @exception IllegalStateException
- * if this method is called on an invalidated session
+ * @return a <code>long</code> specifying when this session was created, expressed in milliseconds since 1/1/1970
+ * GMT
+ *
+ * @exception IllegalStateException if this method is called on an invalidated session
*/
public long getCreationTime();
/**
- * Returns a string containing the unique identifier assigned to this
- * session. The identifier is assigned by the servlet container and is
- * implementation dependent.
+ * Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the
+ * servlet container and is implementation dependent.
*
* @return a string specifying the identifier assigned to this session
- * @exception IllegalStateException
- * if this method is called on an invalidated session
+ *
+ * @exception IllegalStateException if this method is called on an invalidated session
*/
public String getId();
/**
- * Returns the last time the client sent a request associated with this
- * session, as the number of milliseconds since midnight January 1, 1970
- * GMT, and marked by the time the container received the request.
+ * Returns the last time the client sent a request associated with this session, as the number of milliseconds since
+ * midnight January 1, 1970 GMT, and marked by the time the container received the request.
* <p>
- * Actions that your application takes, such as getting or setting a value
- * associated with the session, do not affect the access time.
- *
- * @return a <code>long</code> representing the last time the client sent a
- * request associated with this session, expressed in milliseconds
- * since 1/1/1970 GMT
- * @exception IllegalStateException
- * if this method is called on an invalidated session
+ * Actions that your application takes, such as getting or setting a value associated with the session, do not
+ * affect the access time.
+ *
+ * @return a <code>long</code> representing the last time the client sent a request associated with this session,
+ * expressed in milliseconds since 1/1/1970 GMT
+ *
+ * @exception IllegalStateException if this method is called on an invalidated session
*/
public long getLastAccessedTime();
@@ -107,118 +94,104 @@ public interface HttpSession {
* Returns the ServletContext to which this session belongs.
*
* @return The ServletContext object for the web application
+ *
* @since Servlet 2.3
*/
public ServletContext getServletContext();
/**
- * Specifies the time, in seconds, between client requests before the
- * servlet container will invalidate this session. A zero or negative time
- * indicates that the session should never timeout.
+ * Specifies the time, in seconds, between client requests before the servlet container will invalidate this
+ * session. A zero or negative time indicates that the session should never timeout.
*
- * @param interval
- * An integer specifying the number of seconds
+ * @param interval An integer specifying the number of seconds
*/
public void setMaxInactiveInterval(int interval);
/**
- * Returns the maximum time interval, in seconds, that the servlet container
- * will keep this session open between client accesses. After this interval,
- * the servlet container will invalidate the session. The maximum time
- * interval can be set with the <code>setMaxInactiveInterval</code> method.
- * A zero or negative time indicates that the session should never timeout.
- *
- * @return an integer specifying the number of seconds this session remains
- * open between client requests
+ * Returns the maximum time interval, in seconds, that the servlet container will keep this session open between
+ * client accesses. After this interval, the servlet container will invalidate the session. The maximum time
+ * interval can be set with the <code>setMaxInactiveInterval</code> method. A zero or negative time indicates that
+ * the session should never timeout.
+ *
+ * @return an integer specifying the number of seconds this session remains open between client requests
+ *
* @see #setMaxInactiveInterval
*/
public int getMaxInactiveInterval();
/**
- * Returns the object bound with the specified name in this session, or
- * <code>null</code> if no object is bound under the name.
+ * Returns the object bound with the specified name in this session, or <code>null</code> if no object is bound
+ * under the name.
+ *
+ * @param name a string specifying the name of the object
*
- * @param name
- * a string specifying the name of the object
* @return the object with the specified name
- * @exception IllegalStateException
- * if this method is called on an invalidated session
+ *
+ * @exception IllegalStateException if this method is called on an invalidated session
*/
public Object getAttribute(String name);
/**
- * Returns an <code>Enumeration</code> of <code>String</code> objects
- * containing the names of all the objects bound to this session.
+ * Returns an <code>Enumeration</code> of <code>String</code> objects containing the names of all the objects bound
+ * to this session.
+ *
+ * @return an <code>Enumeration</code> of <code>String</code> objects specifying the names of all the objects bound
+ * to this session
*
- * @return an <code>Enumeration</code> of <code>String</code> objects
- * specifying the names of all the objects bound to this session
- * @exception IllegalStateException
- * if this method is called on an invalidated session
+ * @exception IllegalStateException if this method is called on an invalidated session
*/
public Enumeration<String> getAttributeNames();
/**
- * Binds an object to this session, using the name specified. If an object
- * of the same name is already bound to the session, the object is replaced.
+ * Binds an object to this session, using the name specified. If an object of the same name is already bound to the
+ * session, the object is replaced.
* <p>
- * After this method executes, and if the new object implements
- * <code>HttpSessionBindingListener</code>, the container calls
- * <code>HttpSessionBindingListener.valueBound</code>. The container then
- * notifies any <code>HttpSessionAttributeListener</code>s in the web
- * application.
+ * After this method executes, and if the new object implements <code>HttpSessionBindingListener</code>, the
+ * container calls <code>HttpSessionBindingListener.valueBound</code>. The container then notifies any
+ * <code>HttpSessionAttributeListener</code>s in the web application.
* <p>
- * If an object was already bound to this session of this name that
- * implements <code>HttpSessionBindingListener</code>, its
- * <code>HttpSessionBindingListener.valueUnbound</code> method is called.
+ * If an object was already bound to this session of this name that implements
+ * <code>HttpSessionBindingListener</code>, its <code>HttpSessionBindingListener.valueUnbound</code> method is
+ * called.
* <p>
- * If the value passed in is null, this has the same effect as calling
- * <code>removeAttribute()</code>.
- *
- * @param name
- * the name to which the object is bound; cannot be null
- * @param value
- * the object to be bound
- * @exception IllegalStateException
- * if this method is called on an invalidated session
+ * If the value passed in is null, this has the same effect as calling <code>removeAttribute()</code>.
+ *
+ * @param name the name to which the object is bound; cannot be null
+ * @param value the object to be bound
+ *
+ * @exception IllegalStateException if this method is called on an invalidated session
*/
public void setAttribute(String name, Object value);
/**
- * Removes the object bound with the specified name from this session. If
- * the session does not have an object bound with the specified name, this
- * method does nothing.
+ * Removes the object bound with the specified name from this session. If the session does not have an object bound
+ * with the specified name, this method does nothing.
* <p>
- * After this method executes, and if the object implements
- * <code>HttpSessionBindingListener</code>, the container calls
- * <code>HttpSessionBindingListener.valueUnbound</code>. The container then
- * notifies any <code>HttpSessionAttributeListener</code>s in the web
- * application.
- *
- * @param name
- * the name of the object to remove from this session
- * @exception IllegalStateException
- * if this method is called on an invalidated session
+ * After this method executes, and if the object implements <code>HttpSessionBindingListener</code>, the container
+ * calls <code>HttpSessionBindingListener.valueUnbound</code>. The container then notifies any
+ * <code>HttpSessionAttributeListener</code>s in the web application.
+ *
+ * @param name the name of the object to remove from this session
+ *
+ * @exception IllegalStateException if this method is called on an invalidated session
*/
public void removeAttribute(String name);
/**
* Invalidates this session then unbinds any objects bound to it.
*
- * @exception IllegalStateException
- * if this method is called on an already invalidated session
+ * @exception IllegalStateException if this method is called on an already invalidated session
*/
public void invalidate();
/**
- * Returns <code>true</code> if the client does not yet know about the
- * session or if the client chooses not to join the session. For example, if
- * the server used only cookie-based sessions, and the client had disabled
- * the use of cookies, then a session would be new on each request.
- *
- * @return <code>true</code> if the server has created a session, but the
- * client has not yet joined
- * @exception IllegalStateException
- * if this method is called on an already invalidated session
+ * Returns <code>true</code> if the client does not yet know about the session or if the client chooses not to join
+ * the session. For example, if the server used only cookie-based sessions, and the client had disabled the use of
+ * cookies, then a session would be new on each request.
+ *
+ * @return <code>true</code> if the server has created a session, but the client has not yet joined
+ *
+ * @exception IllegalStateException if this method is called on an already invalidated session
*/
public boolean isNew();
}
diff --git a/java/jakarta/servlet/http/HttpSessionActivationListener.java b/java/jakarta/servlet/http/HttpSessionActivationListener.java
index fde81bbfe0..3c3b9c16c0 100644
--- a/java/jakarta/servlet/http/HttpSessionActivationListener.java
+++ b/java/jakarta/servlet/http/HttpSessionActivationListener.java
@@ -19,19 +19,16 @@ package jakarta.servlet.http;
import java.util.EventListener;
/**
- * Objects that are bound to a session may listen to container events notifying
- * them that sessions will be passivated and that session will be activated. A
- * container that migrates session between VMs or persists sessions is required
- * to notify all attributes bound to sessions implementing
- * HttpSessionActivationListener.
+ * Objects that are bound to a session may listen to container events notifying them that sessions will be passivated
+ * and that session will be activated. A container that migrates session between VMs or persists sessions is required to
+ * notify all attributes bound to sessions implementing HttpSessionActivationListener.
*
* @since Servlet 2.3
*/
public interface HttpSessionActivationListener extends EventListener {
/**
- * Notification that the session is about to be passivated.
- * The default implementation is a NO-OP.
+ * Notification that the session is about to be passivated. The default implementation is a NO-OP.
*
* @param se Information about the session this is about to be passivated
*/
@@ -39,8 +36,7 @@ public interface HttpSessionActivationListener extends EventListener {
}
/**
- * Notification that the session has just been activated.
- * The default implementation is a NO-OP.
+ * Notification that the session has just been activated. The default implementation is a NO-OP.
*
* @param se Information about the session this has just been activated
*/
diff --git a/java/jakarta/servlet/http/HttpSessionAttributeListener.java b/java/jakarta/servlet/http/HttpSessionAttributeListener.java
index ec93d8ae27..d935a06cf7 100644
--- a/java/jakarta/servlet/http/HttpSessionAttributeListener.java
+++ b/java/jakarta/servlet/http/HttpSessionAttributeListener.java
@@ -19,17 +19,16 @@ package jakarta.servlet.http;
import java.util.EventListener;
/**
- * This listener interface can be implemented in order to get notifications of
- * changes to the attribute lists of sessions within this web application.
+ * This listener interface can be implemented in order to get notifications of changes to the attribute lists of
+ * sessions within this web application.
*
* @since Servlet 2.3
*/
public interface HttpSessionAttributeListener extends EventListener {
/**
- * Notification that an attribute has been added to a session. Called after
- * the attribute is added.
- * The default implementation is a NO-OP.
+ * Notification that an attribute has been added to a session. Called after the attribute is added. The default
+ * implementation is a NO-OP.
*
* @param se Information about the added attribute
*/
@@ -37,9 +36,8 @@ public interface HttpSessionAttributeListener extends EventListener {
}
/**
- * Notification that an attribute has been removed from a session. Called
- * after the attribute is removed.
- * The default implementation is a NO-OP.
+ * Notification that an attribute has been removed from a session. Called after the attribute is removed. The
+ * default implementation is a NO-OP.
*
* @param se Information about the removed attribute
*/
@@ -47,9 +45,8 @@ public interface HttpSessionAttributeListener extends EventListener {
}
/**
- * Notification that an attribute has been replaced in a session. Called
- * after the attribute is replaced.
- * The default implementation is a NO-OP.
+ * Notification that an attribute has been replaced in a session. Called after the attribute is replaced. The
+ * default implementation is a NO-OP.
*
* @param se Information about the replaced attribute
*/
diff --git a/java/jakarta/servlet/http/HttpSessionBindingEvent.java b/java/jakarta/servlet/http/HttpSessionBindingEvent.java
index 5b6b612c50..156a660625 100644
--- a/java/jakarta/servlet/http/HttpSessionBindingEvent.java
+++ b/java/jakarta/servlet/http/HttpSessionBindingEvent.java
@@ -17,14 +17,11 @@
package jakarta.servlet.http;
/**
- * Events of this type are either sent to an object that implements
- * {@link HttpSessionBindingListener} when it is bound or unbound from a
- * session, or to an {@link HttpSessionAttributeListener} that has been
- * configured in the deployment descriptor when any attribute is bound, unbound
- * or replaced in a session.
+ * Events of this type are either sent to an object that implements {@link HttpSessionBindingListener} when it is bound
+ * or unbound from a session, or to an {@link HttpSessionAttributeListener} that has been configured in the deployment
+ * descriptor when any attribute is bound, unbound or replaced in a session.
* <p>
- * The session binds the object by a call to
- * <code>HttpSession.setAttribute</code> and unbinds the object by a call to
+ * The session binds the object by a call to <code>HttpSession.setAttribute</code> and unbinds the object by a call to
* <code>HttpSession.removeAttribute</code>.
*
* @see HttpSession
@@ -36,24 +33,22 @@ public class HttpSessionBindingEvent extends HttpSessionEvent {
private static final long serialVersionUID = 1L;
/**
- * The name to which the object is being bound or unbound.
+ * The name to which the object is being bound or unbound.
*/
private final String name;
/**
- * The object is being bound or unbound.
+ * The object is being bound or unbound.
*/
private final Object value;
/**
- * Constructs an event that notifies an object that it has been bound to or
- * unbound from a session. To receive the event, the object must implement
- * {@link HttpSessionBindingListener}.
+ * Constructs an event that notifies an object that it has been bound to or unbound from a session. To receive the
+ * event, the object must implement {@link HttpSessionBindingListener}.
+ *
+ * @param session the session to which the object is bound or unbound
+ * @param name the name with which the object is bound or unbound
*
- * @param session
- * the session to which the object is bound or unbound
- * @param name
- * the name with which the object is bound or unbound
* @see #getName()
* @see #getSession()
*/
@@ -64,22 +59,18 @@ public class HttpSessionBindingEvent extends HttpSessionEvent {
}
/**
- * Constructs an event that notifies an object that it has been bound to or
- * unbound from a session. To receive the event, the object must implement
- * {@link HttpSessionBindingListener}.
+ * Constructs an event that notifies an object that it has been bound to or unbound from a session. To receive the
+ * event, the object must implement {@link HttpSessionBindingListener}.
+ *
+ * @param session the session to which the object is bound or unbound
+ * @param name the name with which the object is bound or unbound
+ * @param value the object that is bound or unbound
*
- * @param session
- * the session to which the object is bound or unbound
- * @param name
- * the name with which the object is bound or unbound
- * @param value
- * the object that is bound or unbound
* @see #getName()
* @see #getSession()
* @see #getValue()
*/
- public HttpSessionBindingEvent(HttpSession session, String name,
- Object value) {
+ public HttpSessionBindingEvent(HttpSession session, String name, Object value) {
super(session);
this.name = name;
this.value = value;
@@ -87,6 +78,7 @@ public class HttpSessionBindingEvent extends HttpSessionEvent {
/**
* Get the session that changed.
+ *
* @return The session that changed
*/
@Override
@@ -95,24 +87,20 @@ public class HttpSessionBindingEvent extends HttpSessionEvent {
}
/**
- * Returns the name with which the attribute is bound to or unbound from the
- * session.
+ * Returns the name with which the attribute is bound to or unbound from the session.
*
- * @return a string specifying the name with which the object is bound to or
- * unbound from the session
+ * @return a string specifying the name with which the object is bound to or unbound from the session
*/
public String getName() {
return name;
}
/**
- * Returns the value of the attribute that has been added, removed or
- * replaced.
+ * Returns the value of the attribute that has been added, removed or replaced.
*
- * @return If the attribute was added (or bound), this is the value of the
- * attribute. If the attribute was removed (or unbound), this is the
- * value of the removed attribute. If the attribute was replaced,
- * this is the old value of the attribute.
+ * @return If the attribute was added (or bound), this is the value of the attribute. If the attribute was removed
+ * (or unbound), this is the value of the removed attribute. If the attribute was replaced, this is the
+ * old value of the attribute.
*
* @since Servlet 2.3
*/
diff --git a/java/jakarta/servlet/http/HttpSessionBindingListener.java b/java/jakarta/servlet/http/HttpSessionBindingListener.java
index 83def667e5..f7df501d4a 100644
--- a/java/jakarta/servlet/http/HttpSessionBindingListener.java
+++ b/java/jakarta/servlet/http/HttpSessionBindingListener.java
@@ -19,11 +19,9 @@ package jakarta.servlet.http;
import java.util.EventListener;
/**
- * Causes an object to be notified when it is bound to or unbound from a
- * session. The object is notified by an {@link HttpSessionBindingEvent} object.
- * This may be as a result of a servlet programmer explicitly unbinding an
- * attribute from a session, due to a session being invalidated, or due to a
- * session timing out.
+ * Causes an object to be notified when it is bound to or unbound from a session. The object is notified by an
+ * {@link HttpSessionBindingEvent} object. This may be as a result of a servlet programmer explicitly unbinding an
+ * attribute from a session, due to a session being invalidated, or due to a session timing out.
*
* @see HttpSession
* @see HttpSessionBindingEvent
@@ -31,24 +29,22 @@ import java.util.EventListener;
public interface HttpSessionBindingListener extends EventListener {
/**
- * Notifies the object that it is being bound to a session and identifies
- * the session.
- * The default implementation is a NO-OP.
+ * Notifies the object that it is being bound to a session and identifies the session. The default implementation is
+ * a NO-OP.
+ *
+ * @param event the event that identifies the session
*
- * @param event
- * the event that identifies the session
* @see #valueUnbound
*/
public default void valueBound(HttpSessionBindingEvent event) {
}
/**
- * Notifies the object that it is being unbound from a session and
- * identifies the session.
- * The default implementation is a NO-OP.
+ * Notifies the object that it is being unbound from a session and identifies the session. The default
+ * implementation is a NO-OP.
+ *
+ * @param event the event that identifies the session
*
- * @param event
- * the event that identifies the session
* @see #valueBound
*/
public default void valueUnbound(HttpSessionBindingEvent event) {
diff --git a/java/jakarta/servlet/http/HttpSessionEvent.java b/java/jakarta/servlet/http/HttpSessionEvent.java
index 0d536e500c..a61cd06c61 100644
--- a/java/jakarta/servlet/http/HttpSessionEvent.java
+++ b/java/jakarta/servlet/http/HttpSessionEvent.java
@@ -17,8 +17,7 @@
package jakarta.servlet.http;
/**
- * This is the class representing event notifications for changes to sessions
- * within a web application.
+ * This is the class representing event notifications for changes to sessions within a web application.
*
* @since Servlet 2.3
*/
@@ -28,7 +27,7 @@ public class HttpSessionEvent extends java.util.EventObject {
/**
* Construct a session event from the given source.
*
- * @param source The HTTP session where the change took place
+ * @param source The HTTP session where the change took place
*/
public HttpSessionEvent(HttpSession source) {
super(source);
diff --git a/java/jakarta/servlet/http/HttpSessionIdListener.java b/java/jakarta/servlet/http/HttpSessionIdListener.java
index 4636103dab..39fa05f283 100644
--- a/java/jakarta/servlet/http/HttpSessionIdListener.java
+++ b/java/jakarta/servlet/http/HttpSessionIdListener.java
@@ -19,14 +19,14 @@ package jakarta.servlet.http;
import java.util.EventListener;
/**
- * Implementations of this interface are notified when an {@link HttpSession}'s
- * ID changes. To receive notification events, the implementation class must be
- * configured in the deployment descriptor for the web application, annotated
- * with {@link jakarta.servlet.annotation.WebListener} or registered by calling an
- * addListener method on the {@link jakarta.servlet.ServletContext}.
+ * Implementations of this interface are notified when an {@link HttpSession}'s ID changes. To receive notification
+ * events, the implementation class must be configured in the deployment descriptor for the web application, annotated
+ * with {@link jakarta.servlet.annotation.WebListener} or registered by calling an addListener method on the
+ * {@link jakarta.servlet.ServletContext}.
*
* @see HttpSessionEvent
* @see HttpServletRequest#changeSessionId()
+ *
* @since Servlet 3.1
*/
public interface HttpSessionIdListener extends EventListener {
@@ -34,7 +34,7 @@ public interface HttpSessionIdListener extends EventListener {
/**
* Notification that a session ID has been changed.
*
- * @param se the notification event
+ * @param se the notification event
* @param oldSessionId the old session ID
*/
public void sessionIdChanged(HttpSessionEvent se, String oldSessionId);
diff --git a/java/jakarta/servlet/http/HttpSessionListener.java b/java/jakarta/servlet/http/HttpSessionListener.java
index 1f434d631c..2db74b38ec 100644
--- a/java/jakarta/servlet/http/HttpSessionListener.java
+++ b/java/jakarta/servlet/http/HttpSessionListener.java
@@ -19,32 +19,28 @@ package jakarta.servlet.http;
import java.util.EventListener;
/**
- * Implementations of this interface are notified of changes to the list of
- * active sessions in a web application. To receive notification events, the
- * implementation class must be configured in the deployment descriptor for the
- * web application.
+ * Implementations of this interface are notified of changes to the list of active sessions in a web application. To
+ * receive notification events, the implementation class must be configured in the deployment descriptor for the web
+ * application.
*
* @see HttpSessionEvent
+ *
* @since Servlet 2.3
*/
public interface HttpSessionListener extends EventListener {
/**
- * Notification that a session was created.
- * The default implementation is a NO-OP.
+ * Notification that a session was created. The default implementation is a NO-OP.
*
- * @param se
- * the notification event
+ * @param se the notification event
*/
public default void sessionCreated(HttpSessionEvent se) {
}
/**
- * Notification that a session is about to be invalidated.
- * The default implementation is a NO-OP.
+ * Notification that a session is about to be invalidated. The default implementation is a NO-OP.
*
- * @param se
- * the notification event
+ * @param se the notification event
*/
public default void sessionDestroyed(HttpSessionEvent se) {
}
diff --git a/java/jakarta/servlet/http/HttpUpgradeHandler.java b/java/jakarta/servlet/http/HttpUpgradeHandler.java
index a2479be838..40930a9bd5 100644
--- a/java/jakarta/servlet/http/HttpUpgradeHandler.java
+++ b/java/jakarta/servlet/http/HttpUpgradeHandler.java
@@ -24,12 +24,11 @@ package jakarta.servlet.http;
public interface HttpUpgradeHandler {
/**
- * This method is called once the request/response pair where
- * {@link HttpServletRequest#upgrade(Class)} is called has completed
- * processing and is the point where control of the connection passes from
- * the container to the {@link HttpUpgradeHandler}.
+ * This method is called once the request/response pair where {@link HttpServletRequest#upgrade(Class)} is called
+ * has completed processing and is the point where control of the connection passes from the container to the
+ * {@link HttpUpgradeHandler}.
*
- * @param connection The connection that has been upgraded
+ * @param connection The connection that has been upgraded
*/
void init(WebConnection connection);
diff --git a/java/jakarta/servlet/http/MappingMatch.java b/java/jakarta/servlet/http/MappingMatch.java
index 7999a94310..c352d364b5 100644
--- a/java/jakarta/servlet/http/MappingMatch.java
+++ b/java/jakarta/servlet/http/MappingMatch.java
@@ -24,14 +24,12 @@ package jakarta.servlet.http;
public enum MappingMatch {
/**
- * The request was mapped to the servlet via the context root URL pattern of
- * {@code ""}.
+ * The request was mapped to the servlet via the context root URL pattern of {@code ""}.
*/
CONTEXT_ROOT,
/**
- * The request was mapped to the servlet via the default servlet URL pattern
- * of {@code "/"} .
+ * The request was mapped to the servlet via the default servlet URL pattern of {@code "/"} .
*/
DEFAULT,
@@ -41,8 +39,7 @@ public enum MappingMatch {
EXACT,
/**
- * The request was mapped to the servlet using an extension URL pattern
- * match.
+ * The request was mapped to the servlet using an extension URL pattern match.
*/
EXTENSION,
diff --git a/java/jakarta/servlet/http/Part.java b/java/jakarta/servlet/http/Part.java
index d45644a491..9f740029b4 100644
--- a/java/jakarta/servlet/http/Part.java
+++ b/java/jakarta/servlet/http/Part.java
@@ -21,17 +21,15 @@ import java.io.InputStream;
import java.util.Collection;
/**
- * This class represents a part as uploaded to the server as part of a
- * <code>multipart/form-data</code> request body. The part may represent either
- * an uploaded file or form data.
+ * This class represents a part as uploaded to the server as part of a <code>multipart/form-data</code> request body.
+ * The part may represent either an uploaded file or form data.
*
* @since Servlet 3.0
*/
public interface Part {
/**
- * Obtain an <code>InputStream</code> that can be used to retrieve the
- * contents of the file.
+ * Obtain an <code>InputStream</code> that can be used to retrieve the contents of the file.
*
* @return An InputStream for the contents of the file
*
@@ -42,24 +40,20 @@ public interface Part {
/**
* Obtain the content type passed by the browser.
*
- * @return The content type passed by the browser or <code>null</code> if
- * not defined.
+ * @return The content type passed by the browser or <code>null</code> if not defined.
*/
public String getContentType();
/**
- * Obtain the name of the field in the multipart form corresponding to this
- * part.
+ * Obtain the name of the field in the multipart form corresponding to this part.
*
- * @return The name of the field in the multipart form corresponding to this
- * part.
+ * @return The name of the field in the multipart form corresponding to this part.
*/
public String getName();
/**
- * If this part represents an uploaded file, gets the file name submitted
- * in the upload. Returns {@code null} if no file name is available or if
- * this part is not a file upload.
+ * If this part represents an uploaded file, gets the file name submitted in the upload. Returns {@code null} if no
+ * file name is available or if this part is not a file upload.
*
* @return the submitted file name or {@code null}.
*
@@ -75,62 +69,55 @@ public interface Part {
public long getSize();
/**
- * A convenience method to write an uploaded part to disk. The client code
- * is not concerned with whether or not the part is stored in memory, or on
- * disk in a temporary location. They just want to write the uploaded part
- * to a file.
+ * A convenience method to write an uploaded part to disk. The client code is not concerned with whether or not the
+ * part is stored in memory, or on disk in a temporary location. They just want to write the uploaded part to a
+ * file. This method is not guaranteed to succeed if called more than once for the same part. This allows a
+ * particular implementation to use, for example, file renaming, where possible, rather than copying all of the
+ * underlying data, thus gaining a significant performance benefit.
*
- * This method is not guaranteed to succeed if called more than once for
- * the same part. This allows a particular implementation to use, for
- * example, file renaming, where possible, rather than copying all of the
- * underlying data, thus gaining a significant performance benefit.
- *
- * @param fileName The location into which the uploaded part should be
- * stored. Relative locations are relative to {@link
- * jakarta.servlet.MultipartConfigElement#getLocation()}
+ * @param fileName The location into which the uploaded part should be stored. Relative locations are relative to
+ * {@link jakarta.servlet.MultipartConfigElement#getLocation()}
*
* @throws IOException if an I/O occurs while attempting to write the part
*/
public void write(String fileName) throws IOException;
/**
- * Deletes the underlying storage for a part, including deleting any
- * associated temporary disk file. Although the container will delete this
- * storage automatically this method can be used to ensure that this is done
- * at an earlier time, thus preserving system resources.
+ * Deletes the underlying storage for a part, including deleting any associated temporary disk file. Although the
+ * container will delete this storage automatically this method can be used to ensure that this is done at an
+ * earlier time, thus preserving system resources.
* <p>
- * Containers are only required to delete the associated storage when the
- * Part instance is garbage collected. Apache Tomcat will delete the
- * associated storage when the associated request has finished processing.
- * Behaviour of other containers may be different.
+ * Containers are only required to delete the associated storage when the Part instance is garbage collected. Apache
+ * Tomcat will delete the associated storage when the associated request has finished processing. Behaviour of other
+ * containers may be different.
*
* @throws IOException if an I/O occurs while attempting to delete the part
*/
public void delete() throws IOException;
/**
- * Obtains the value of the specified part header as a String. If there are
- * multiple headers with the same name, this method returns the first header
- * in the part. The header name is case insensitive.
+ * Obtains the value of the specified part header as a String. If there are multiple headers with the same name,
+ * this method returns the first header in the part. The header name is case insensitive.
+ *
+ * @param name Header name
*
- * @param name Header name
- * @return The header value or <code>null</code> if the header is not
- * present
+ * @return The header value or <code>null</code> if the header is not present
*/
public String getHeader(String name);
/**
* Obtain all the values of the specified part header.
- * @param name The name of the header of interest. The header name is case
- * insensitive.
- * @return All the values of the specified part header. If the part did not
- * include any headers of the specified name, this method returns an
- * empty Collection.
+ *
+ * @param name The name of the header of interest. The header name is case insensitive.
+ *
+ * @return All the values of the specified part header. If the part did not include any headers of the specified
+ * name, this method returns an empty Collection.
*/
public Collection<String> getHeaders(String name);
/**
* Get the header names provided for this part.
+ *
* @return a Collection of all the header names provided for this part.
*/
public Collection<String> getHeaderNames();
diff --git a/java/jakarta/servlet/http/PushBuilder.java b/java/jakarta/servlet/http/PushBuilder.java
index 5d5d4bb800..9a1092011d 100644
--- a/java/jakarta/servlet/http/PushBuilder.java
+++ b/java/jakarta/servlet/http/PushBuilder.java
@@ -19,21 +19,16 @@ package jakarta.servlet.http;
import java.util.Set;
/**
- * Builds a push request based on the {@link HttpServletRequest} from which this
- * builder was obtained. The push request will be constructed on the following
- * basis:
+ * Builds a push request based on the {@link HttpServletRequest} from which this builder was obtained. The push request
+ * will be constructed on the following basis:
* <ul>
* <li>The request method is set to <code>GET</code>.</li>
- * <li>The path will not be set. This must be set explicitly via a call to
- * {@link #path(String)}.</li>
- * <li>Conditional, range, expectation, authorization and referer headers will
- * be removed.</li>
- * <li>Cookies added to the associated response will be added to the push
- * request unless maxAge <= 0 in which case any request cookie with the
- * same name will be removed.</li>
- * <li>The referer header will be set to
- * {@link HttpServletRequest#getRequestURL()} plus, if present, the query
- * string from {@link HttpServletRequest#getQueryString()}.
+ * <li>The path will not be set. This must be set explicitly via a call to {@link #path(String)}.</li>
+ * <li>Conditional, range, expectation, authorization and referer headers will be removed.</li>
+ * <li>Cookies added to the associated response will be added to the push request unless maxAge <= 0 in which case
+ * any request cookie with the same name will be removed.</li>
+ * <li>The referer header will be set to {@link HttpServletRequest#getRequestURL()} plus, if present, the query string
+ * from {@link HttpServletRequest#getQueryString()}.
* </ul>
*
* @since Servlet 4.0
@@ -47,18 +42,16 @@ public interface PushBuilder {
*
* @return This builder instance
*
- * @throws IllegalArgumentException if an HTTP method is specified that is
- * known not to be <a
- * href="https://tools.ietf.org/html/rfc7540#section-8.2">cacheable
- * and safe</a>. POST, PUT, DELETE, CONNECT, OPTIONS and TRACE will
- * trigger the exception.
+ * @throws IllegalArgumentException if an HTTP method is specified that is known not to be
+ * <a href="https://tools.ietf.org/html/rfc7540#section-8.2">cacheable and
+ * safe</a>. POST, PUT, DELETE, CONNECT, OPTIONS and TRACE will trigger the
+ * exception.
*/
PushBuilder method(String method);
/**
- * Specifies the query string to use in subsequent push requests generated
- * by a call to {@link #push()}. This will be appended to any query string
- * specified in the call to {@link #path(String)}.
+ * Specifies the query string to use in subsequent push requests generated by a call to {@link #push()}. This will
+ * be appended to any query string specified in the call to {@link #path(String)}.
*
* @param queryString The query string to use to generate push requests
*
@@ -67,10 +60,9 @@ public interface PushBuilder {
PushBuilder queryString(String queryString);
/**
- * Specifies the session ID to use in subsequent push requests generated
- * by a call to {@link #push()}. The session ID will be presented the same
- * way as it is on the original request (cookie or URL parameter). The
- * default is determined in the following order:
+ * Specifies the session ID to use in subsequent push requests generated by a call to {@link #push()}. The session
+ * ID will be presented the same way as it is on the original request (cookie or URL parameter). The default is
+ * determined in the following order:
* <ul>
* <li>the requested session ID for the originating request</li>
* <li>the session ID generated in the originated request</li>
@@ -84,8 +76,7 @@ public interface PushBuilder {
PushBuilder sessionId(String sessionId);
/**
- * Sets an HTTP header on the request. Any existing headers of the same name
- * are first remove.
+ * Sets an HTTP header on the request. Any existing headers of the same name are first remove.
*
* @param name The name of the header to set
* @param value The value of the header to set
@@ -107,88 +98,76 @@ public interface PushBuilder {
/**
* Removes an HTTP header from the request.
*
- * @param name The name of the header to remove
+ * @param name The name of the header to remove
*
* @return This builder instance
*/
PushBuilder removeHeader(String name);
/**
- * Sets the URI path to be used for the push request. This must be called
- * before every call to {@link #push()}. If the path includes a query
- * string, the query string will be appended to the existing query string
- * (if any) and no de-duplication will occur.
+ * Sets the URI path to be used for the push request. This must be called before every call to {@link #push()}. If
+ * the path includes a query string, the query string will be appended to the existing query string (if any) and no
+ * de-duplication will occur.
*
- * @param path Paths beginning with '/' are treated as absolute paths. All
- * other paths are treated as relative to the context path of
- * the request used to create this builder instance. The path
- * may include a query string.
+ * @param path Paths beginning with '/' are treated as absolute paths. All other paths are treated as relative to
+ * the context path of the request used to create this builder instance. The path may include a
+ * query string.
*
* @return This builder instance
*/
PushBuilder path(String path);
/**
- * Generates the push request and sends it to the client unless pushes are
- * not available for some reason. After calling this method the following
- * fields are set to {@code null}:
+ * Generates the push request and sends it to the client unless pushes are not available for some reason. After
+ * calling this method the following fields are set to {@code null}:
* <ul>
* <li>{@code path}</li>
- * <li>conditional request headers ({@code if-none-match} and
- * {@code if-modified-since})</li>
+ * <li>conditional request headers ({@code if-none-match} and {@code if-modified-since})</li>
* </ul>
*
- * @throws IllegalStateException If this method is called when {@code path}
- * is {@code null}
+ * @throws IllegalStateException If this method is called when {@code path} is {@code null}
* @throws IllegalArgumentException If the request to push requires a body
*/
void push();
/**
- * Obtain the name of the HTTP method that will be used for push requests
- * generated by future calls to {@code push()}.
+ * Obtain the name of the HTTP method that will be used for push requests generated by future calls to
+ * {@code push()}.
*
* @return The HTTP method to be used for future push requests
*/
String getMethod();
/**
- * Obtain the query string that will be used for push requests generated by
- * future calls to {@code push()}.
+ * Obtain the query string that will be used for push requests generated by future calls to {@code push()}.
*
* @return The query string that will be appended to push requests.
*/
String getQueryString();
/**
- * Obtain the session ID that will be used for push requests generated by
- * future calls to {@code push()}.
+ * Obtain the session ID that will be used for push requests generated by future calls to {@code push()}.
*
* @return The session that will be used for push requests.
*/
String getSessionId();
/**
- * @return The current set of names of HTTP headers to be used the next time
- * {@code push()} is called.
+ * @return The current set of names of HTTP headers to be used the next time {@code push()} is called.
*/
Set<String> getHeaderNames();
/**
- * Obtain a value for the given HTTP header.
- * TODO Servlet 4.0
- * Clarify the behaviour of this method
+ * Obtain a value for the given HTTP header. TODO Servlet 4.0 Clarify the behaviour of this method
*
- * @param name The name of the header whose value is to be returned
+ * @param name The name of the header whose value is to be returned
*
- * @return The value of the given header. If multiple values are defined
- * then any may be returned
+ * @return The value of the given header. If multiple values are defined then any may be returned
*/
String getHeader(String name);
/**
- * Obtain the path that will be used for the push request that will be
- * generated by the next call to {@code push()}.
+ * Obtain the path that will be used for the push request that will be generated by the next call to {@code push()}.
*
* @return The path value that will be associated with the next push request
*/
diff --git a/java/jakarta/servlet/http/WebConnection.java b/java/jakarta/servlet/http/WebConnection.java
index 3a50c6815f..f9ff1007a3 100644
--- a/java/jakarta/servlet/http/WebConnection.java
+++ b/java/jakarta/servlet/http/WebConnection.java
@@ -22,16 +22,14 @@ import jakarta.servlet.ServletInputStream;
import jakarta.servlet.ServletOutputStream;
/**
- * The interface used by an {@link HttpUpgradeHandler} to interact with an upgraded
- * HTTP connection.
+ * The interface used by an {@link HttpUpgradeHandler} to interact with an upgraded HTTP connection.
*
* @since Servlet 3.1
*/
public interface WebConnection extends AutoCloseable {
/**
- * Provides access to the {@link ServletInputStream} for reading data from
- * the client.
+ * Provides access to the {@link ServletInputStream} for reading data from the client.
*
* @return the input stream
*
@@ -40,8 +38,7 @@ public interface WebConnection extends AutoCloseable {
ServletInputStream getInputStream() throws IOException;
/**
- * Provides access to the {@link ServletOutputStream} for writing data to
- * the client.
+ * Provides access to the {@link ServletOutputStream} for writing data to the client.
*
* @return the output stream
*
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org