public abstract class StrictForm
extends java.lang.Object
application/x-www-form-urlencoded
and multipart form data,
allowing joint unmarshalling access to either kind, **if** you supply both, a pekko.http.scaladsl.unmarshalling.FromStringUnmarshaller
as well as a pekko.http.scaladsl.unmarshalling.FromEntityUnmarshaller
for the target type T
.
Note: In order to allow for random access to the field values streamed multipart form data are strictified!
Don't use this abstraction on potentially unbounded forms (e.g. large file uploads).
If you only need to consume one type of form (application/x-www-form-urlencoded
*or* multipart) then
simply unmarshal directly to the respective form abstraction (pekko.http.scaladsl.model.FormData
or pekko.http.scaladsl.model.Multipart.FormData
)
rather than going through StrictForm
.
Simple usage example:
val strictFormFuture = Unmarshal(entity).to[StrictForm]
val fooFieldUnmarshalled: Future[T] =
strictFormFuture flatMap { form =>
Unmarshal(form field "foo").to[T]
}
Modifier and Type | Class and Description |
---|---|
static interface |
StrictForm.Field |
static class |
StrictForm.Field$ |
static class |
StrictForm.FileData
Simple model for strict file content in a multipart form data part.
|
static class |
StrictForm.FileData$ |
Constructor and Description |
---|
StrictForm() |
Modifier and Type | Method and Description |
---|---|
scala.Option<StrictForm.Field> |
field(java.lang.String name) |
abstract scala.collection.immutable.Seq<scala.Tuple2<java.lang.String,StrictForm.Field>> |
fields() |
static scala.concurrent.duration.FiniteDuration |
toStrictTimeout() |
static Unmarshaller<HttpEntity,StrictForm> |
unmarshaller(Unmarshaller<HttpEntity,FormData> formDataUM,
Unmarshaller<HttpEntity,Multipart.FormData> multipartUM) |
public static scala.concurrent.duration.FiniteDuration toStrictTimeout()
public static Unmarshaller<HttpEntity,StrictForm> unmarshaller(Unmarshaller<HttpEntity,FormData> formDataUM, Unmarshaller<HttpEntity,Multipart.FormData> multipartUM)
public abstract scala.collection.immutable.Seq<scala.Tuple2<java.lang.String,StrictForm.Field>> fields()
public scala.Option<StrictForm.Field> field(java.lang.String name)