com.vaadin.flow.internal.
Class ResponseWriter
- java.lang.Object
-
- com.vaadin.flow.internal.ResponseWriter
-
All Implemented Interfaces:
public class ResponseWriter extends Object implements Serializable
The class that handles writing the response data into the response.
Since:
1.0.
Author:
Vaadin Ltd
See Also:
-
-
Constructor Summary
Constructors Constructor and Description ResponseWriter()
Create a response writer with buffer size equal to
DEFAULT_BUFFER_SIZE
.ResponseWriter(int bufferSize)
Creates a response writer with custom buffer size.
-
Method Summary
All Methods Modifier and Type Method and Description protected boolean
acceptsGzippedResource(javax.servlet.http.HttpServletRequest request)
Returns whether it is ok to serve a gzipped version of the given resource.
void
writeResponseContents(String filenameWithPath, URL resourceUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Writes the contents and content type (if available) of the given resourceUrl to the response.
-
-
-
Constructor Detail
-
ResponseWriter
public ResponseWriter()
Create a response writer with buffer size equal to
DEFAULT_BUFFER_SIZE
.
-
ResponseWriter
public ResponseWriter(int bufferSize)
Creates a response writer with custom buffer size.
Parameters:
bufferSize
- custom buffer size
-
-
Method Detail
-
writeResponseContents
public void writeResponseContents(String filenameWithPath, URL resourceUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
Writes the contents and content type (if available) of the given resourceUrl to the response.
Parameters:
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 toThrows:
IOException
- if the servlet container threw an exception while locating the resource
-
acceptsGzippedResource
protected boolean acceptsGzippedResource(javax.servlet.http.HttpServletRequest request)
Returns whether it is ok to serve a gzipped version of the given resource.
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.
Parameters:
request
- the request for the resourceReturns:
true if the servlet should attempt to serve a precompressed version of the resource, false otherwise
-
-