Package play.mvc

Class StatusHeader


  • public class StatusHeader
    extends Result
    A status with no body
    • Constructor Detail

      • StatusHeader

        public StatusHeader​(int status)
    • Method Detail

      • sendInputStream

        public Result sendInputStream​(InputStream stream)
        Send the given input stream.

        The input stream will be sent chunked since there is no specified content length.

        Parameters:
        stream - The input stream to send.
        Returns:
        The result.
      • sendInputStream

        public Result sendInputStream​(InputStream stream,
                                      Runnable onClose,
                                      Executor executor)
        Send the given input stream.

        The input stream will be sent chunked since there is no specified content length.

        Parameters:
        stream - The input stream to send.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        The result.
      • sendInputStream

        public Result sendInputStream​(InputStream stream,
                                      Optional<String> contentType)
        Send the given input stream.

        The input stream will be sent chunked since there is no specified content length.

        Parameters:
        stream - The input stream to send.
        contentType - the entity content type.
        Returns:
        The result.
      • sendInputStream

        public Result sendInputStream​(InputStream stream,
                                      Optional<String> contentType,
                                      Runnable onClose,
                                      Executor executor)
        Send the given input stream.

        The input stream will be sent chunked since there is no specified content length.

        Parameters:
        stream - The input stream to send.
        contentType - the entity content type.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        The result.
      • sendInputStream

        public Result sendInputStream​(InputStream stream,
                                      long contentLength)
        Send the given input stream.
        Parameters:
        stream - The input stream to send.
        contentLength - The length of the content in the stream.
        Returns:
        The result.
      • sendInputStream

        public Result sendInputStream​(InputStream stream,
                                      long contentLength,
                                      Runnable onClose,
                                      Executor executor)
        Send the given input stream.
        Parameters:
        stream - The input stream to send.
        contentLength - The length of the content in the stream.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        The result.
      • sendInputStream

        public Result sendInputStream​(InputStream stream,
                                      long contentLength,
                                      Optional<String> contentType)
        Send the given input stream.
        Parameters:
        stream - The input stream to send.
        contentLength - The length of the content in the stream.
        contentType - the entity content type.
        Returns:
        The result.
      • sendInputStream

        public Result sendInputStream​(InputStream stream,
                                      long contentLength,
                                      Optional<String> contentType,
                                      Runnable onClose,
                                      Executor executor)
        Send the given input stream.
        Parameters:
        stream - The input stream to send.
        contentLength - The length of the content in the stream.
        contentType - the entity content type.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        The result.
      • sendBytes

        public Result sendBytes​(byte[] content)
        Send the given bytes.
        Parameters:
        content - The bytes to send.
        Returns:
        The result.
      • sendBytes

        public Result sendBytes​(byte[] content,
                                Optional<String> contentType)
        Send the given bytes.
        Parameters:
        content - The bytes to send.
        contentType - the entity content type.
        Returns:
        The result.
      • sendBytes

        public Result sendBytes​(byte[] content,
                                boolean inline,
                                Optional<String> fileName)
        Send the given bytes.
        Parameters:
        content - The bytes to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        The result.
      • sendBytes

        public Result sendBytes​(byte[] content,
                                boolean inline,
                                Optional<String> fileName,
                                FileMimeTypes fileMimeTypes)
        Send the given bytes.
        Parameters:
        content - The bytes to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        The result.
      • sendByteString

        public Result sendByteString​(ByteString content)
        Send the given ByteString.
        Parameters:
        content - The ByteString to send.
        Returns:
        The result.
      • sendByteString

        public Result sendByteString​(ByteString content,
                                     Optional<String> contentType)
        Send the given ByteString.
        Parameters:
        content - The ByteString to send.
        contentType - the entity content type.
        Returns:
        The result.
      • sendByteString

        public Result sendByteString​(ByteString content,
                                     boolean inline,
                                     Optional<String> fileName)
        Send the given ByteString.
        Parameters:
        content - The ByteString to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        The result.
      • sendByteString

        public Result sendByteString​(ByteString content,
                                     boolean inline,
                                     Optional<String> fileName,
                                     FileMimeTypes fileMimeTypes)
        Send the given ByteString.
        Parameters:
        content - The ByteString to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        The result.
      • sendResource

        public Result sendResource​(String resourceName)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   FileMimeTypes fileMimeTypes)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   FileMimeTypes fileMimeTypes,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   Optional<String> fileName)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   Optional<String> fileName,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   Optional<String> fileName,
                                   FileMimeTypes fileMimeTypes)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   Optional<String> fileName,
                                   FileMimeTypes fileMimeTypes,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   FileMimeTypes fileMimeTypes)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   FileMimeTypes fileMimeTypes,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   Optional<String> fileName)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   Optional<String> fileName,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   Optional<String> fileName,
                                   FileMimeTypes fileMimeTypes)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   Optional<String> fileName,
                                   FileMimeTypes fileMimeTypes,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   boolean inline)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   boolean inline,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   boolean inline,
                                   FileMimeTypes fileMimeTypes)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   boolean inline,
                                   FileMimeTypes fileMimeTypes,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body with in-line content disposition.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline,
                                   FileMimeTypes fileMimeTypes)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline,
                                   FileMimeTypes fileMimeTypes,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        @Deprecated
        public Result sendResource​(String resourceName,
                                   boolean inline,
                                   String filename)
        Deprecated.
        Deprecated as of 2.8.0. Use sendResource(String,boolean,Optional).
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   boolean inline,
                                   Optional<String> filename)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   boolean inline,
                                   Optional<String> filename,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        @Deprecated
        public Result sendResource​(String resourceName,
                                   boolean inline,
                                   String filename,
                                   FileMimeTypes fileMimeTypes)
        Deprecated.
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   boolean inline,
                                   Optional<String> filename,
                                   FileMimeTypes fileMimeTypes)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   boolean inline,
                                   Optional<String> filename,
                                   FileMimeTypes fileMimeTypes,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource.

        The resource will be loaded from the same classloader that this class comes from.

        Parameters:
        resourceName - The path of the resource to load.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        @Deprecated
        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline,
                                   String filename)
        Deprecated.
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline,
                                   Optional<String> filename)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline,
                                   Optional<String> filename,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        @Deprecated
        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline,
                                   String filename,
                                   FileMimeTypes fileMimeTypes)
        Deprecated.
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline,
                                   Optional<String> filename,
                                   FileMimeTypes fileMimeTypes)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendResource

        public Result sendResource​(String resourceName,
                                   ClassLoader classLoader,
                                   boolean inline,
                                   Optional<String> filename,
                                   FileMimeTypes fileMimeTypes,
                                   Runnable onClose,
                                   Executor executor)
        Send the given resource from the given classloader.
        Parameters:
        resourceName - The path of the resource to load.
        classLoader - The classloader to load it from.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the resource in the body.
      • sendPath

        public Result sendPath​(Path path)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        Returns:
        a '200 OK' result containing the file at the provided path with inline content disposition.
      • sendPath

        public Result sendPath​(Path path,
                               Runnable onClose,
                               Executor executor)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file at the provided path with inline content disposition.
      • sendPath

        public Result sendPath​(Path path,
                               FileMimeTypes fileMimeTypes)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file at the provided path with inline content disposition.
      • sendPath

        public Result sendPath​(Path path,
                               FileMimeTypes fileMimeTypes,
                               Runnable onClose,
                               Executor executor)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file at the provided path with inline content disposition.
      • sendPath

        public Result sendPath​(Path path,
                               boolean inline)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               boolean inline,
                               Runnable onClose,
                               Executor executor)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               boolean inline,
                               FileMimeTypes fileMimeTypes)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               boolean inline,
                               FileMimeTypes fileMimeTypes,
                               Runnable onClose,
                               Executor executor)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        @Deprecated
        public Result sendPath​(Path path,
                               String filename)
        Deprecated.
        Deprecated as of 2.8.0. Use to sendPath(Path, Optional).
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               Optional<String> filename)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               Optional<String> filename,
                               Runnable onClose,
                               Executor executor)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        @Deprecated
        public Result sendPath​(Path path,
                               String filename,
                               FileMimeTypes fileMimeTypes)
        Deprecated.
        Deprecated as of 2.8.0. Use to sendPath(Path, Optional, FileMimeTypes).
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               Optional<String> filename,
                               FileMimeTypes fileMimeTypes)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               Optional<String> filename,
                               FileMimeTypes fileMimeTypes,
                               Runnable onClose,
                               Executor executor)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions.
        Parameters:
        path - The path to send.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        @Deprecated
        public Result sendPath​(Path path,
                               boolean inline,
                               String filename)
        Deprecated.
        Deprecated as of 2.8.0. Use to sendPath(Path, boolean, Optional).
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               boolean inline,
                               Optional<String> filename)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               boolean inline,
                               Optional<String> filename,
                               Runnable onClose,
                               Executor executor)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        @Deprecated
        public Result sendPath​(Path path,
                               boolean inline,
                               String filename,
                               FileMimeTypes fileMimeTypes)
        Deprecated.
        Deprecated as of 2.8.0. Use to sendPath(Path, boolean, Optional, FileMimeTypes).
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               boolean inline,
                               Optional<String> filename,
                               FileMimeTypes fileMimeTypes)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendPath

        public Result sendPath​(Path path,
                               boolean inline,
                               Optional<String> filename,
                               FileMimeTypes fileMimeTypes,
                               Runnable onClose,
                               Executor executor)
        Sends the given path if it is a valid file. Otherwise throws RuntimeExceptions
        Parameters:
        path - The path to send.
        inline - Whether it should be served as an inline file, or as an attachment.
        filename - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file at the provided path
      • sendFile

        public Result sendFile​(File file)
        Sends the given file using the default inline mode.
        Parameters:
        file - The file to send.
        Returns:
        a '200 OK' result containing the file.
      • sendFile

        public Result sendFile​(File file,
                               Runnable onClose,
                               Executor executor)
        Sends the given file using the default inline mode.
        Parameters:
        file - The file to send.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file.
      • sendFile

        public Result sendFile​(File file,
                               FileMimeTypes fileMimeTypes)
        Sends the given file using the default inline mode.
        Parameters:
        file - The file to send.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file.
      • sendFile

        public Result sendFile​(File file,
                               FileMimeTypes fileMimeTypes,
                               Runnable onClose,
                               Executor executor)
        Sends the given file using the default inline mode.
        Parameters:
        file - The file to send.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file.
      • sendFile

        public Result sendFile​(File file,
                               boolean inline)
        Sends the given file.
        Parameters:
        file - The file to send.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               boolean inline,
                               Runnable onClose,
                               Executor executor)
        Sends the given file.
        Parameters:
        file - The file to send.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               boolean inline,
                               FileMimeTypes fileMimeTypes)
        Sends the given file.
        Parameters:
        file - The file to send.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               boolean inline,
                               FileMimeTypes fileMimeTypes,
                               Runnable onClose,
                               Executor executor)
        Sends the given file.
        Parameters:
        file - The file to send.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        @Deprecated
        public Result sendFile​(File file,
                               String fileName)
        Deprecated.
        Deprecated as of 2.8.0. Use to sendFile(File, Optional).
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               Optional<String> fileName)
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               Optional<String> fileName,
                               Runnable onClose,
                               Executor executor)
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        @Deprecated
        public Result sendFile​(File file,
                               String fileName,
                               FileMimeTypes fileMimeTypes)
        Deprecated.
        Deprecated as of 2.8.0. Use to sendFile(File, Optional, FileMimeTypes).
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               Optional<String> fileName,
                               FileMimeTypes fileMimeTypes)
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               Optional<String> fileName,
                               FileMimeTypes fileMimeTypes,
                               Runnable onClose,
                               Executor executor)
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        @Deprecated
        public Result sendFile​(File file,
                               boolean inline,
                               String fileName)
        Deprecated.
        Deprecated as of 2.8.0. Use to sendFile(File, boolean, Optional).
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               boolean inline,
                               Optional<String> fileName)
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               boolean inline,
                               Optional<String> fileName,
                               Runnable onClose,
                               Executor executor)
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        @Deprecated
        public Result sendFile​(File file,
                               boolean inline,
                               String fileName,
                               FileMimeTypes fileMimeTypes)
        Deprecated.
        Deprecated as of 2.8.0. Use to sendFile(File, boolean, Optional, FileMimeTypes).
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               boolean inline,
                               Optional<String> fileName,
                               FileMimeTypes fileMimeTypes)
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' result containing the file
      • sendFile

        public Result sendFile​(File file,
                               boolean inline,
                               Optional<String> fileName,
                               FileMimeTypes fileMimeTypes,
                               Runnable onClose,
                               Executor executor)
        Send the given file.
        Parameters:
        file - The file to send.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        inline - True if the file should be sent inline, false if it should be sent as an attachment.
        fileMimeTypes - Used for file type mapping.
        onClose - Useful in order to perform cleanup operations (e.g. deleting a temporary file generated for a download).
        executor - The executor to use for asynchronous execution of onClose.
        Returns:
        a '200 OK' result containing the file
      • chunked

        public Result chunked​(Source<ByteString,​?> chunks)
        Send a chunked response with the given chunks.
        Parameters:
        chunks - the chunks to send
        Returns:
        a '200 OK' response with the given chunks.
      • chunked

        public Result chunked​(Source<ByteString,​?> chunks,
                              Optional<String> contentType)
        Send a chunked response with the given chunks.
        Parameters:
        chunks - the chunks to send
        contentType - the entity content type.
        Returns:
        a '200 OK' response with the given chunks.
      • chunked

        public Result chunked​(Source<ByteString,​?> chunks,
                              boolean inline,
                              Optional<String> fileName)
        Send a chunked response with the given chunks.
        Parameters:
        chunks - the chunks to send
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' response with the given chunks.
      • chunked

        public Result chunked​(Source<ByteString,​?> chunks,
                              boolean inline,
                              Optional<String> fileName,
                              FileMimeTypes fileMimeTypes)
        Send a chunked response with the given chunks.
        Parameters:
        chunks - the chunks to send
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' response with the given chunks.
      • streamed

        public Result streamed​(Source<ByteString,​?> body,
                               Optional<Long> contentLength)
        Send a streamed response with the given source.
        Parameters:
        body - the source to send
        contentLength - the entity content length.
        Returns:
        a '200 OK' response with the given body.
      • streamed

        public Result streamed​(Source<ByteString,​?> body,
                               Optional<Long> contentLength,
                               Optional<String> contentType)
        Send a streamed response with the given source.
        Parameters:
        body - the source to send
        contentLength - the entity content length.
        contentType - the entity content type.
        Returns:
        a '200 OK' response with the given body.
      • streamed

        public Result streamed​(Source<ByteString,​?> body,
                               Optional<Long> contentLength,
                               boolean inline,
                               Optional<String> fileName)
        Send a streamed response with the given source.
        Parameters:
        body - the source to send
        contentLength - the entity content length.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a '200 OK' response with the given body.
      • streamed

        public Result streamed​(Source<ByteString,​?> body,
                               Optional<Long> contentLength,
                               boolean inline,
                               Optional<String> fileName,
                               FileMimeTypes fileMimeTypes)
        Send a streamed response with the given source.
        Parameters:
        body - the source to send
        contentLength - the entity content length.
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a '200 OK' response with the given body.
      • sendJson

        public Result sendJson​(com.fasterxml.jackson.databind.JsonNode json)
        Send a json result.
        Parameters:
        json - the json node to send
        Returns:
        a '200 OK' result containing the json encoded as UTF-8.
      • sendJson

        public Result sendJson​(com.fasterxml.jackson.databind.JsonNode json,
                               boolean inline,
                               Optional<String> fileName)
        Send a json result.
        Parameters:
        json - the json node to send
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header.
        Returns:
        a '200 OK' result containing the json encoded as UTF-8.
      • sendJson

        public Result sendJson​(com.fasterxml.jackson.databind.JsonNode json,
                               com.fasterxml.jackson.core.JsonEncoding encoding)
        Send a json result.
        Parameters:
        json - the json to send
        encoding - the encoding in which to encode the json (e.g. "UTF-8")
        Returns:
        a '200 OK' result containing the json encoded with the given charset
      • sendJson

        public Result sendJson​(com.fasterxml.jackson.databind.JsonNode json,
                               com.fasterxml.jackson.core.JsonEncoding encoding,
                               boolean inline,
                               Optional<String> fileName)
        Send a json result.
        Parameters:
        json - the json to send
        encoding - the encoding in which to encode the json (e.g. "UTF-8")
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header.
        Returns:
        a '200 OK' result containing the json encoded with the given charset
      • sendEntity

        public Result sendEntity​(HttpEntity entity)
        Send an HTTP entity.
        Parameters:
        entity - the entity to send
        Returns:
        a response with the given body.
      • sendEntity

        public Result sendEntity​(HttpEntity entity,
                                 boolean inline,
                                 Optional<String> fileName)
        Send an HTTP entity.
        Parameters:
        entity - the entity to send
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name or fallback to application/octet-stream if unknown.
        Returns:
        a response with the given body.
      • sendEntity

        public Result sendEntity​(HttpEntity entity,
                                 boolean inline,
                                 Optional<String> fileName,
                                 FileMimeTypes fileMimeTypes)
        Send an HTTP entity.
        Parameters:
        entity - the entity to send
        inline - Whether it should be served as an inline file, or as an attachment.
        fileName - The file name rendered in the Content-Disposition header. The response will also automatically include the MIME type in the Content-Type header deducing it from this file name if fileMimeTypes includes it or fallback to application/octet-stream if unknown.
        fileMimeTypes - Used for file type mapping.
        Returns:
        a response with the given body.