Class FormFactory

java.lang.Object
io.micronaut.http.server.multipart.FormFactory

@Internal @Singleton public final class FormFactory extends Object
Global utility class for form data access.
Since:
5.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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 streamed RawFormField into a CompletedFileUpload.
    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 FormRouteCompleter
    getCompleterOrNull(io.micronaut.http.HttpRequest<?> request)
    Get the completer for the given request, if it has been created by getOrCreateCompleter(HttpRequest).
     
    getOrCreateCompleter(io.micronaut.http.HttpRequest<?> request)
    Create the completer for the given request if necessary.
    io.micronaut.http.multipart.StreamingFileUpload
    streamFileUpload(io.micronaut.http.multipart.RawFormField formField)
    Create a new StreamingFileUpload from the given raw data.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getDiskWriteExecutor

      public Executor 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 by getOrCreateCompleter(HttpRequest).
      Parameters:
      request - The request
      Returns:
      The completer
    • getOrCreateCompleter

      public FormRouteCompleter getOrCreateCompleter(io.micronaut.http.HttpRequest<?> request)
      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 on
      formField - 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 on
      formField - 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 streamed RawFormField into a CompletedFileUpload. May save data to disk, if configured.
      Parameters:
      request - Optional request, used to get at the ReadBufferFactory
      formField - 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 new StreamingFileUpload from the given raw data.
      Parameters:
      formField - The field
      Returns:
      The streaming upload