Class SystemFile

    • Constructor Summary

      Constructors 
      Constructor Description
      SystemFile​(java.io.File file)  
      SystemFile​(java.io.File file, io.micronaut.http.MediaType mediaType)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SystemFile attach()
      Sets the file to be downloaded as an attachment.
      SystemFile attach​(java.lang.String attachmentName)
      Sets the file to be downloaded as an attachment.
      java.io.File getFile()  
      long getLastModified()  
      long getLength()  
      io.micronaut.http.MediaType getMediaType()  
      void process​(io.micronaut.http.MutableHttpResponse response)
      Modify the response before it is written to the client.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SystemFile

        public SystemFile​(java.io.File file)
        Parameters:
        file - The file to respond with
      • SystemFile

        public SystemFile​(java.io.File file,
                          io.micronaut.http.MediaType mediaType)
        Parameters:
        file - The file to respond with
        mediaType - The content type of the response
    • Method Detail

      • getFile

        public java.io.File getFile()
        Returns:
        The file
      • attach

        public SystemFile attach()
        Sets the file to be downloaded as an attachment. The file name is set in the Content-Disposition header.
        Returns:
        The same SystemFile instance
      • attach

        public SystemFile attach​(java.lang.String attachmentName)
        Sets the file to be downloaded as an attachment. The name is set in the Content-Disposition header.
        Parameters:
        attachmentName - The attachment name.
        Returns:
        The same SystemFile instance
      • process

        public void process​(io.micronaut.http.MutableHttpResponse response)
        Description copied from interface: CustomizableResponseType
        Modify the response before it is written to the client.
        Specified by:
        process in interface CustomizableResponseType
        Parameters:
        response - The response to modify