com.vaadin.flow.internal.

Class ResponseWriter

  • All Implemented Interfaces:

    Serializable


    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:

    Serialized Form

    • Constructor Detail

      • ResponseWriter

        public ResponseWriter(DeploymentConfiguration deploymentConfiguration)

        Create a response writer with the given deployment configuration.

        Parameters:

        deploymentConfiguration - the deployment configuration to use, not null

    • Method Detail

      • writeResponseContents

        public void writeResponseContents(String filenameWithPath,
                                          URL resourceUrl,
                                          HttpServletRequest request,
                                          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 sent

        resourceUrl - the URL to the file, reported by the servlet container

        request - the request object to read from

        response - the response object to write to

        Throws:

        IOException - if the servlet container threw an exception while locating the resource

      • acceptsGzippedResource

        protected boolean acceptsGzippedResource(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 resource

        Returns:

        true if the servlet should attempt to serve a gzipped version of the resource, false otherwise

      • acceptsBrotliResource

        protected boolean acceptsBrotliResource(HttpServletRequest request)

        Returns whether it is ok to serve a Brotli version of the given resource.

        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.

        Parameters:

        request - the request for the resource

        Returns:

        true if the servlet should attempt to serve a Brotli version of the resource, false otherwise