[Hippo-cms7-user] Best practice to retrieve binary from hippo:resource field

Jeroen Reijn j.reijn at onehippo.com
Wed Jun 23 17:02:45 CEST 2010


Hi Edwin,

the HST will retrieve the binary based on the context the website is in. So
if you are on the preview the resulting file should come from the preview
document and if you're on the live site you should get the live version of
the binary.

The binary servet will most of the time not expose the path in the url. You
might be able to achieve this though by disabling the default resource
containers in the hst configuration.

Jeroen

On Wed, Jun 23, 2010 at 4:24 PM, Edwin B. <ettepet at gmail.com> wrote:

>
> Hi,
>
> I'm using a wrapper with a hippo:resource-field to store my binaries. I
> don't use the assets folder.
> When I retrieve a PDF-file from this hippo:resource-field the hyperlink on
> the website to this PDF-file is something like:
> http://localhost/binaries/content/documents/myProject/myFolder/...
>
> where I expect a URL starting like:
> http://localhost/binaries/live/myProject/hst:content/myFolder/...
> or
> http://localhost/binaries/preview/myProject/hst:content/myFolder/...
>
>
> So, now my question is:
> What is the best practice to retrieve a binary from a hippo:resource field?
>
> In the (wrapper)bean I have got this method to retrieve the hippo:resource
>
>    public HippoResource getBestand() {
>        if (bestand == null) {
>                bestand = getBean("myProject:bestand");
>        }
>        return bestand;
>    }
>
> In the JSP-file I use the hst:link-tag to get the URL to this PDF-file:
>        <hst:link hippobean="${document.bestand}" var="download_url" />
>        < a href="${download_url}">get it!
>
>
> Do I have to use another tag instead of the hst:link tag?
>
>
> Best regards,
> Edwin
>
> --
> View this message in context:
> http://hippo.2275632.n2.nabble.com/Best-practice-to-retrieve-binary-from-hippo-resource-field-tp5213483p5213483.html
> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onehippo.org/pipermail/hippo-cms7-user/attachments/20100623/068fdadc/attachment.htm>


More information about the Hippo-cms7-user mailing list