Class FormRouteCompleter

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

@Internal public final class FormRouteCompleter extends Object
This class distributes fields from FormCapableHttpRequest.getRawFormFields() to different argument binders by name.
Since:
5.0.0
Author:
Jonas Konrad
  • Method Details

    • subscribeField

      public Publisher<RawFormField> subscribeField(String name, FormRouteCompleter.SubscriptionMetadata metadata)
      Subscribe to a field of a particular name.
      Parameters:
      name - The field name
      metadata - The subscription metadata, used for detecting and reporting deadlocks
      Returns:
      The publisher
    • isClaimed

      public boolean isClaimed(String inputName)
    • start

      public void start()
      Start reading the form data. After this method is called, no more fields may be subscribed to.
    • stopDeadlockDetection

      public void stopDeadlockDetection()
      Stop deadlock detection. This is called immediately before the controller is called. After this, it's up to the user to properly relieve backpressure on the parameters we've passed to her.
    • mapForGetBody

      public Map<String,Object> mapForGetBody(Charset charset)
      Convert the full form data into a Map for HttpMessage.getBody().
      Parameters:
      charset - The charset
      Returns:
      The map
    • mapForGetBody

      public static Map<String,Object> mapForGetBody(Map<String, ? extends Iterable<CloseableByteBody>> byteBodies, Charset charset)
      Transform a map of CloseableByteBody into a map of strings (and list of strings if necessary).

      Ownership of the bodies transfers to this method immediately. If this method throws an exception, all bodies are still closed.

      Parameters:
      byteBodies - The bodies to transform
      charset - The charset to use for decoding
      Returns:
      The transformed bodies
      Throws:
      IllegalStateException - If any of the input bodies is not yet fully available