Package com.stripe.net
Class HttpContent
java.lang.Object
com.stripe.net.HttpContent
Represents the content of an HTTP request, i.e. the request's body. This class also holds the
value of the
Content-Type
header, which can depend on the body in some cases (e.g. for
multipart requests).-
Method Summary
Modifier and TypeMethodDescriptionstatic HttpContent
buildFormURLEncodedContent
(Collection<KeyValuePair<String, String>> nameValueCollection) Builds a new HttpContent for name/value tuples encoded usingapplication/x-www-form-urlencoded
MIME type.static HttpContent
buildMultipartFormDataContent
(Collection<KeyValuePair<String, Object>> nameValueCollection) Builds a new HttpContent for name/value tuples encoded usingmultipart/form-data
MIME type.static HttpContent
buildMultipartFormDataContent
(Collection<KeyValuePair<String, Object>> nameValueCollection, String boundary) Builds a new HttpContent for name/value tuples encoded usingmultipart/form-data
MIME type.byte[]
The request's content, as a byte array.The value of theContent-Type
header.boolean
int
hashCode()
The request's content, as a string.toString()
-
Method Details
-
buildFormURLEncodedContent
public static HttpContent buildFormURLEncodedContent(Collection<KeyValuePair<String, String>> nameValueCollection) throws IOExceptionBuilds a new HttpContent for name/value tuples encoded usingapplication/x-www-form-urlencoded
MIME type.- Parameters:
nameValueCollection
- the collection of name/value tuples to encode- Returns:
- the encoded HttpContent instance
- Throws:
IllegalArgumentException
- if nameValueCollection is nullIOException
-
stringContent
The request's content, as a string. -
buildMultipartFormDataContent
public static HttpContent buildMultipartFormDataContent(Collection<KeyValuePair<String, Object>> nameValueCollection) throws IOExceptionBuilds a new HttpContent for name/value tuples encoded usingmultipart/form-data
MIME type.- Parameters:
nameValueCollection
- the collection of name/value tuples to encode- Returns:
- the encoded HttpContent instance
- Throws:
IllegalArgumentException
- if nameValueCollection is nullIOException
-
buildMultipartFormDataContent
public static HttpContent buildMultipartFormDataContent(Collection<KeyValuePair<String, Object>> nameValueCollection, String boundary) throws IOExceptionBuilds a new HttpContent for name/value tuples encoded usingmultipart/form-data
MIME type.- Parameters:
nameValueCollection
- the collection of name/value tuples to encodeboundary
- the boundary- Returns:
- the encoded HttpContent instance
- Throws:
IllegalArgumentException
- if nameValueCollection is nullIOException
-
byteArrayContent
public byte[] byteArrayContent()The request's content, as a byte array. -
contentType
The value of theContent-Type
header. -
equals
-
hashCode
public int hashCode() -
toString
-