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

Field Summary
 String contentType
          Deprecated. (scheduled to be made private in 1.6) Use getType() or setType(java.lang.String)
 Object data
          Deprecated. (scheduled to be made private final in 1.6) Use getData() or setData(java.lang.Object)
 
Constructor Summary
UrlEncodedContent()
          Deprecated. (scheduled to be removed in 1.6) Use UrlEncodedContent(Object)
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
 

Field Detail

contentType

@Deprecated
public String contentType
Deprecated. (scheduled to be made private in 1.6) Use getType() or setType(java.lang.String)
Content type. Default value is UrlEncodedParser.CONTENT_TYPE.


data

@Deprecated
public Object data
Deprecated. (scheduled to be made private final in 1.6) Use getData() or setData(java.lang.Object)
Key name/value data or null for none.

Constructor Detail

UrlEncodedContent

@Deprecated
public UrlEncodedContent()
Deprecated. (scheduled to be removed in 1.6) Use UrlEncodedContent(Object)


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.