Hello everyone,
I am new to Restlet and as a first project I try to have a simple resource on a
GAE server that I can get to receive a form with:
<form name="input" action="/data" method="post">
Color: <input type="text" name=col value=${color} />
<input type="submit" value="change" />
</form>
form from which I can emit a Post to change the color.
This is how I try to receive the form content:
@Post
public void accept(Representation entity) throws ResourceException {
System.out.println("The POST method of DATA resource was invoked.");
final Form form = new Form(entity);
System.out.println("Value => " + form.getFirstValue("col"));
Map<String,String> map = form.getValuesMap();
System.out.println("Num items: " + map.size());
int i=0;
for(String key: map.keySet()) {
String val = map.get(key);
System.out.println("Item "+i+" --> " + key +":"+val);
i++;
}
}
When I try a post with a color I receive the following messages in the console:
The POST method of DATA resource was invoked.
Value => null
Num items: 0
When I try:
extractor.extractFromEntity("color", "col", true);
I get:
Internal Server Error
The Web form cannot be parsed as no fresh content is available. If this entity
has been already read once, caching of the entity is required
I use Restlet for GAE 2.1 Milestone 7 and GAE 1.5.4. I have found:
http://restlet.tigris.org/issues/show_bug.cgi?id=1275
and I have tried to make GaeFormConverter.java work but without success.
So, up to now, I am a bit confused by this issue and that's why I ask your help.
In which direction should I go:
1. Wait until this issue will be resolved soon in Restlet 2.1RC1?
2. In the mean time, is there a quick workaround?
3. Is it a way to make the GaeFormConverter.java work?
4. Is there some other things that are wrong in what I try to do?
As you can see, your help will be very appreciate.
Thanks in advance,
Michel
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2842944