com.sapportals.wcm.repository

Class Content

java.lang.Object
  extended by com.sapportals.wcm.repository.Content
All Implemented Interfaces:
IEntityMetadata, IMutableEntityMetadata, IContent
Direct Known Subclasses:
VaryingContent

public class Content
extends Object
implements IContent, IMutableEntityMetadata

Access to the content data of a resource.

Copyright (c) SAP AG 2001-2002


Constructor Summary
Content(InputStream inputStream, String mediaType, long contentLength)
          Constructs Content object, for use when encoding is not known separately but may be present in media type string.
Content(InputStream inputStream, String mediaType, long contentLength, String encoding)
          Constructs Content object, for use when media subtype and encoding are available as individual values.
Content(InputStream inputStream, String mediaType, long contentLength, String encoding, String language)
          Constructs Content object, for use when media subtype and encoding are available as individual values.
 
Method Summary
 void close()
          Stop using this content object.
 long getContentLength()
          Returns the length of the resource content
 String getContentType()
          Returns the content type of the resource data
 String getEncoding()
          Returns the name of the character encoding of textual content
 String getEntityTag()
          Returns the the entity-tag for the content (see RFC2616, section 3.11) and RFC2616, section 14.19).
 Date getExpiryDate()
           
 InputStream getInputStream()
          Returns the input stream of the resource content.
 String getLanguage()
           
 Date getLastModified()
           
 void setEntityTag(String entityTag)
           
 void setLastModified(Date lastModified)
           
 boolean wasUpdated()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Content

public Content(InputStream inputStream,
               String mediaType,
               long contentLength,
               String encoding)
Constructs Content object, for use when media subtype and encoding are available as individual values.

Parameters:
inputStream - input stream
mediaType - media type of content (trailing parameters are ignored)
contentLength - length of content (use -1 when unknown)
encoding - character encoding (use null when unknown)

Content

public Content(InputStream inputStream,
               String mediaType,
               long contentLength,
               String encoding,
               String language)
Constructs Content object, for use when media subtype and encoding are available as individual values.

Parameters:
inputStream - input stream
mediaType - media type of content (trailing parameters are ignored)
contentLength - length of content (use -1 when unknown)
encoding - character encoding (use null when unknown)
language - content language (use null when unknown)

Content

public Content(InputStream inputStream,
               String mediaType,
               long contentLength)
Constructs Content object, for use when encoding is not known separately but may be present in media type string.

Parameters:
inputStream - input stream
mediaType - media type of content (trailing parameters except encoding information is ignored)
contentLength - length of content (use -1 when unknown)
Method Detail

getInputStream

public InputStream getInputStream()
                           throws ContentException
Description copied from interface: IContent
Returns the input stream of the resource content.

Specified by:
getInputStream in interface IContent
Returns:
The resource content as byte stream.
Throws:
ContentException

getContentLength

public long getContentLength()
                      throws ContentException
Description copied from interface: IContent
Returns the length of the resource content

Specified by:
getContentLength in interface IContent
Returns:
the length in bytes (when unknown: -1)
Throws:
ContentException

getContentType

public String getContentType()
                      throws ContentException
Description copied from interface: IContent
Returns the content type of the resource data

Specified by:
getContentType in interface IContent
Returns:
The media subtype
Throws:
ContentException

getEncoding

public String getEncoding()
                   throws ContentException
Description copied from interface: IContent
Returns the name of the character encoding of textual content

Specified by:
getEncoding in interface IContent
Returns:
The name of the encoding (when unknown: null )
Throws:
ContentException - Exception raised in failure situation

getEntityTag

public String getEntityTag()
                    throws ResourceException
Description copied from interface: IEntityMetadata
Returns the the entity-tag for the content (see RFC2616, section 3.11) and RFC2616, section 14.19). Note that the entity tag may be a weak entity tag (indicated by a leading "W/"). Only strong entity tags can be used to assert octet-by-octet entity body identity, though.

The Format MUST be either:

Note that the double quotes are part of the entity tag.

Specified by:
getEntityTag in interface IEntityMetadata
Returns:
entity tag or null when not known
Throws:
ResourceException

setEntityTag

public void setEntityTag(String entityTag)
                  throws ResourceException
Specified by:
setEntityTag in interface IMutableEntityMetadata
Parameters:
entityTag - entity-tag (see RFC2616 , section 14.19).
Throws:
ResourceException - Exception raised in failure situation

getExpiryDate

public Date getExpiryDate()
                   throws ResourceException
Specified by:
getExpiryDate in interface IEntityMetadata
Returns:
the expiry date for the content (see RFC2616, section 14.21) or null when not specified
Throws:
ResourceException

getLanguage

public String getLanguage()
                   throws ResourceException
Specified by:
getLanguage in interface IEntityMetadata
Returns:
the content language (see RFC2616, section 14.12) or null when not known
Throws:
ResourceException

getLastModified

public Date getLastModified()
                     throws ResourceException
Specified by:
getLastModified in interface IEntityMetadata
Returns:
the last modification date (see RFC2616, section 14.29) or null when not known
Throws:
ResourceException

setLastModified

public void setLastModified(Date lastModified)
                     throws ResourceException
Specified by:
setLastModified in interface IMutableEntityMetadata
Parameters:
lastModified - last modified timestamp (see RFC2616 , section 14.29)
Throws:
ResourceException - Exception raised in failure situation

wasUpdated

public boolean wasUpdated()
Specified by:
wasUpdated in interface IMutableEntityMetadata
Returns:
whether the meta data was actually updated during the storage operation (create resource / update content).

close

public void close()
Description copied from interface: IContent
Stop using this content object.

Specified by:
close in interface IContent
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2014 SAP AG Complete Copyright Notice