Class FormRouteCompleter
java.lang.Object
io.micronaut.http.server.multipart.FormRouteCompleter
This class distributes fields from
FormCapableHttpRequest.getRawFormFields() to
different argument binders by name.- Since:
- 5.0.0
- Author:
- Jonas Konrad
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final recordstatic enum -
Method Summary
Modifier and TypeMethodDescriptionbooleanmapForGetBody(Charset charset) Convert the full form data into aMapforHttpMessage.getBody().mapForGetBody(Map<String, ? extends Iterable<CloseableByteBody>> byteBodies, Charset charset) Transform a map ofCloseableByteBodyinto a map of strings (and list of strings if necessary).voidstart()Start reading the form data.voidStop deadlock detection.subscribeField(String name, FormRouteCompleter.SubscriptionMetadata metadata) Subscribe to a field of a particular name.
-
Method Details
-
subscribeField
public Publisher<RawFormField> subscribeField(String name, FormRouteCompleter.SubscriptionMetadata metadata) Subscribe to a field of a particular name.- Parameters:
name- The field namemetadata- The subscription metadata, used for detecting and reporting deadlocks- Returns:
- The publisher
-
isClaimed
-
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
-
mapForGetBody
public static Map<String,Object> mapForGetBody(Map<String, ? extends Iterable<CloseableByteBody>> byteBodies, Charset charset) Transform a map ofCloseableByteBodyinto 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 transformcharset- The charset to use for decoding- Returns:
- The transformed bodies
- Throws:
IllegalStateException- If any of the input bodies is not yet fully available
-