Class StatusHeader
- Object
-
- play.mvc.Result
-
- play.mvc.StatusHeader
-
public class StatusHeader extends Result
A status with no body
-
-
Constructor Summary
Constructors Constructor Description StatusHeader(int status)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Result
chunked(Source<ByteString,?> chunks)
Send a chunked response with the given chunks.Result
chunked(Source<ByteString,?> chunks, boolean inline, Optional<String> fileName)
Send a chunked response with the given chunks.Result
chunked(Source<ByteString,?> chunks, boolean inline, Optional<String> fileName, FileMimeTypes fileMimeTypes)
Send a chunked response with the given chunks.Result
chunked(Source<ByteString,?> chunks, Optional<String> contentType)
Send a chunked response with the given chunks.Result
sendBytes(byte[] content)
Send the given bytes.Result
sendBytes(byte[] content, boolean inline, Optional<String> fileName)
Send the given bytes.Result
sendBytes(byte[] content, boolean inline, Optional<String> fileName, FileMimeTypes fileMimeTypes)
Send the given bytes.Result
sendBytes(byte[] content, Optional<String> contentType)
Send the given bytes.Result
sendByteString(ByteString content)
Send the given ByteString.Result
sendByteString(ByteString content, boolean inline, Optional<String> fileName)
Send the given ByteString.Result
sendByteString(ByteString content, boolean inline, Optional<String> fileName, FileMimeTypes fileMimeTypes)
Send the given ByteString.Result
sendByteString(ByteString content, Optional<String> contentType)
Send the given ByteString.Result
sendEntity(HttpEntity entity)
Send an HTTP entity.Result
sendEntity(HttpEntity entity, boolean inline, Optional<String> fileName)
Send an HTTP entity.Result
sendEntity(HttpEntity entity, boolean inline, Optional<String> fileName, FileMimeTypes fileMimeTypes)
Send an HTTP entity.Result
sendFile(File file)
Sends the given file using the default inline mode.Result
sendFile(File file, boolean inline)
Sends the given file.Result
sendFile(File file, boolean inline, Runnable onClose, Executor executor)
Sends the given file.Result
sendFile(File file, boolean inline, String fileName)
Deprecated.Deprecated as of 2.8.0.Result
sendFile(File file, boolean inline, String fileName, FileMimeTypes fileMimeTypes)
Deprecated.Deprecated as of 2.8.0.Result
sendFile(File file, boolean inline, Optional<String> fileName)
Send the given file.Result
sendFile(File file, boolean inline, Optional<String> fileName, Runnable onClose, Executor executor)
Send the given file.Result
sendFile(File file, boolean inline, Optional<String> fileName, FileMimeTypes fileMimeTypes)
Send the given file.Result
sendFile(File file, boolean inline, Optional<String> fileName, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Send the given file.Result
sendFile(File file, boolean inline, FileMimeTypes fileMimeTypes)
Sends the given file.Result
sendFile(File file, boolean inline, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Sends the given file.Result
sendFile(File file, Runnable onClose, Executor executor)
Sends the given file using the default inline mode.Result
sendFile(File file, String fileName)
Deprecated.Deprecated as of 2.8.0.Result
sendFile(File file, String fileName, FileMimeTypes fileMimeTypes)
Deprecated.Deprecated as of 2.8.0.Result
sendFile(File file, Optional<String> fileName)
Send the given file.Result
sendFile(File file, Optional<String> fileName, Runnable onClose, Executor executor)
Send the given file.Result
sendFile(File file, Optional<String> fileName, FileMimeTypes fileMimeTypes)
Send the given file.Result
sendFile(File file, Optional<String> fileName, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Send the given file.Result
sendFile(File file, FileMimeTypes fileMimeTypes)
Sends the given file using the default inline mode.Result
sendFile(File file, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Sends the given file using the default inline mode.Result
sendInputStream(InputStream stream)
Send the given input stream.Result
sendInputStream(InputStream stream, long contentLength)
Send the given input stream.Result
sendInputStream(InputStream stream, long contentLength, Runnable onClose, Executor executor)
Send the given input stream.Result
sendInputStream(InputStream stream, long contentLength, Optional<String> contentType)
Send the given input stream.Result
sendInputStream(InputStream stream, long contentLength, Optional<String> contentType, Runnable onClose, Executor executor)
Send the given input stream.Result
sendInputStream(InputStream stream, Runnable onClose, Executor executor)
Send the given input stream.Result
sendInputStream(InputStream stream, Optional<String> contentType)
Send the given input stream.Result
sendInputStream(InputStream stream, Optional<String> contentType, Runnable onClose, Executor executor)
Send the given input stream.Result
sendJson(com.fasterxml.jackson.databind.JsonNode json)
Send a json result.Result
sendJson(com.fasterxml.jackson.databind.JsonNode json, boolean inline, Optional<String> fileName)
Send a json result.Result
sendJson(com.fasterxml.jackson.databind.JsonNode json, com.fasterxml.jackson.core.JsonEncoding encoding)
Send a json result.Result
sendJson(com.fasterxml.jackson.databind.JsonNode json, com.fasterxml.jackson.core.JsonEncoding encoding, boolean inline, Optional<String> fileName)
Send a json result.Result
sendPath(Path path)
Sends the given path if it is a valid file.Result
sendPath(Path path, boolean inline)
Sends the given path if it is a valid file.Result
sendPath(Path path, boolean inline, Runnable onClose, Executor executor)
Sends the given path if it is a valid file.Result
sendPath(Path path, boolean inline, String filename)
Deprecated.Deprecated as of 2.8.0.Result
sendPath(Path path, boolean inline, String filename, FileMimeTypes fileMimeTypes)
Deprecated.Deprecated as of 2.8.0.Result
sendPath(Path path, boolean inline, Optional<String> filename)
Sends the given path if it is a valid file.Result
sendPath(Path path, boolean inline, Optional<String> filename, Runnable onClose, Executor executor)
Sends the given path if it is a valid file.Result
sendPath(Path path, boolean inline, Optional<String> filename, FileMimeTypes fileMimeTypes)
Sends the given path if it is a valid file.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.Result
sendPath(Path path, boolean inline, FileMimeTypes fileMimeTypes)
Sends the given path if it is a valid file.Result
sendPath(Path path, boolean inline, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Sends the given path if it is a valid file.Result
sendPath(Path path, Runnable onClose, Executor executor)
Sends the given path if it is a valid file.Result
sendPath(Path path, String filename)
Deprecated.Deprecated as of 2.8.0.Result
sendPath(Path path, String filename, FileMimeTypes fileMimeTypes)
Deprecated.Deprecated as of 2.8.0.Result
sendPath(Path path, Optional<String> filename)
Sends the given path if it is a valid file.Result
sendPath(Path path, Optional<String> filename, Runnable onClose, Executor executor)
Sends the given path if it is a valid file.Result
sendPath(Path path, Optional<String> filename, FileMimeTypes fileMimeTypes)
Sends the given path if it is a valid file.Result
sendPath(Path path, Optional<String> filename, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Sends the given path if it is a valid file.Result
sendPath(Path path, FileMimeTypes fileMimeTypes)
Sends the given path if it is a valid file.Result
sendPath(Path path, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Sends the given path if it is a valid file.Result
sendResource(String resourceName)
Send the given resource.Result
sendResource(String resourceName, boolean inline)
Send the given resource.Result
sendResource(String resourceName, boolean inline, Runnable onClose, Executor executor)
Send the given resource.Result
sendResource(String resourceName, boolean inline, String filename)
Deprecated.Deprecated as of 2.8.0.Result
sendResource(String resourceName, boolean inline, String filename, FileMimeTypes fileMimeTypes)
Deprecated.Deprecated as of 2.8.0.Result
sendResource(String resourceName, boolean inline, Optional<String> filename)
Send the given resource.Result
sendResource(String resourceName, boolean inline, Optional<String> filename, Runnable onClose, Executor executor)
Send the given resource.Result
sendResource(String resourceName, boolean inline, Optional<String> filename, FileMimeTypes fileMimeTypes)
Send the given resource.Result
sendResource(String resourceName, boolean inline, Optional<String> filename, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Send the given resource.Result
sendResource(String resourceName, boolean inline, FileMimeTypes fileMimeTypes)
Send the given resource.Result
sendResource(String resourceName, boolean inline, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Send the given resource.Result
sendResource(String resourceName, ClassLoader classLoader)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, boolean inline)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, boolean inline, Runnable onClose, Executor executor)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, boolean inline, String filename)
Deprecated.Deprecated as of 2.8.0.Result
sendResource(String resourceName, ClassLoader classLoader, boolean inline, String filename, FileMimeTypes fileMimeTypes)
Deprecated.Deprecated as of 2.8.0.Result
sendResource(String resourceName, ClassLoader classLoader, boolean inline, Optional<String> filename)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, boolean inline, Optional<String> filename, Runnable onClose, Executor executor)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, boolean inline, Optional<String> filename, FileMimeTypes fileMimeTypes)
Send the given resource from the given classloader.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.Result
sendResource(String resourceName, ClassLoader classLoader, boolean inline, FileMimeTypes fileMimeTypes)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, boolean inline, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, Runnable onClose, Executor executor)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, Optional<String> fileName)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, Optional<String> fileName, Runnable onClose, Executor executor)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, Optional<String> fileName, FileMimeTypes fileMimeTypes)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, Optional<String> fileName, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, FileMimeTypes fileMimeTypes)
Send the given resource from the given classloader.Result
sendResource(String resourceName, ClassLoader classLoader, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Send the given resource from the given classloader.Result
sendResource(String resourceName, Runnable onClose, Executor executor)
Send the given resource.Result
sendResource(String resourceName, Optional<String> fileName)
Send the given resource.Result
sendResource(String resourceName, Optional<String> fileName, Runnable onClose, Executor executor)
Send the given resource.Result
sendResource(String resourceName, Optional<String> fileName, FileMimeTypes fileMimeTypes)
Send the given resource.Result
sendResource(String resourceName, Optional<String> fileName, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Send the given resource.Result
sendResource(String resourceName, FileMimeTypes fileMimeTypes)
Send the given resource.Result
sendResource(String resourceName, FileMimeTypes fileMimeTypes, Runnable onClose, Executor executor)
Send the given resource.Result
streamed(Source<ByteString,?> body, Optional<Long> contentLength)
Send a streamed response with the given source.Result
streamed(Source<ByteString,?> body, Optional<Long> contentLength, boolean inline, Optional<String> fileName)
Send a streamed response with the given source.Result
streamed(Source<ByteString,?> body, Optional<Long> contentLength, boolean inline, Optional<String> fileName, FileMimeTypes fileMimeTypes)
Send a streamed response with the given source.Result
streamed(Source<ByteString,?> body, Optional<Long> contentLength, Optional<String> contentType)
Send a streamed response with the given source.-
Methods inherited from class play.mvc.Result
addAttr, addAttrs, addAttrs, addAttrs, addAttrs, addAttrs, addingToSession, addingToSession, as, asScala, attrs, body, charset, contentType, cookie, cookies, discardingCookie, discardingCookie, discardingCookie, discardingCookie, discardingCookie, flash, flashing, flashing, getCookie, getHeader, header, headers, reasonPhrase, redirectLocation, removeAttr, removingFromFlash, removingFromSession, session, session, status, withAttrs, withCookies, withFlash, withFlash, withHeader, withHeaders, withLang, withLang, withNewFlash, withNewSession, withoutHeader, withoutLang, withSession, withSession
-
-
-
-
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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 ofonClose
.- 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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 ofonClose
.- 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 ofonClose
.- 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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 ofonClose
.- 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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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. UsesendResource(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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 ofonClose
.- 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.Deprecated as of 2.8.0. Use tosendResource(String, boolean, Optional, 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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 ofonClose
.- 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.Deprecated as of 2.8.0. Use tosendResource(String, ClassLoader, boolean, Optional)
.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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 ofonClose
.- 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.Deprecated as of 2.8.0. Use tosendResource(String, ClassLoader, boolean, Optional, 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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 tosendPath(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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 ofonClose
.- 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 tosendPath(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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 ofonClose
.- 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 tosendPath(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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 ofonClose
.- 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 tosendPath(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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 ofonClose
.- 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 tosendFile(File, Optional)
.Send the given file.- Parameters:
file
- The file to send.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 ofonClose
.- 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 tosendFile(File, Optional, FileMimeTypes)
.Send the given file.- Parameters:
file
- The file to send.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 ofonClose
.- 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 tosendFile(File, boolean, Optional)
.Send the given file.- Parameters:
file
- The file to send.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 ofonClose
.- 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 tosendFile(File, boolean, Optional, FileMimeTypes)
.Send the given file.- Parameters:
file
- The file to send.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 ofonClose
.- 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 sendcontentType
- 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 sendinline
- Whether it should be served as an inline file, or as an attachment.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 sendinline
- Whether it should be served as an inline file, or as an attachment.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/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 sendcontentLength
- 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 sendcontentLength
- 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 sendcontentLength
- the entity content length.inline
- Whether it should be served as an inline file, or as an attachment.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 sendcontentLength
- the entity content length.inline
- Whether it should be served as an inline file, or as an attachment.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 sendinline
- Whether it should be served as an inline file, or as an attachment.fileName
- The file name rendered in theContent-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 sendencoding
- 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 sendencoding
- 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 theContent-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 sendinline
- Whether it should be served as an inline file, or as an attachment.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name or fallback toapplication/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 sendinline
- Whether it should be served as an inline file, or as an attachment.fileName
- The file name rendered in theContent-Disposition
header. The response will also automatically include the MIME type in theContent-Type
header deducing it from this file name iffileMimeTypes
includes it or fallback toapplication/octet-stream
if unknown.fileMimeTypes
- Used for file type mapping.- Returns:
- a response with the given body.
-
-