What am I doing wrong. I'm trying to post to my roller app but I get an
error. Looks like no workspace are found which is strange since the user has
a blog and when I look at the service-document there is a workspace. Help
needed!
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0,
Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at Post1.main(Post1.java:19)
My Java-app:
import com.sun.syndication.propono.atom.client.*;
import java.io.FileInputStream;
public class Post1
{
public static void main(String[] args) throws Exception {
String username = "admin";
String password = "admin";
String filepath = "Photo.jpg";
String slug = "Photo";
String uri ="http://localhost:8080/roller/roller-services/app";
// Connect to service, GET Service Doc.
ClientAtomService service =
AtomClientFactory.getAtomService(uri, username, password);
// Find workspace
ClientWorkspace workspace =
(ClientWorkspace)service.getWorkspaces().get(0); ///LINE 19
// Find first collection in workspace that will accept a JPG
ClientCollection collection = (ClientCollection)
workspace.findCollection(null, "image/jpg");
// Create entry, set title and content but don't POST it yet
ClientMediaEntry entry = collection.createMediaEntry(
slug, slug, "image/jpg", new FileInputStream(filepath));
// POST entry to collection on server
collection.addEntry(entry);
}
}
--
View this message in context:
http://www.nabble.com/Help-noob-with-rome-propono-%21%21-tf4422109s12275.html#a12613150
Sent from the Roller - User mailing list archive at Nabble.com.