|
SAP NetWeaver 7.30 SP01 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.xml.transform.stream.StreamSource
com.sap.portal.httpconnectivity.transformationservice.xmlsource.HTTPStreamSource
public class HTTPStreamSource
A delegation class between
com.sap.portal.httpconnectivity.urlfetcherserviceURLFetcherService
and the transformation source.
Provides methods for loading XML data through the HTTP connectivity framework.
There are two ways to instantiate this class:
// Getting source according to the XML iView properties related to current request.
HTTPStreamSource source = new HTTPStreamSource(request);
// Setting result stream
StreamResult strm = new StreamResult(response.getWriter());
// Transforming using the transformation service.
tService.transform(source, trns, paramsArray, context, null, strm);
// Getting source file - the SDN weblogs
HTTPStreamSource source = new HTTPStreamSource(request,
"http://weblogs.sdn.sap.com/pub/q/weblogs_rss?x-ver=1.0",
IConstants.Method.GET,
IConstants.CachingLevel.SHARED);
// Setting result stream
StreamResult strm = new StreamResult(response.getWriter());
// Transforming using the transformation service.
tService.transform(source, trns, paramsArray, context, null, strm);
getInputStream() is called. When using this class with the
transformation service, getInputStream() is called immediately
before the transformation is activated.
SHARED.
IURLFetcherService,
IURLFetcherProperties| Field Summary | |
|---|---|
static com.sap.tc.logging.Category |
HTTP_STRM_SRC_CATEGORY
The category of the log file. |
static com.sap.tc.logging.Location |
HTTP_STRM_SRC_LOCATION
The location in the log file. |
| Fields inherited from class javax.xml.transform.stream.StreamSource |
|---|
FEATURE |
| Constructor Summary | |
|---|---|
HTTPStreamSource(IPortalComponentRequest request)
A constructor that creates a new HTTPStreamSource
object from the XML iView properties stored in the portal. |
|
HTTPStreamSource(IPortalComponentRequest request,
IURLFetcherProperties sourceProperties)
A constructor that creates a new HTTPStreamSource object using
fetcher properties that were already initialized. |
|
HTTPStreamSource(IPortalComponentRequest request,
String URL)
A constructor that creates a new HTTPStreamSource
object for a specified URL with no other HTTP properties definitions. |
|
HTTPStreamSource(IPortalComponentRequest request,
String URL,
IConstants.Method method,
IConstants.CachingLevel cacheLevel)
A constructor that creates a new HTTPStreamSource object for a
specified URL and using a specified HTTP method and caching level. |
|
| Method Summary | |
|---|---|
void |
addParameter(String paramName,
String paramValue)
Adds a parameter to the HTTP call. |
void |
closeConnection()
Closes the open HTTP connection to the remote server. |
IConstants.CachingLevel |
getCachingLevel()
Gets the caching level of the source XML. |
InputStream |
getInputStream()
Gets the input stream from the fecher service. |
Exception |
getLastError()
Gets the last error thrown. |
IURLParameters |
getParameters()
Gets the parameters of the HTTP call. |
String |
getPublicId()
|
IPortalComponentRequest |
getRequest()
Gets the portal request object associated with the HTTP call. |
protected Object |
getSourceFromCache()
Gets the source of the XML input stream from the cache. |
String |
getSystemId()
|
protected void |
putSourceToCache()
Places the data loaded from the input stream into the cache. |
void |
setCacheStatus(boolean enabled)
Enables ( true) or disables (false) the cache
of the source XML. |
void |
setCachingLevel(IConstants.CachingLevel cacheLevel)
Sets the caching level of the source XML. |
void |
setParameters(IURLParameters parameters)
Sets the URL parameters of the HTTP call. |
void |
setPublicId(String url)
|
void |
setSystemId(String url)
|
| Methods inherited from class javax.xml.transform.stream.StreamSource |
|---|
getReader, setInputStream, setReader, setSystemId |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final com.sap.tc.logging.Location HTTP_STRM_SRC_LOCATION
public static final com.sap.tc.logging.Category HTTP_STRM_SRC_CATEGORY
| Constructor Detail |
|---|
public HTTPStreamSource(IPortalComponentRequest request,
IURLFetcherProperties sourceProperties)
HTTPStreamSource object using
fetcher properties that were already initialized.
request - the current portal request objectsourceProperties - URL fetcher properties that initialize the
HTTP connection
* @since EP 6.0 SP7
public HTTPStreamSource(IPortalComponentRequest request,
String URL,
IConstants.Method method,
IConstants.CachingLevel cacheLevel)
HTTPStreamSource object for a
specified URL and using a specified HTTP method and caching level.
request - the current portal request objectURL - the URL for the HTTP sourcemethod - HTTP methodcacheLevel - caching level
public HTTPStreamSource(IPortalComponentRequest request,
String URL)
HTTPStreamSource
object for a specified URL with no other HTTP properties definitions.
request - the current portal request objectURL - the URL for the HTTP sourcepublic HTTPStreamSource(IPortalComponentRequest request)
HTTPStreamSource
object from the XML iView properties stored in the portal. The default
cache value is SHARED.
request - the current portal request object| Method Detail |
|---|
public IPortalComponentRequest getRequest()
public InputStream getInputStream()
IHTTPRequest to manage the InputStream and the connection.
ITransformerService
before the transformation.
#closeConnection() method when you are finished using
the input stream.
#getLastError() method to retrieve the last error thrown.
getInputStream in class StreamSourcecloseConnection()public IURLParameters getParameters()
IURLParameters object, make sure to use
the #setParameters() method to set the modified parameters.
public void setParameters(IURLParameters parameters)
parameters - the URL parameters
public void addParameter(String paramName,
String paramValue)
throws TransformationServiceException
paramName - the parameter nameparamValue - the value of the parameter
TransformationServiceException - if the source data is corrupt,
if it cannot write to the result,
if one of the transformers doesn't
exist or if an error occurs
during the transformationpublic String getPublicId()
getPublicId in class StreamSourcepublic void setPublicId(String url)
setPublicId in class StreamSourcepublic String getSystemId()
getSystemId in interface SourcegetSystemId in class StreamSourcepublic void setSystemId(String url)
setSystemId in interface SourcesetSystemId in class StreamSource
public void closeConnection()
throws IOException
IOException - if it cannot close the HTTP connectionpublic Exception getLastError()
protected Object getSourceFromCache()
public void setCacheStatus(boolean enabled)
ICachedSourcetrue) or disables (false) the cache
of the source XML.
setCacheStatus in interface ICachedSourceenabled - enables/disables the cache
protected void putSourceToCache()
throws IOException
closeConnection() method is called.
IOException - if the operation failspublic IConstants.CachingLevel getCachingLevel()
ICachedSource
getCachingLevel in interface ICachedSourcepublic void setCachingLevel(IConstants.CachingLevel cacheLevel)
ICachedSource
setCachingLevel in interface ICachedSourcecacheLevel - the caching level of the source| Access Rights |
|---|
| SC | DC | Public Part | ACH |
|---|---|---|---|
[sap.com] EP-ADMIN
|
[sap.com] tc/ep/admin/api/extd
|
api
|
EP-PIN
|
|
SAP NetWeaver 7.30 SP01 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||