Skip to main content

[JIRA] Created: (SERVLET_SPEC-69) NoBodyResponse in HttpServlet.java can have incorrect content length, should override setContentLengthLong(), others

  • From: "beamerblvd (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [JIRA] Created: (SERVLET_SPEC-69) NoBodyResponse in HttpServlet.java can have incorrect content length, should override setContentLengthLong(), others
  • Date: Wed, 20 Mar 2013 19:06:53 +0000 (GMT+00:00)
  • Auto-submitted: auto-generated

NoBodyResponse in HttpServlet.java can have incorrect content length, should 
override setContentLengthLong(), others
--------------------------------------------------------------------------------------------------------------------

                 Key: SERVLET_SPEC-69
                 URL: http://java.net/jira/browse/SERVLET_SPEC-69
             Project: servlet-spec
          Issue Type: Bug
            Reporter: beamerblvd


(Note: See https://issues.apache.org/bugzilla/show_bug.cgi?id=53454 and ;
https://issues.apache.org/bugzilla/show_bug.cgi?id=54734 for more details.)

The spec JAR contains a file-private class {{NoBodyResponse}} in 
{{HttpServlet.java}} that contains a bug in it. This bug has existed for a 
while but was made worse in the Servlet 3.1 Proposed Final Draft.

{{NoBodyResponse}} overrides:

{code}public void setContentLength(int);{code}

However, there are five other ways to change the content length of the 
response, and {{NoBodyResponse}} does not override any of them:

{code}  public void setContentLengthLong(long); // added in Servlet 3.1
public void setHeader(String, String);
public void addHeader(String, String);
public void setIntHeader(String, int);
public void addIntHeader(String, int);{code}

The {{setContentLengthLong(long)}} method should be overridden in 
{{NoBodyResponse}} to behave exactly like {{setContentLength(int)}}. The four 
header methods should also be overridden, to check if the header name 
(case-insensitive) is "Content-Length" and behave the same way as 
{{setContentLength(int)}} if it is (Tomcat uses a {{private void 
checkHeader(String name)}} method that is called in of each of the four 
header methods).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[JIRA] Created: (SERVLET_SPEC-69) NoBodyResponse in HttpServlet.java can have incorrect content length, should override setContentLengthLong(), others

beamerblvd (JIRA) 03/20/2013

[JIRA] Commented: (SERVLET_SPEC-69) NoBodyResponse in HttpServlet.java can have incorrect content length, should override setContentLengthLong(), others

beamerblvd (JIRA) 03/20/2013
 
 
Close
loading
Please Confirm
Close