Derivatives of HttpService
Only resource-loader standard service is implemented as an
HttpService as it relates to the standard HTTP GET operation. You can
also use RestService without losing any capability.
Resource loader (resource-loader)
The following are the specialized interfaces and classes available for resource-loader service:
com.hcl.unica.system.integration.service.resourceloader.DefaultWebResourceLoaderServiceThecom.example.service.rest.ExampleResourceLoaderServiceclass inasset-integration-starterproject is a quick starter implementation for theresource-loaderservice and extends from the following class:com.hcl.unica.system.integration.service.resourceloader .DefaultWebResourceLoaderServiceDefaultWebResourceLoaderServiceclass is the default implementation ofresource-loaderservice provided by the Content Integration SDK. If the plugin does not implement its ownresource-loaderservice, Content Integration Framework falls back on this default implementation. Default implementation ofresource-loaderprovided by Content Integration SDK simply follows the given resource URL and retrieves the web resource from target system. It encapsulates the standard HTTP GET operation.If the plugin needs to have its own
resource-loaderimplementation which slightly modifies the standard HTTP GET, we recommend extending it from theDefaultWebResourceLoaderServiceclass. It is not necessary to extendresource-loaderimplementation from theDefaultWebResourceLoaderServiceif the plugin must use a completely different approach for loading contents, such as reading from file system, database, FTP server etc. In such a case, it must extend from eitherHttpWebResourceLoaderServicefor HTTP-based approach orWebResourceLoaderServicefor functional approach.com.hcl.unica.system.integration.service.resourceloader.HttpWebResourceLoaderServiceThe
DefaultWebResourceLoaderServiceclass discussed earlier extends from theHttpWebResourceLoaderServiceabstract class. This class defines the input type and the type of HTTP response received from target URL forresource-loaderservice ascom.hcl.unica.system.model.request.resourceloader.ResourceRequestandbyte[]respectively.ResourceRequestclass encapsulates the resource URL and system identifier. Similarly,resource-loaderworks with a byte array when the content from remote HTTP URL is successfully read.If the plugin does not extend its
resource-loaderimplementation from theDefaultWebResourceLoaderServiceclass, it must at least extend fromcom.hcl.unica.system.integration.service.resourceloader.HttpWebResourceLoaderServiceclass to be recognized as aresource-loaderservice by the Content Integration Framework (Functional counterpart, discussed later, is also a valid choice to extend from for theresource-loaderservices implemented using the Functional approach).com.hcl.unica.system.integration.service.resourceloader.AbstractWebResourceLoaderServiceTheHttpWebResourceLoaderServiceclass discussed in previous point extends fromAbstractWebResourceLoaderServiceabstract class. This class defines the following service gateway interface for theresource-loaderservice:com.hcl.unica.system.integration.service.gateway .ResourceLoaderServiceGatewayTo know the role of service gateways in service invocation, see Service invocation.
ResourceLoaderServiceGatewayinterface definesResourceRequestandHttpResponse<?>as input and output types for theresource-loaderservice.HttpResponseis an interface, implemented by theWebResourceclass. It encapsulates the HTTP response headers, body, or payload, and cookies received from the remote URL. Even if the customizedresource-loaderservice does not fetch the content over web, it must return the object of theWebResource(or any other implementation ofHttpResponse) populated with the appropriate details. Failing to populate theWebResourceappropriately may lead to content loading issues for client applications. TheWebResourceprovides a builder API to create an object with necessary details. The most important thing is to populate theContent-Typeheader so that client application can deal with the payload accordingly. Similarly,Content-Dispositionheader must also be populated appropriately containing the filename associated with the content.