com.google.api.client.http.xml
Class AbstractXmlHttpContent

java.lang.Object
  extended by com.google.api.client.http.AbstractHttpContent
      extended by com.google.api.client.http.xml.AbstractXmlHttpContent
All Implemented Interfaces:
HttpContent
Direct Known Subclasses:
AtomContent, XmlHttpContent

public abstract class AbstractXmlHttpContent
extends AbstractHttpContent

Abstract serializer for XML HTTP content based on the data key/value mapping object for an item.

Implementation is not thread-safe.

Since:
1.0
Author:
Yaniv Inbar

Constructor Summary
protected AbstractXmlHttpContent(XmlNamespaceDictionary namespaceDictionary)
           
 
Method Summary
 XmlNamespaceDictionary getNamespaceDictionary()
          Returns the XML namespace dictionary.
 AbstractXmlHttpContent setMediaType(HttpMediaType mediaType)
          Sets the media type to use for the Content-Type header, or null if unspecified.
 AbstractXmlHttpContent setType(String type)
          Deprecated. (scheduled to be removed in 1.11) Use setMediaType(HttpMediaType) instead.
 void writeTo(OutputStream out)
          Writes the content to the given output stream.
protected abstract  void writeTo(org.xmlpull.v1.XmlSerializer serializer)
          Writes the content to the given XML serializer.
 
Methods inherited from class com.google.api.client.http.AbstractHttpContent
computeLength, getCharset, getEncoding, getLength, getMediaType, getType, retrySupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractXmlHttpContent

protected AbstractXmlHttpContent(XmlNamespaceDictionary namespaceDictionary)
Parameters:
namespaceDictionary - XML namespace dictionary
Since:
1.5
Method Detail

writeTo

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

The recommendation for implementations is that they should not close the output stream. Callers should not assume whether or not the output stream has been closed. Implementations that do not close the output stream should flush it at the end of the method.

Throws:
IOException

setType

@Deprecated
public AbstractXmlHttpContent setType(String type)
Deprecated. (scheduled to be removed in 1.11) Use setMediaType(HttpMediaType) instead.

Sets the content type or null for none. Will override any pre-set media type parameter.

Defaults to Xml.MEDIA_TYPE, though subclasses may define a different default value.

Since:
1.5

setMediaType

public AbstractXmlHttpContent setMediaType(HttpMediaType mediaType)
Description copied from class: AbstractHttpContent
Sets the media type to use for the Content-Type header, or null if unspecified.

This will also overwrite any previously set parameter of the media type (for example "charset"), and therefore might change other properties as well.

Overrides:
setMediaType in class AbstractHttpContent

getNamespaceDictionary

public final XmlNamespaceDictionary getNamespaceDictionary()
Returns the XML namespace dictionary.

Since:
1.5

writeTo

protected abstract void writeTo(org.xmlpull.v1.XmlSerializer serializer)
                         throws IOException
Writes the content to the given XML serializer.

Throws:
IOException - I/O exception


Copyright © 2011-2012 Google. All Rights Reserved.