Using SDL Tridion 2013 SP1, I am working with Storage Extension (Written with SDL Tridion 2011 and upgraded to make it compatible with SDL Tridion 2013 SP1). In this storage extension, I am trying to get the component presentation of a dynamic component being published.

Earlier in SDL Tridion 2011, this can be retrieved by using the com.tridion.Storage.ComponentPresentation.getContent() method which returns the Component Presentation as string. However, in SDL Tridion 2013 SP1, this method has been updated to return the component presentation as byte[] instead of string.

Is there some another method through which I can get string presentation of the CP or I am in trouble to change the code everywhere and explicitly convert the byte[] to string by standard java code - Also, will it be possible if I convert this byte[] to string, it will give me the Component Presentation published?

Thanks in advance

2 Answers 2


Indeed the com.tridion.storage.ComponentPresentation class was changed. The create, remove and update methods now receive the Component Presentation content as byte-array.

If you need the string contents, you can simple do:

    public void create(
         ComponentPresentation itemToCreate,
         ComponentPresentationTypeEnum componentPresentationType) throws StorageException
        String actualContent = new String(itemToCreate.getContent(),"UTF-8");

I remember facing the same issue. I went with converting the byte[] into a String the "java-way". As far as I remember the byte[] contains the published content, so yes, by converting it to a String it would give you the published content. Just remember the Encoding you want to use for such conversion, if you are publishing UTF-8, then use UTF-8, if you know what I mean...

And I am afraid you will have to update your code to use the new method...

  • Thanks Jaime for the answer; accepting Rai's answer because of its completeness and code sample :) Commented Feb 11, 2015 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.