Skip to Main Content

Application Development Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Vanity URLs for images or PDF

CThiryFeb 10 2016 — edited Feb 10 2016

Hello,

I'm working with Webcenter Sites 12.2.1 and I have a question about templating for medias with vanity URLs.

My users would like to have vanity URLs for some Medias like PDFs or Images or such blobs. I'm able to do so for text based attributes such as javascripts or css but for blob based attributes I'm a bit stuck. The point is that for doing vanity URLs for an asset I have to use a template. In the template if I have to display a text there is no problem. For a blob I can get the attribute but if I want to stream the result in as template without calling the blob server URL I don't get anything usable.

Here is the code of the template that I use:

<%@ page import="com.fatwire.system.*"%>

<%@ page import="com.fatwire.assetapi.data.*"%>

<%@ page import="com.fatwire.assetapi.query.*"%>

<%@ page import="java.util.*"%>

<%@ page import="com.openmarket.xcelerate.asset.*"%>

<%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld"%>

<%@ taglib prefix="ics" uri="futuretense_cs/ics.tld"%>

<%@ taglib prefix="fragment" uri="futuretense_cs/fragment.tld"%>

<%@ taglib prefix="render" uri="futuretense_cs/render.tld"%>

<%@ taglib prefix="asset" uri="futuretense_cs/asset.tld"%>

<cs:ftcs>

<%

Session ses = SessionFactory.getSession();

AssetDataManager mgr =(AssetDataManager) ses.getManager( AssetDataManager.class.getName() );

AssetId id = new AssetIdImpl( "Content_R",new Long(ics.GetVar("cid")));

List attrNames = new ArrayList();

attrNames.add( "imagefile" );

AssetData data = mgr.readAttributes( id, attrNames );

AttributeData attrDataSource = data.getAttributeData( "imagefile" );

BlobObject fileObj = (BlobObject)attrDataSource.getData();

byte [] d = new byte[fileObj.getBinaryStream().available()];

fileObj.getBinaryStream().read(d);

out.println(d);

%>

</cs:ftcs>

I've already tried a workaround : redirecting to the blob server but the problem is that then I can't use urls directly as for images <img src="/prettyUrl"> with a redirect doesn't work.

Did anyone try to do so ?

This post has been answered by User_RBKPW on Feb 10 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 9 2016
Added on Feb 10 2016
4 comments
1,237 views