roller-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave <>
Subject Re: Is it possible to post to resources/subdir directory?
Date Fri, 19 Oct 2007 01:04:13 GMT
On 10/17/07, Tatsuya Noyori <> wrote:
> I am using roller4.0RC8 and rome propono0.6.
> I can post GIF files to resouces directory with below code, but I
> can't post to resources/subdir directory.
> The subdir on Roller can be made by anyone using web browser and the
> subdir is very useful to preserve categorized files. So I would like
> to ask the following question.
> Q1. Is it possible to post to resources/subdir directory?
> I would be grateful if someone answer me.

Yes. But 1) the sub-directory must exist and 2) you must post to the
collection that represents the sub-directory.

>         ClientCollection collection = (ClientCollection)
>             workspace.findCollection(null, "entry");

OK, now you have found a collection that can accept an entry.

>         if (collection != null) {
>             ClientMediaEntry entry = collection.createMediaEntry(
>                 title, slug, "image/gif", new FileInputStream(filepath));

Wrong. You should not post an "image/gif" to a collection that accepts
only entries.

You should call workspace.findCollection(null, "image/gif") to find a
collection that will accept GIF images. The resource directory and
each of it's sub-directories is represented as a collection, so you'll
have to iterate through the collections to find the one you want.

- Dave

View raw message