com.google.api.client.http
Class UrlEncodedContent

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

public final class UrlEncodedContent
extends Object
implements HttpContent

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) {
    UrlEncodedContent content = new UrlEncodedContent();
    content.data = item;
    request.content = content;
  }
 
 

Since:
1.0
Author:
Yaniv Inbar

Field Summary
 String contentType
          Content type.
 Object data
          Key/value data or null for none.
 
Constructor Summary
UrlEncodedContent()
           
 
Method Summary
 String getEncoding()
          Returns the content encoding (for example "gzip") or null for none.
 long getLength()
          Returns the content length or less than zero if not known.
 String getType()
          Returns the content type or null for none.
 boolean retrySupported()
          Returns whether or not retry is supported on this content type.
 void writeTo(OutputStream out)
          Writes the content to the given output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentType

public String contentType
Content type. Default value is UrlEncodedParser.CONTENT_TYPE.


data

public Object data
Key/value data or null for none.

Constructor Detail

UrlEncodedContent

public UrlEncodedContent()
Method Detail

getEncoding

public String getEncoding()
Description copied from interface: HttpContent
Returns the content encoding (for example "gzip") or null for none.

Specified by:
getEncoding in interface HttpContent

getLength

public long getLength()
Description copied from interface: HttpContent
Returns the content length or less than zero if not known.

Specified by:
getLength in interface HttpContent

getType

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

Specified by:
getType in interface HttpContent

writeTo

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

Specified by:
writeTo in interface HttpContent
Throws:
IOException

retrySupported

public boolean retrySupported()
Description copied from interface: HttpContent
Returns whether or not retry is supported on this content type. This is a backward incompatible change that affects versions prior to 1.4.

Specified by:
retrySupported in interface HttpContent


Copyright © 2010-2011 Google. All Rights Reserved.