org.apache.wink.common.model.atom
Class AtomContent

java.lang.Object
  extended by org.apache.wink.common.model.atom.AtomCommonAttributes
      extended by org.apache.wink.common.model.atom.AtomContent

public class AtomContent
extends AtomCommonAttributes

The "atom:content" element Per RFC4287

 The "atom:content" element either contains or links to the content of the entry. The content of atom:content is Language-Sensitive.
 
 atomInlineTextContent =
    element atom:content {
       atomCommonAttributes,
       attribute type { "text" | "html" }?,
       (text)*
    }
 
 atomInlineXHTMLContent =
    element atom:content {
       atomCommonAttributes,
       attribute type { "xhtml" },
       xhtmlDiv
    }
 
 atomInlineOtherContent =
    element atom:content {
       atomCommonAttributes,
       attribute type { atomMediaType }?,
       (text|anyElement)*
    }
 
 atomOutOfLineContent =
    element atom:content {
       atomCommonAttributes,
       attribute type { atomMediaType }?,
       attribute src { atomUri },
       empty
    }
 
 atomContent = atomInlineTextContent
  | atomInlineXHTMLContent
  | atomInlineOtherContent
  | atomOutOfLineContent
  
 o The "type" Attribute
 
    On the atom:content element, the value of the "type" attribute MAY be
    one of "text", "html", or "xhtml".  Failing that, it MUST conform to
    the syntax of a MIME media type, but MUST NOT be a composite type
    (see Section 4.2.6 of [MIMEREG]).  If neither the type attribute nor
    the src attribute is provided, Atom Processors MUST behave as though
    the type attribute were present with a value of "text".
 
 o The "src" Attribute
 
    atom:content MAY have a "src" attribute, whose value MUST be an IRI
    reference [RFC3987].  If the "src" attribute is present, atom:content
    MUST be empty.  Atom Processors MAY use the IRI to retrieve the
    content and MAY choose to ignore remote content or to present it in a
    different manner than local content.
 
    If the "src" attribute is present, the "type" attribute SHOULD be
    provided and MUST be a MIME media type [MIMEREG], rather than "text",
    "html", or "xhtml".  The value is advisory; that is to say, when the
    corresponding URI (mapped from an IRI, if necessary) is dereferenced,
    if the server providing that content also provides a media type, the
    server-provided media type is authoritative.
 
 o Processing Model
 
    Atom Documents MUST conform to the following rules.  Atom Processors
    MUST interpret atom:content according to the first applicable rule.
 
    1.  If the value of "type" is "text", the content of atom:content
        MUST NOT contain child elements.  Such text is intended to be
        presented to humans in a readable fashion.  Thus, Atom Processors
        MAY collapse white space (including line breaks), and display the
        text using typographic techniques such as justification and
        proportional fonts.
 
    2.  If the value of "type" is "html", the content of atom:content
        MUST NOT contain child elements and SHOULD be suitable for
        handling as HTML [HTML].  The HTML markup MUST be escaped; for
        example, "<br>" as "<br>".  The HTML markup SHOULD be such
        that it could validly appear directly within an HTML <DIV>
        element.  Atom Processors that display the content MAY use the
        markup to aid in displaying it.
 
    3.  If the value of "type" is "xhtml", the content of atom:content
        MUST be a single XHTML div element [XHTML] and SHOULD be suitable
        for handling as XHTML.  The XHTML div element itself MUST NOT be
        considered part of the content.  Atom Processors that display the
        content MAY use the markup to aid in displaying it.  The escaped
        versions of characters such as "&" and ">" represent those
        characters, not markup.
 
    4.  If the value of "type" is an XML media type [RFC3023] or ends
        with "+xml" or "/xml" (case insensitive), the content of
        atom:content MAY include child elements and SHOULD be suitable
        for handling as the indicated media type.  If the "src" attribute
        is not provided, this would normally mean that the "atom:content"
        element would contain a single child element that would serve as
        the root element of the XML document of the indicated type.
 
    5.  If the value of "type" begins with "text/" (case insensitive),
        the content of atom:content MUST NOT contain child elements.
 
    6.  For all other values of "type", the content of atom:content MUST
        be a valid Base64 encoding, as described in [RFC3548], section 3.
        When decoded, it SHOULD be suitable for handling as the indicated
        media type.  In this case, the characters in the Base64 encoding
        MAY be preceded and followed in the atom:content element by white
        space, and lines are separated by a single newline (U+000A)
        character.
 
 o Examples
 
    XHTML inline:
 
    ...
    <content type="xhtml">
       <div xmlns="http://www.w3.org/1999/xhtml">
          This is <b>XHTML</b> content.
       </div>
    </content>
    ...
    <content type="xhtml">
       <xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml">
          This is <xhtml:b>XHTML</xhtml:b> content.
       </xhtml:div>
    </content>
    ...
 
    The following example assumes that the XHTML namespace has been bound
    to the "xh" prefix earlier in the document:
 
    ...
    <content type="xhtml">
       <xh:div>
          This is <xh:b>XHTML</xh:b> content.
       </xh:div>
    </content>
    ...
 
 


Field Summary
protected  String src
           
protected  String type
           
 
Fields inherited from class org.apache.wink.common.model.atom.AtomCommonAttributes
base, lang
 
Constructor Summary
AtomContent()
           
AtomContent(SyndContent value)
           
 
Method Summary
 void checkValidity()
           
 String getSrc()
          Gets the value of src.
 String getType()
          Gets the value of type.
 String getValue()
           Gets the content of the "atom:content" element as a String.
<T> T
getValue(Class<T> cls)
           Gets the content of the "atom:content" element serialized to provided class.
<T> T
getValue(Class<T> cls, Type genericType, javax.ws.rs.ext.Providers providers, Annotation[] annotations, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, javax.ws.rs.core.MediaType mediaType)
           Gets the content of the "atom:content" element serialized to provided class according to provided parameters.
 void setProviders(javax.ws.rs.ext.Providers _providers)
          Sets the Providers on a local field so that the registry of custom and system providers is available when a client application retrieves the value, expecting it to be seamlessly unmarshalled or converted to the expected type declared in getValue(Class).
 void setSrc(String value)
          Sets the value of src.
 void setType(String value)
          Sets the value of type.
 void setValue(Object value)
          Sets the content of the "atom:content" element as a String.
 SyndContent toSynd(SyndContent value)
           
 
Methods inherited from class org.apache.wink.common.model.atom.AtomCommonAttributes
getBase, getLang, getOtherAttributes, setBase, setLang, toSynd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected String type

src

protected String src
Constructor Detail

AtomContent

public AtomContent()

AtomContent

public AtomContent(SyndContent value)
Method Detail

toSynd

public SyndContent toSynd(SyndContent value)

setProviders

public void setProviders(javax.ws.rs.ext.Providers _providers)
Sets the Providers on a local field so that the registry of custom and system providers is available when a client application retrieves the value, expecting it to be seamlessly unmarshalled or converted to the expected type declared in getValue(Class). Client applications should NOT call this method.


getType

public String getType()
Gets the value of type.


setType

public void setType(String value)
Sets the value of type.


getSrc

public String getSrc()
Gets the value of src.


setSrc

public void setSrc(String value)
Sets the value of src.


setValue

public void setValue(Object value)
Sets the content of the "atom:content" element as a String. The "type" attribute should be set prior to setting the contents.

Atom Documents MUST conform to the following rules. Atom Processors MUST interpret atom:content according to the first applicable rule.

  1. If the value of "type" is "text", the content of atom:content MUST NOT contain child elements. Such text is intended to be presented to humans in a readable fashion. Thus, Atom Processors MAY collapse white space (including line breaks), and display the text using typographic techniques such as justification and proportional fonts.
  2. If the value of "type" is "html", the content of atom:content MUST NOT contain child elements and SHOULD be suitable for handling as HTML [HTML]. The HTML markup MUST be escaped; for example, "
    " as "<br>". The HTML markup SHOULD be such that it could validly appear directly within an HTML
    element. Atom Processors that display the content MAY use the markup to aid in displaying it.
  3. If the value of "type" is "xhtml", the content of atom:content MUST be a single XHTML div element [XHTML] and SHOULD be suitable for handling as XHTML. The XHTML div element itself MUST NOT be considered part of the content. Atom Processors that display the content MAY use the markup to aid in displaying it. The escaped versions of characters such as "&" and ">" represent those characters, not markup.
  4. If the value of "type" is an XML media type [RFC3023] or ends with "+xml" or "/xml" (case insensitive), the content of atom:content MAY include child elements and SHOULD be suitable for handling as the indicated media type. If the "src" attribute is not provided, this would normally mean that the "atom:content" element would contain a single child element that would serve as the root element of the XML document of the indicated type.
  5. If the value of "type" begins with "text/" (case insensitive), the content of atom:content MUST NOT contain child elements.
  6. For all other values of "type", the content of atom:content MUST be a valid Base64 encoding, as described in [RFC3548], section 3. When decoded, it SHOULD be suitable for handling as the indicated media type. In this case, the characters in the Base64 encoding MAY be preceded and followed in the atom:content element by white space, and lines are separated by a single newline (U+000A) character.


getValue

public String getValue()

Gets the content of the "atom:content" element as a String. The "type" attribute should be used to determine how to treat the content.

Pay attention that de-serialization occurs each time the method is called, so multiple calls to this method may effect the application performance.


getValue

public <T> T getValue(Class<T> cls)

Gets the content of the "atom:content" element serialized to provided class. The "type" attribute should be used to determine how to treat the content.

Pay attention that de-serialization occurs each time the method is called, so multiple calls to this method may effect the application performance.


getValue

public <T> T getValue(Class<T> cls,
                      Type genericType,
                      javax.ws.rs.ext.Providers providers,
                      Annotation[] annotations,
                      javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders,
                      javax.ws.rs.core.MediaType mediaType)
           throws IOException

Gets the content of the "atom:content" element serialized to provided class according to provided parameters.

Pay attention that de-serialization occurs each time the method is called, so multiple calls to this method may effect the application performance.

Throws:
IOException

checkValidity

public void checkValidity()


Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.