I am trying to PUT ( and POST ) to a ServerResource and have it convert my JSON payload to the corresponding Java POJO, but all I get is 415 "Unsupported Media Type" errors.
My POJO implements Serializable, @Get("json") seems to work as it is supposed
to.
@Put("json") gives me the 415 Unsupported Media Type. As well as does
@Post("json")
I have searched the net, Google, forums, for 4 hours now, and nothing.
I have the three Jackson dependencies, ext, core and mapper in the right places.
Attached is what I can't get to work.
package app.resource;
import app.data.Person;
import org.restlet.resource.Get;
import org.restlet.resource.Put;
import org.restlet.resource.ServerResource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class PersonResource extends ServerResource
{
private static Map<String, Person> DB = new HashMap<String, Person>();
static
{
final Person p = new Person("123", "Jarrod", "Roberson",new Date());
DB.put(p.getId(), p);
}
@Put("json")
public void store(final Person p)
{
DB.put(p.getId(), p);
}
@Get("json")
public Person find()
{
final String id = (String) super.getRequestAttributes().get("id");
return DB.get(id);
}
}
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2671478
PersonResource.java
Description: Binary data

