Class FormFactory
java.lang.Object
io.micronaut.http.server.multipart.FormFactory
Global utility class for form data access.
- Since:
- 5.0.0
-
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.core.execution.ExecutionFlow<io.micronaut.http.multipart.CompletedAttribute> completeAttribute(io.micronaut.http.form.FormCapableHttpRequest<?> request, io.micronaut.http.multipart.RawFormField formField) Asynchronously buffer the given attribute.io.micronaut.core.execution.ExecutionFlow<io.micronaut.http.multipart.CompletedFileUpload> completeFileUpload(io.micronaut.http.form.FormCapableHttpRequest<?> request, io.micronaut.http.multipart.RawFormField formField) Buffer a streamedRawFormFieldinto aCompletedFileUpload.io.micronaut.core.execution.ExecutionFlow<? extends io.micronaut.http.multipart.CompletedPart> completePart(io.micronaut.http.form.FormCapableHttpRequest<?> request, io.micronaut.http.multipart.RawFormField formField) Asynchronously buffer the given field.static @Nullable FormRouteCompletergetCompleterOrNull(io.micronaut.http.HttpRequest<?> request) Get the completer for the given request, if it has been created bygetOrCreateCompleter(HttpRequest).getOrCreateCompleter(io.micronaut.http.HttpRequest<?> request) Create the completer for the given request if necessary.io.micronaut.http.multipart.StreamingFileUploadstreamFileUpload(io.micronaut.http.multipart.RawFormField formField) Create a newStreamingFileUploadfrom the given raw data.
-
Method Details
-
getDiskWriteExecutor
-
getCompleterOrNull
@Nullable public static @Nullable FormRouteCompleter getCompleterOrNull(io.micronaut.http.HttpRequest<?> request) Get the completer for the given request, if it has been created bygetOrCreateCompleter(HttpRequest).- Parameters:
request- The request- Returns:
- The completer
-
getOrCreateCompleter
Create the completer for the given request if necessary.- Parameters:
request- The request- Returns:
- The completer
-
completePart
public io.micronaut.core.execution.ExecutionFlow<? extends io.micronaut.http.multipart.CompletedPart> completePart(io.micronaut.http.form.FormCapableHttpRequest<?> request, io.micronaut.http.multipart.RawFormField formField) Asynchronously buffer the given field. If the field is determined to be a file upload, data may be buffered to disk.- Parameters:
request- The request this field came in onformField- The field- Returns:
- A flow that completes when the full field has been buffered
-
completeAttribute
public io.micronaut.core.execution.ExecutionFlow<io.micronaut.http.multipart.CompletedAttribute> completeAttribute(io.micronaut.http.form.FormCapableHttpRequest<?> request, io.micronaut.http.multipart.RawFormField formField) Asynchronously buffer the given attribute.- Parameters:
request- The request this field came in onformField- The field- Returns:
- A flow that completes when the full field has been buffered
-
completeFileUpload
public io.micronaut.core.execution.ExecutionFlow<io.micronaut.http.multipart.CompletedFileUpload> completeFileUpload(io.micronaut.http.form.FormCapableHttpRequest<?> request, io.micronaut.http.multipart.RawFormField formField) Buffer a streamedRawFormFieldinto aCompletedFileUpload. May save data to disk, if configured.- Parameters:
request- Optional request, used to get at the ReadBufferFactoryformField- The form field to stream- Returns:
- The flow with the uploaded file
-
streamFileUpload
public io.micronaut.http.multipart.StreamingFileUpload streamFileUpload(io.micronaut.http.multipart.RawFormField formField) Create a newStreamingFileUploadfrom the given raw data.- Parameters:
formField- The field- Returns:
- The streaming upload
-