Top Fields Constructors Methods
jakarta.servlet.http

pack-priv Class NoBodyResponse

Located in compilation unit of jakarta.servlet.http.HttpServlet.

extends HttpServletResponseWrapper
Class Inheritance
Annotations
@Deprecated
forRemoval:true
since:Servlet 6.0

Deprecated

for removal since Servlet 6.0.

Field Summary

Modifier and TypeField and Description
private boolean
private static final ResourceBundle
private NoBodyOutputStream
noBody

Deprecated as a consequence of NoBodyOutputStream being deprecated.
private boolean
private PrintWriter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addHeader(String
the name of the header
name
,
String
the additional header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)
value
)

Overrides jakarta.servlet.http.HttpServletResponseWrapper.addHeader.

Implements jakarta.servlet.http.HttpServletResponse.addHeader.

The default behavior of this method is to return addHeader(String name, String value) on the wrapped response object.
public void
addIntHeader(String
the name of the header
name
,
int
the assigned integer value
value
)

Overrides jakarta.servlet.http.HttpServletResponseWrapper.addIntHeader.

Implements jakarta.servlet.http.HttpServletResponse.addIntHeader.

The default behavior of this method is to call addIntHeader(String name, int value) on the wrapped response object.
private void
public ServletOutputStream
public PrintWriter
getWriter()

Overrides jakarta.servlet.ServletResponseWrapper.getWriter.

Implements jakarta.servlet.ServletResponse.getWriter.

Returns a PrintWriter object that can send character text to the client.
public void
reset()

Overrides jakarta.servlet.ServletResponseWrapper.reset.

Implements jakarta.servlet.ServletResponse.reset.

Clears any data that exists in the buffer as well as the status code, headers.
public void
resetBuffer()

Overrides jakarta.servlet.ServletResponseWrapper.resetBuffer.

Implements jakarta.servlet.ServletResponse.resetBuffer.

Clears the content of the underlying buffer in the response without clearing headers or status code.
pack-priv void
public void
setContentLength(int
an integer specifying the length of the content being returned to the client; sets the Content-Length header
len
)

Overrides jakarta.servlet.ServletResponseWrapper.setContentLength.

Implements jakarta.servlet.ServletResponse.setContentLength.

Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.
public void
setContentLengthLong(long
a long specifying the length of the content being returned to the client; sets the Content-Length header
len
)

Overrides jakarta.servlet.ServletResponseWrapper.setContentLengthLong.

Implements jakarta.servlet.ServletResponse.setContentLengthLong.

Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.
public void
setHeader(String
the name of the header
name
,
String
the header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)
value
)

Overrides jakarta.servlet.http.HttpServletResponseWrapper.setHeader.

Implements jakarta.servlet.http.HttpServletResponse.setHeader.

The default behavior of this method is to return setHeader(String name, String value) on the wrapped response object.
public void
setIntHeader(String
the name of the header
name
,
int
the assigned integer value
value
)

Overrides jakarta.servlet.http.HttpServletResponseWrapper.setIntHeader.

Implements jakarta.servlet.http.HttpServletResponse.setIntHeader.

The default behavior of this method is to call setIntHeader(String name, int value) on the wrapped response object.
Inherited from jakarta.servlet.http.HttpServletResponseWrapper:
addCookieaddDateHeadercontainsHeaderencodeRedirectURLencodeURLgetHeadergetHeaderNamesgetHeadersgetStatusgetTrailerFieldssendErrorsendErrorsendRedirectsetDateHeadersetStatussetTrailerFields

Field Detail

didSetContentLengthback to summary
private boolean didSetContentLength
lStringsback to summary
private static final ResourceBundle lStrings
noBodyback to summary
private NoBodyOutputStream noBody

Deprecated

as a consequence of NoBodyOutputStream being deprecated. See corresponding docs for further information.

usingOutputStreamback to summary
private boolean usingOutputStream
writerback to summary
private PrintWriter writer

Constructor Detail

NoBodyResponseback to summary
pack-priv NoBodyResponse(HttpServletResponse r)

Method Detail

addHeaderback to summary
public void addHeader(String name, String value)

Overrides jakarta.servlet.http.HttpServletResponseWrapper.addHeader.

Implements jakarta.servlet.http.HttpServletResponse.addHeader.

Doc from jakarta.servlet.http.HttpServletResponseWrapper.addHeader.

The default behavior of this method is to return addHeader(String name, String value) on the wrapped response object.

Parameters
name:String

Doc from jakarta.servlet.http.HttpServletResponse.addHeader.

the name of the header

value:String

Doc from jakarta.servlet.http.HttpServletResponse.addHeader.

the additional header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)

Annotations
@Override
addIntHeaderback to summary
public void addIntHeader(String name, int value)

Overrides jakarta.servlet.http.HttpServletResponseWrapper.addIntHeader.

Implements jakarta.servlet.http.HttpServletResponse.addIntHeader.

Doc from jakarta.servlet.http.HttpServletResponseWrapper.addIntHeader.

The default behavior of this method is to call addIntHeader(String name, int value) on the wrapped response object.

Parameters
name:String

Doc from jakarta.servlet.http.HttpServletResponse.addIntHeader.

the name of the header

value:int

Doc from jakarta.servlet.http.HttpServletResponse.addIntHeader.

the assigned integer value

Annotations
@Override
checkHeaderback to summary
private void checkHeader(String name)
getOutputStreamback to summary
public ServletOutputStream getOutputStream() throws IOException

Overrides jakarta.servlet.ServletResponseWrapper.getOutputStream.

Implements jakarta.servlet.ServletResponse.getOutputStream.

Doc from jakarta.servlet.ServletResponse.getOutputStream.

Returns a ServletOutputStream suitable for writing binary data in the response. The servlet container does not encode the binary data.

Calling flush() on the ServletOutputStream commits the response. Either this method or getWriter may be called to write the body, not both, except when reset has been called.

Returns:ServletOutputStream

a ServletOutputStream for writing binary data

Annotations
@Override
Exceptions
IOException:
if an input or output exception occurred
getWriterback to summary
public PrintWriter getWriter() throws UnsupportedEncodingException

Overrides jakarta.servlet.ServletResponseWrapper.getWriter.

Implements jakarta.servlet.ServletResponse.getWriter.

Doc from jakarta.servlet.ServletResponse.getWriter.

Returns a PrintWriter object that can send character text to the client. The PrintWriter uses the character encoding returned by getCharacterEncoding. If the response's character encoding has not been specified as described in getCharacterEncoding (i.e., the method just returns the default value ISO-8859-1), getWriter updates it to ISO-8859-1.

Calling flush() on the PrintWriter commits the response.

Either this method or getOutputStream may be called to write the body, not both, except when reset has been called.

Returns:PrintWriter

a PrintWriter object that can return character data to the client

Annotations
@Override
Exceptions
UnsupportedEncodingException:
if the character encoding returned by getCharacterEncoding cannot be used
resetback to summary
public void reset()

Overrides jakarta.servlet.ServletResponseWrapper.reset.

Implements jakarta.servlet.ServletResponse.reset.

Doc from jakarta.servlet.ServletResponse.reset.

Clears any data that exists in the buffer as well as the status code, headers. The state of calling getWriter or getOutputStream is also cleared. It is legal, for instance, to call getWriter, reset and then getOutputStream. If getWriter or getOutputStream have been called before this method, then the corrresponding returned Writer or OutputStream will be staled and the behavior of using the stale object is undefined. If the response has been committed, this method throws an IllegalStateException.

Annotations
@Override
resetBufferback to summary
public void resetBuffer()

Overrides jakarta.servlet.ServletResponseWrapper.resetBuffer.

Implements jakarta.servlet.ServletResponse.resetBuffer.

Doc from jakarta.servlet.ServletResponse.resetBuffer.

Clears the content of the underlying buffer in the response without clearing headers or status code. If the response has been committed, this method throws an IllegalStateException.

Annotations
@Override
setContentLengthback to summary
pack-priv void setContentLength()
setContentLengthback to summary
public void setContentLength(int len)

Overrides jakarta.servlet.ServletResponseWrapper.setContentLength.

Implements jakarta.servlet.ServletResponse.setContentLength.

Doc from jakarta.servlet.ServletResponse.setContentLength.

Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.

Parameters
len:int

an integer specifying the length of the content being returned to the client; sets the Content-Length header

Annotations
@Override
setContentLengthLongback to summary
public void setContentLengthLong(long len)

Overrides jakarta.servlet.ServletResponseWrapper.setContentLengthLong.

Implements jakarta.servlet.ServletResponse.setContentLengthLong.

Doc from jakarta.servlet.ServletResponse.setContentLengthLong.

Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.

Parameters
len:long

a long specifying the length of the content being returned to the client; sets the Content-Length header

Annotations
@Override
setHeaderback to summary
public void setHeader(String name, String value)

Overrides jakarta.servlet.http.HttpServletResponseWrapper.setHeader.

Implements jakarta.servlet.http.HttpServletResponse.setHeader.

Doc from jakarta.servlet.http.HttpServletResponseWrapper.setHeader.

The default behavior of this method is to return setHeader(String name, String value) on the wrapped response object.

Parameters
name:String

Doc from jakarta.servlet.http.HttpServletResponse.setHeader.

the name of the header

value:String

Doc from jakarta.servlet.http.HttpServletResponse.setHeader.

the header value If it contains octet string, it should be encoded according to RFC 2047 (http://www.ietf.org/rfc/rfc2047.txt)

Annotations
@Override
setIntHeaderback to summary
public void setIntHeader(String name, int value)

Overrides jakarta.servlet.http.HttpServletResponseWrapper.setIntHeader.

Implements jakarta.servlet.http.HttpServletResponse.setIntHeader.

Doc from jakarta.servlet.http.HttpServletResponseWrapper.setIntHeader.

The default behavior of this method is to call setIntHeader(String name, int value) on the wrapped response object.

Parameters
name:String

Doc from jakarta.servlet.http.HttpServletResponse.setIntHeader.

the name of the header

value:int

Doc from jakarta.servlet.http.HttpServletResponse.setIntHeader.

the assigned integer value

Annotations
@Override