Class ServletFileResponse


  • public class ServletFileResponse
    extends FileResponse
    Centralizing the code which permits to send a file, and if necessary or asked to send it partially.
    Author:
    Yohann Chastagnier
    • Method Detail

      • sendSilverpeasFile

        public void sendSilverpeasFile​(SilverpeasFile file)
        Centralization of getting of silverpeas file content.

        A download context flag is verified from parameters and attributes of the request.

        Parameters:
        file - the silverpeas file to send.
      • sendSilverpeasFile

        public void sendSilverpeasFile​(SilverpeasFile file,
                                       boolean downloadContext)
        Centralization of getting of silverpeas file content.

        Using directly this method means that the request downloadContext flag is ignored.

        Parameters:
        file - the silverpeas file to send.
        downloadContext - indicating a download context in order to specify rightly response headers.
      • forceFileId

        public ServletFileResponse forceFileId​(String fileId)
        Description copied from class: FileResponse
        Forces the file identifier.
        If not forced, the absolute path of the file into Base64 is computed.
        Overrides:
        forceFileId in class FileResponse
        Parameters:
        fileId - the file identifier.
        Returns:
        itself.
      • forceMimeType

        public ServletFileResponse forceMimeType​(String mimeType)
        Description copied from class: FileResponse
        Forces the mime type of the response.
        If not forced, the mime type is computed from the file itself.
        Even if a mime type has been forced, if the request contains into headers a valuated forceMimeType parameter, the mime type from the request is taken into account.
        Overrides:
        forceMimeType in class FileResponse
        Parameters:
        mimeType - the mime type to set.
        Returns:
        itself.
      • forceFileName

        public ServletFileResponse forceFileName​(String fileName)
        Description copied from class: FileResponse
        Forces the file name into the response.
        If not forced, the file name is computed from the file itself.
        Even if a file name has been forced, if the request contains into headers a valuated forceFileName parameter, the file name from the request is taken into account.
        Overrides:
        forceFileName in class FileResponse
        Parameters:
        fileName - the file name to set.
        Returns:
        itself.