com.sapportals.wcm.util.urlcontentaccess

Class URLContent

java.lang.Object
  extended by com.sapportals.wcm.util.urlcontentaccess.URLContent
All Implemented Interfaces:
IContent, IURLContent

public class URLContent
extends Object
implements IURLContent

Used to hold the data and header information for one component returned by or to be sent to the content server.


Constructor Summary
URLContent(URL urlObject, HeaderFields header, InputStream in, boolean cached)
          Constructs a new content object
 
Method Summary
 void close()
          Stop using this content object.
 long getContentLength()
          Get the size of the content data.
 String getContentType()
          Get the content type from the header fields collection.
 String getEncoding()
          Returns the name of the character encoding of textual content
protected  long getFetchTime()
           
 String getFilename()
          Returns the filename
 HeaderFields getHeader()
          Returns a collection of the header fields for the content.
 InputStream getInputStream()
          Returns the input stream to read the content.
 String getURL()
          Returns the URL
 boolean isFile()
           
 boolean isHttp()
           
 void setHeader(HeaderFields header)
          Set header fields.
 void writeTo(OutputStream out)
          Writes the content to the specified output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLContent

public URLContent(URL urlObject,
                  HeaderFields header,
                  InputStream in,
                  boolean cached)
           throws IOException
Constructs a new content object

Parameters:
urlObject - Holds the URL that points to the content source
header - HTTP response or multi-part mime headers
in - An InputStream to read the content from
cached - TBD: Description of the incoming method parameter
Throws:
IOException
Method Detail

getInputStream

public InputStream getInputStream()
Returns the input stream to read the content.

Specified by:
getInputStream in interface IContent
Specified by:
getInputStream in interface IURLContent
Returns:
The input stream reference

writeTo

public void writeTo(OutputStream out)
             throws URLContentAccessException
Writes the content to the specified output.

Specified by:
writeTo in interface IURLContent
Parameters:
out - An output stream reference
Throws:
URLContentAccessException - Exception raised in failure situation

getHeader

public HeaderFields getHeader()
Description copied from interface: IURLContent
Returns a collection of the header fields for the content.

Specified by:
getHeader in interface IURLContent
Returns:
The header collection.

setHeader

public void setHeader(HeaderFields header)
Description copied from interface: IURLContent
Set header fields.

Specified by:
setHeader in interface IURLContent
Parameters:
header - The header fields.

getContentType

public String getContentType()
Description copied from interface: IURLContent
Get the content type from the header fields collection.

Specified by:
getContentType in interface IContent
Specified by:
getContentType in interface IURLContent
Returns:
The mime type

getContentLength

public long getContentLength()
Description copied from interface: IURLContent
Get the size of the content data.

Specified by:
getContentLength in interface IContent
Specified by:
getContentLength in interface IURLContent
Returns:
Size of the content in bytes.

getURL

public String getURL()
Description copied from interface: IURLContent
Returns the URL

Specified by:
getURL in interface IURLContent
Returns:
uRL

getFilename

public String getFilename()
Description copied from interface: IURLContent
Returns the filename

Specified by:
getFilename in interface IURLContent
Returns:
filename

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

isFile

public boolean isFile()

isHttp

public boolean isHttp()

close

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

Specified by:
close in interface IContent

getFetchTime

protected long getFetchTime()
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