Skip to content

Commit 714de11

Browse files
Merge pull request #477 from markt-asf/fix-issue-325
Fix issue #325 - Clarify get[Int|Date]Header() for multiple headers
2 parents d9e25de + feef517 commit 714de11

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

api/src/main/java/jakarta/servlet/http/HttpServletRequest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021 Oracle and/or its affiliates and others.
2+
* Copyright (c) 1997, 2022 Oracle and/or its affiliates and others.
33
* All rights reserved.
44
* Copyright 2004 The Apache Software Foundation
55
*
@@ -85,8 +85,9 @@ public interface HttpServletRequest extends ServletRequest {
8585
* The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive.
8686
*
8787
* <p>
88-
* If the request did not have a header of the specified name, this method returns -1. If the header can't be converted
89-
* to a date, the method throws an <code>IllegalArgumentException</code>.
88+
* If the request did not have a header of the specified name, this method returns -1. If there are multiple headers
89+
* with the same name, this method returns the value of the first header in the request. If the header can't be
90+
* converted to a date, the method throws an <code>IllegalArgumentException</code>.
9091
*
9192
* @param name a <code>String</code> specifying the name of the header
9293
*
@@ -100,8 +101,8 @@ public interface HttpServletRequest extends ServletRequest {
100101
/**
101102
* Returns the value of the specified request header as a <code>String</code>. If the request did not include a header
102103
* of the specified name, this method returns <code>null</code>. If there are multiple headers with the same name, this
103-
* method returns the first head in the request. The header name is case insensitive. You can use this method with any
104-
* request header.
104+
* method returns the value of the first header in the request. The header name is case insensitive. You can use this
105+
* method with any request header.
105106
*
106107
* @param name a <code>String</code> specifying the header name
107108
*
@@ -144,7 +145,8 @@ public interface HttpServletRequest extends ServletRequest {
144145

145146
/**
146147
* Returns the value of the specified request header as an <code>int</code>. If the request does not have a header of
147-
* the specified name, this method returns -1. If the header cannot be converted to an integer, this method throws a
148+
* the specified name, this method returns -1. If there are multiple headers with the same name, this method returns the
149+
* value of the first header in the request. If the header cannot be converted to an integer, this method throws a
148150
* <code>NumberFormatException</code>.
149151
*
150152
* <p>

spec/src/main/asciidoc/servlet-spec-body.adoc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8545,12 +8545,17 @@ Jakarta Servlet {spec-version} specification developed under the Jakarta EE Work
85458545
=== Changes Since Jakarta Servlet 6.0
85468546

85478547
link:https://github.com/eclipse-ee4j/servlet-api/issues/164[Issue 164]::
8548-
Clarify Javadoc for ServletResponse and HttpServletResponse methods that are
8548+
Clarify Javadoc for `ServletResponse` and `HttpServletResponse` methods that are
85498549
NO-OPs once the response has been committed.
85508550

8551+
link:https://github.com/eclipse-ee4j/servlet-api/issues/325[Issue 325]::
8552+
Clarify the behaviour of `getDateHeader()` and `getIntHeader()` when multiple
8553+
headers with the same name are present in the `HttpServletRequest`. The expected
8554+
behaviour is aligned with `getHeader()`.
8555+
85518556
link:https://github.com/eclipse-ee4j/servlet-api/issues/463[Issue 463]::
8552-
Clarify Javadoc for MultipartConfigElement and MultipartConfig that sizes are in
8553-
bytes.
8557+
Clarify Javadoc for `MultipartConfigElement` and `MultipartConfig` that sizes
8558+
are in bytes.
85548559

85558560
=== Changes Since Jakarta Servlet 5.0
85568561

0 commit comments

Comments
 (0)