Module methanol

Class 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
    A BodyPublisher for form submission using the application/x-www-form-urlencoded request type.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  FormBodyPublisher.Builder
      A builder of FormBodyPublisher instances.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long contentLength()  
      java.lang.String encodedString()
      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.
      MediaType mediaType()
      Returns the body's media type.
      static FormBodyPublisher.Builder newBuilder()
      Returns a new FormBodyPublisher.Builder.
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> queries()
      Returns this body's queries.
      void subscribe​(java.util.concurrent.Flow.Subscriber<? super java.nio.ByteBuffer> subscriber)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
      • contentLength

        public long contentLength()
        Specified by:
        contentLength in interface java.net.http.HttpRequest.BodyPublisher
      • subscribe

        public void subscribe​(java.util.concurrent.Flow.Subscriber<? super java.nio.ByteBuffer> subscriber)
        Specified by:
        subscribe in interface java.util.concurrent.Flow.Publisher<java.nio.ByteBuffer>