Class RestFileResponse


  • public class RestFileResponse
    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

      • silverpeasFile

        public javax.ws.rs.core.Response.ResponseBuilder silverpeasFile​(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.
        Returns:
        the response builder.
      • silverpeasFile

        public javax.ws.rs.core.Response.ResponseBuilder silverpeasFile​(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.
        Returns:
        the response builder.
      • forceFileId

        public RestFileResponse 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 RestFileResponse 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.
      • forceCharacterEncoding

        public RestFileResponse forceCharacterEncoding​(String forcedCharacterEncoding)
        Description copied from class: FileResponse
        Forces the character encoding of the response.
        Overrides:
        forceCharacterEncoding in class FileResponse
        Parameters:
        forcedCharacterEncoding - the character encoding to set.
        Returns:
        itself.
      • forceFileName

        public RestFileResponse 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.