- java.lang.Object
-
- com.github.mizosoft.methanol.FormBodyPublisher
-
- All Implemented Interfaces:
MimeBodyPublisher,java.net.http.HttpRequest.BodyPublisher,java.util.concurrent.Flow.Publisher<java.nio.ByteBuffer>
public final class FormBodyPublisher extends java.lang.Object implements MimeBodyPublisher
ABodyPublisherfor form submission using theapplication/x-www-form-urlencodedrequest type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFormBodyPublisher.BuilderA builder ofFormBodyPublisherinstances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longcontentLength()java.lang.StringencodedString()Returns the url-encoded string of this body's queries.java.util.Optional<java.lang.String>firstQuery(java.lang.String name)Returns the first value of the query associated with the given key.java.util.Optional<java.lang.String>lastQuery(java.lang.String name)Returns the last value of the query associated with the given key.MediaTypemediaType()Returns the body's media type.static FormBodyPublisher.BuildernewBuilder()Returns a newFormBodyPublisher.Builder.java.util.Map<java.lang.String,java.util.List<java.lang.String>>queries()Returns this body's queries.voidsubscribe(java.util.concurrent.Flow.Subscriber<? super java.nio.ByteBuffer> subscriber)
-
-
-
Method Detail
-
encodedString
public java.lang.String encodedString()
Returns the url-encoded string of this body's queries.
-
firstQuery
public java.util.Optional<java.lang.String> firstQuery(java.lang.String name)
Returns the first value of the query associated with the given key.- Parameters:
name- the query's name
-
lastQuery
public java.util.Optional<java.lang.String> lastQuery(java.lang.String name)
Returns the last value of the query associated with the given key.- Parameters:
name- the query's name
-
queries
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> queries()
Returns this body's queries.
-
mediaType
public MediaType mediaType()
Description copied from interface:MimeBodyPublisherReturns the body's media type.- Specified by:
mediaTypein interfaceMimeBodyPublisher
-
contentLength
public long contentLength()
- Specified by:
contentLengthin interfacejava.net.http.HttpRequest.BodyPublisher
-
subscribe
public void subscribe(java.util.concurrent.Flow.Subscriber<? super java.nio.ByteBuffer> subscriber)
- Specified by:
subscribein interfacejava.util.concurrent.Flow.Publisher<java.nio.ByteBuffer>
-
newBuilder
public static FormBodyPublisher.Builder newBuilder()
Returns a newFormBodyPublisher.Builder.
-
-