After upgrading to Oracle WebCenter Sites (OWCS) 12c, developers were excited to try out the super cool out-of-the-box MVC (Model-View-Controller) pattern to implement their new Templating requirements. However, the Java API responsible for retrieving an asset’s information, including generation of blob links (as applicable), is producing URLs that are incapable of generating/fetching cached blob objects inherently.
Issue:
The following is a simple code snippet (extracted from Oracle’s documentation and edited to apply to this specific issue) that loads a few attributes of an asset, including ‘HeroImage’ whose value-type is a ‘Blob’.
Map assetData = new AssetReaderImpl(new AssetFacadeImpl(ics))
.forAsset( assetId )
.select( “name, description, HeroImage” )
.includeBlobLinks(true)
.read();
The above snippet generates a Blob URL that has the parameter ‘blobnocache’ value set to ‘true’. This keeps OWCS from generating/fetching the Blob from BlobCache, which adversely affects the performance of page rendering this Blob.
Solution:
Tweak the code as shown below, by explicitly adding the ‘blobnocache’ parameter value to ‘false’ and assigning it to the com.fatwire.assetapi.data.BlobLinkInfo class. This will force OWCS to generate blob-cache friendly URLs and the subsequent requests to fetch blobs from BlobCache.
def blobConfigMap = [:]
// The following line overrides the default blobnocache value
blobConfigMap.put(“blobnocache”,”false”)
BlobLinkInfo blobLink = newBlobLinkInfo();
blobLink.parameters(blobConfigMap)
Map assetData = new AssetReaderImpl(new AssetFacadeImpl(ics))
.forAsset( assetId )
.select( “name, description, HeroImage” )
.includeBlobLinks(true)
//Following line adds the custom link params (created above: blobLink) to the blob URL
.addBlobLinkInfo(blobLink)
.read();
If you need more assistance fixing Blob cache issues, or if you’d like help upgrading your Oracle WebCenter Sites environment from 11g to 12c before the December Premier Support deadline, we’re here to help! Contact Inspired ECM so our experienced consultants can get your environment running successfully today.