Class HttpBody

java.lang.Object
com.couchbase.client.java.http.HttpBody

public class HttpBody extends Object
The body of a POST or PUT request.

Create an instance using one of the form(java.util.Map<java.lang.String, ?>) or json(byte[]) static factory methods, depending on the desired content type.

  • Method Summary

    Modifier and Type
    Method
    Description
    static HttpBody
    Creates an HTTP body with content type "application/x-www-form-urlencoded" and the given form data.
    static HttpBody
    Creates an HTTP body with content type "application/x-www-form-urlencoded" and the given form data.
    static HttpBody
    Creates an HTTP body with content type "application/x-www-form-urlencoded" and the given form data.
    static HttpBody
    form(Map<String,?> data)
    Creates an HTTP body with content type "application/x-www-form-urlencoded" and the given form data.
    static HttpBody
    json(byte[] json)
    Creates an HTTP body with content type "application/json" and the given content.
    static HttpBody
    json(String json)
    Creates an HTTP body with content type "application/json" and the given content.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • json

      public static HttpBody json(byte[] json)
      Creates an HTTP body with content type "application/json" and the given content.
    • json

      public static HttpBody json(String json)
      Creates an HTTP body with content type "application/json" and the given content.
    • form

      public static HttpBody form(Map<String,?> data)
      Creates an HTTP body with content type "application/x-www-form-urlencoded" and the given form data.

      This method URL-encodes the names and values; make sure the names and values you pass in are *NOT* already URL-encoded.

    • form

      public static HttpBody form(List<NameValuePair> data)
      Creates an HTTP body with content type "application/x-www-form-urlencoded" and the given form data.

      This method URL-encodes the names and values; make sure the names and values you pass in are *NOT* already URL-encoded.

    • form

      public static HttpBody form(NameValuePair... data)
      Creates an HTTP body with content type "application/x-www-form-urlencoded" and the given form data.

      This method URL-encodes the names and values; make sure the names and values you pass in are *NOT* already URL-encoded.

    • form

      public static HttpBody form(NameValuePairs data)
      Creates an HTTP body with content type "application/x-www-form-urlencoded" and the given form data.

      This method URL-encodes the names and values; make sure the names and values you pass in are *NOT* already URL-encoded.