Hello

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.

import java.util.List;
import com.sun.syndication.propono.atom.client.AtomClientFactory;
import com.sun.syndication.propono.atom.client.ClientAtomService;
import com.sun.syndication.propono.atom.client.ClientCollection;
import com.sun.syndication.propono.atom.client.ClientMediaEntry;
import com.sun.syndication.propono.atom.client.ClientWorkspace;
import java.io.FileInputStream;

public class AtomMediaEntryPoster {

    public static void main(String[] args) throws Exception {
        String username = "User1";
        String password = "User1Password";
        String title    = "Test";
        String slug     = "Uploaded";
        String filepath = "local.gif";
        String uri      = "http://localhost:8080/roller/roller-services/app";;

        ClientAtomService service =
            AtomClientFactory.getAtomService(uri, username, password);
        ClientWorkspace workspace = null;
        List workspaces = service.getWorkspaces();
        if (workspaces.size() > 0) {
            workspace = (ClientWorkspace)workspaces.get(0);
        } else {
            System.out.println("No workspaces found");
            System.exit(-1);
        }
        ClientCollection collection = (ClientCollection)
            workspace.findCollection(null, "entry");

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

            collection.addEntry(entry);
        } else {
            System.out.println("No collection found that accepts entries");
            System.exit(-1);
        }
    }
}

Best regards,

-- 
Tatsuya Noyori (^o^)/

Reply via email to