|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--javax.xml.transform.stream.StreamSource
|
+--com.sap.portal.httpconnectivity.transformationservice.xmlsource.HTTPStreamSource
Delegation class between URLFetcherService and transformation source.
Supplies methods for loading XML data through the HTTP connectivity framework.
There are two ways of instantiate this class:
1. Inserting properties directly: The user must supply the URL, HTTP method and server caching level in the constructor,
then set the portal request object before inserting this class to the transformation service.
Example:
// 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);
2. Initializing properties from PCD: this option is for URL and XML iViews that hold the connection properties in the PCD.
// 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);
IURLFetcherService,
IURLFetcherProperties| Field Summary | |
static com.sap.tc.logging.Category |
HTTP_STRM_SRC_CATEGORY
Constant value - Category of the log file. |
static com.sap.tc.logging.Location |
HTTP_STRM_SRC_LOCATION
Constant value - The location in the log file. |
| Fields inherited from class javax.xml.transform.stream.StreamSource |
FEATURE |
| Constructor Summary | |
HTTPStreamSource(com.sapportals.portal.prt.component.IPortalComponentRequest request)
Creates a new HTTPStreamSource object from the XML iView properties stored in portal data. |
|
HTTPStreamSource(com.sapportals.portal.prt.component.IPortalComponentRequest request,
com.sap.portal.httpconnectivity.urlfetcherservice.IURLFetcherProperties sourceProperties)
Creates a new HTTPStreamSource object using fetcher properties that were already initialized. |
|
HTTPStreamSource(com.sapportals.portal.prt.component.IPortalComponentRequest request,
java.lang.String URL)
Creates a new HTTPStreamSource object for a specific URL with no other HTTP properties definitions. |
|
HTTPStreamSource(com.sapportals.portal.prt.component.IPortalComponentRequest request,
java.lang.String URL,
com.sap.portal.httpconnectivity.urlfetcherservice.IConstants.Method method,
com.sap.portal.httpconnectivity.urlfetcherservice.IConstants.CachingLevel cacheLevel)
Creates a new HTTPStreamSource object for a specific URL and with specific HTTP method and caching level. |
|
| Method Summary | |
void |
addParameter(java.lang.String paramName,
java.lang.String paramValue)
Adds parameter to the http call. |
void |
closeConnection()
Closes the already opened HTTP connection to the remote server. |
com.sap.portal.httpconnectivity.urlfetcherservice.IConstants.CachingLevel |
getCachingLevel()
Gets the caching level of the source |
java.io.InputStream |
getInputStream()
Gets the input stream from the fecher service. |
java.lang.Exception |
getLastError()
Gets the last error that occured. |
com.sap.portal.httpconnectivity.urlfetcherservice.params.IURLParameters |
getParameters()
Gets the parameters of the http call. |
java.lang.String |
getPublicId()
|
com.sapportals.portal.prt.component.IPortalComponentRequest |
getRequest()
Gets the portal request object associated with the HTTP call. |
protected java.lang.Object |
getSourceFromCache()
Gets the source of the XML stream source from the cache. |
java.lang.String |
getSystemId()
|
protected void |
putSourceToCache()
Puts the data that was loaded in the stream source to the cache. |
void |
setCacheStatus(boolean enabled)
Sets the status of the cached source. |
void |
setCachingLevel(com.sap.portal.httpconnectivity.urlfetcherservice.IConstants.CachingLevel cacheLevel)
Sets the caching level of the source. |
void |
setParameters(com.sap.portal.httpconnectivity.urlfetcherservice.params.IURLParameters parameters)
Sets the URL parameters of the http call. |
void |
setPublicId(java.lang.String url)
|
void |
setSystemId(java.lang.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(com.sapportals.portal.prt.component.IPortalComponentRequest request,
com.sap.portal.httpconnectivity.urlfetcherservice.IURLFetcherProperties sourceProperties)
request - the current portal request objectsourceProperties - URL fetcher properties that will initialize the HTTP connection
* @since EP 6.0 SP7
public HTTPStreamSource(com.sapportals.portal.prt.component.IPortalComponentRequest request,
java.lang.String URL,
com.sap.portal.httpconnectivity.urlfetcherservice.IConstants.Method method,
com.sap.portal.httpconnectivity.urlfetcherservice.IConstants.CachingLevel cacheLevel)
request - the current portal request objectURL - the URL to the http sourcemethod - HTTP method to be usedcacheLevel - caching level
public HTTPStreamSource(com.sapportals.portal.prt.component.IPortalComponentRequest request,
java.lang.String URL)
request - the current portal request objectURL - the URL to the http sourcepublic HTTPStreamSource(com.sapportals.portal.prt.component.IPortalComponentRequest request)
request - the current portal request object| Method Detail |
public com.sapportals.portal.prt.component.IPortalComponentRequest getRequest()
public java.io.InputStream getInputStream()
getInputStream in class javax.xml.transform.stream.StreamSourcecloseConnection()public com.sap.portal.httpconnectivity.urlfetcherservice.params.IURLParameters getParameters()
public void setParameters(com.sap.portal.httpconnectivity.urlfetcherservice.params.IURLParameters parameters)
parameters - the URL parameters
public void addParameter(java.lang.String paramName,
java.lang.String paramValue)
throws TransformationServiceException
paramName - the parameter nameparamValue - the value of the parameterTransformationServiceException - when cannot add parameters to the fetcher informationpublic java.lang.String getPublicId()
getPublicId in class javax.xml.transform.stream.StreamSourcepublic void setPublicId(java.lang.String url)
setPublicId in class javax.xml.transform.stream.StreamSourcepublic java.lang.String getSystemId()
getSystemId in class javax.xml.transform.stream.StreamSourcepublic void setSystemId(java.lang.String url)
setSystemId in class javax.xml.transform.stream.StreamSource
public void closeConnection()
throws java.io.IOException
java.io.IOException - when cannot close the HTTP connectionpublic java.lang.Exception getLastError()
protected java.lang.Object getSourceFromCache()
public void setCacheStatus(boolean enabled)
ICachedSourcesetCacheStatus in interface ICachedSourcecom.sap.portal.httpconnectivity.transformationservice.xmlsource.ICachedSourceenabled - defines whether to enable cache.
protected void putSourceToCache()
throws java.io.IOException
java.io.IOException - when the data stream cannot be accessedpublic com.sap.portal.httpconnectivity.urlfetcherservice.IConstants.CachingLevel getCachingLevel()
ICachedSourcegetCachingLevel in interface ICachedSourcecom.sap.portal.httpconnectivity.transformationservice.xmlsource.ICachedSourcepublic void setCachingLevel(com.sap.portal.httpconnectivity.urlfetcherservice.IConstants.CachingLevel cacheLevel)
ICachedSourcesetCachingLevel in interface ICachedSourcecom.sap.portal.httpconnectivity.transformationservice.xmlsource.ICachedSourcecacheLevel - the caching level of the source
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||