public class ResponseWriter extends Object implements Serializable
For internal use only. May be renamed or removed in a future release.
Constructor and Description |
---|
ResponseWriter()
Deprecated.
Use
ResponseWriter(DeploymentConfiguration) instead. |
ResponseWriter(DeploymentConfiguration deploymentConfiguration)
Create a response writer with the given deployment configuration.
|
ResponseWriter(int bufferSize)
Deprecated.
This constructor is never used internally and might be
removed.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptsBrotliResource(HttpServletRequest request)
Returns whether it is ok to serve a Brotli version of the given resource.
|
protected boolean |
acceptsGzippedResource(HttpServletRequest request)
Returns whether it is ok to serve a gzipped version of the given
resource.
|
void |
writeResponseContents(String filenameWithPath,
URL resourceUrl,
HttpServletRequest request,
HttpServletResponse response)
Writes the contents and content type (if available) of the given
resourceUrl to the response.
|
@Deprecated public ResponseWriter()
ResponseWriter(DeploymentConfiguration)
instead.DEFAULT_BUFFER_SIZE
.@Deprecated public ResponseWriter(int bufferSize)
This will always mark us as compatibility mode and not accept loading
resources from the classpath. To enable compressed resources use
ResponseWriter(DeploymentConfiguration)
.
bufferSize
- custom buffer sizepublic ResponseWriter(DeploymentConfiguration deploymentConfiguration)
deploymentConfiguration
- the deployment configuration to use, not null
public void writeResponseContents(String filenameWithPath, URL resourceUrl, HttpServletRequest request, HttpServletResponse response) throws IOException
WARNING: note that this should not be used for a resourceUrl
that
represents a directory! For security reasons, the directory contents
should not be ever written into the response
, and the
implementation which is used for setting the content length relies on
URLConnection.getContentLengthLong()
method which returns
incorrect values for directories.
filenameWithPath
- the name of the file being sentresourceUrl
- the URL to the file, reported by the servlet containerrequest
- the request object to read fromresponse
- the response object to write toIOException
- if the servlet container threw an exception while locating
the resourceprotected boolean acceptsGzippedResource(HttpServletRequest request)
If this method returns true, the browser is ok with receiving a gzipped version of the resource. In other cases, an uncompressed file must be sent.
request
- the request for the resourceprotected boolean acceptsBrotliResource(HttpServletRequest request)
If this method returns true, the browser is ok with receiving a Brotli version of the resource. In other cases, an uncompressed or gzipped file must be sent.
request
- the request for the resourceCopyright © 2025. All rights reserved.