com.sapportals.wcm.repository

Class Content

java.lang.Object
  extended bycom.sapportals.wcm.repository.Content
All Implemented Interfaces:
IContent, IEntityMetadata, IMutableEntityMetadata
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


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.