com.google.api.client.http
Class UrlEncodedContent

java.lang.Object
  extended by com.google.api.client.http.AbstractHttpContent
      extended by com.google.api.client.http.UrlEncodedContent
All Implemented Interfaces:
HttpContent

public class UrlEncodedContent
extends AbstractHttpContent

Implements support for HTTP form content encoding serialization of type application/x-www-form-urlencoded as specified in the HTML 4.0 Specification.

Sample usage:

 
  static void setContent(HttpRequest request, Object item) {
    request.setContent(new UrlEncodedContent(item));
  }
 
 

Implementation is not thread-safe.

Since:
1.0
Author:
Yaniv Inbar

Constructor Summary
UrlEncodedContent(Object data)
           
 
Method Summary
 Object getData()
          Returns the key name/value data or null for none.
 String getType()
          Returns the content type or null for none.
 UrlEncodedContent setData(Object data)
          Sets the key name/value data or null for none.
 UrlEncodedContent setType(String type)
          Sets the content type or null for none.
 void writeTo(OutputStream out)
          Writes the content to the given output stream.
 
Methods inherited from class com.google.api.client.http.AbstractHttpContent
computeLength, getEncoding, getLength, retrySupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlEncodedContent

public UrlEncodedContent(Object data)
Parameters:
data - key name/value data or null for none
Method Detail

getType

public String getType()
Description copied from interface: HttpContent
Returns the content type or null for none.


writeTo

public void writeTo(OutputStream out)
             throws IOException
Description copied from interface: HttpContent
Writes the content to the given output stream.

Throws:
IOException

setType

public UrlEncodedContent setType(String type)
Sets the content type or null for none.

Defaults to UrlEncodedParser.CONTENT_TYPE.

Since:
1.5

getData

public Object getData()
Returns the key name/value data or null for none.

Since:
1.5

setData

public UrlEncodedContent setData(Object data)
Sets the key name/value data or null for none.

Since:
1.5


Copyright © 2011 Google. All Rights Reserved.