Class ContentDispositionHelper


  • public class ContentDispositionHelper
    extends Object
    Since:
    8.4.0
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • ContentDispositionHelper

        public ContentDispositionHelper()
    • Method Detail

      • setAttachmentHeader

        public static void setAttachmentHeader​(javax.servlet.http.HttpServletResponse response,
                                               String type,
                                               String fileName,
                                               Charset charset)
        Sets the Content-Disposition header to indicate that the response should be treated as an attachment.
        Parameters:
        response - The HttpServletResponse object used to send the response.
        type - The type of the content disposition (e.g., "attachment").
        fileName - The name of the file to be used in the Content-Disposition header.
        charset - The character set to be used for encoding the file name.
      • formatHeaderValue

        public static String formatHeaderValue​(String type,
                                               String fileName,
                                               Charset charset)
        Formats the Content-Disposition header value based on the provided type, file name, and character set.
        Parameters:
        type - The type of the content disposition (e.g., "attachment").
        fileName - The name of the file to be used in the Content-Disposition header.
        charset - The character set to be used for encoding the file name.
        Returns:
        The formatted Content-Disposition header value.