Hi,
The suggested propositions should work. The simplest way might be this:
@Post("form:html")
public String submit(Form form) throws Exception {
...
}
If you still get your java.lang.IllegalStateException, it means that something
upstream already consumed the transient/socket provided entity content. You
should check especially any upstream filter that could have already parsed/used
the entity.
Best regards,
Jerome
--
Restlet ~ Founder and Technical Lead ~ http://www.restlet.org
Noelios Technologies ~ http://www.noelios.com
-----Message d'origine-----
De : Beefnugget [mailto:[email protected]]
Envoyé : vendredi 24 décembre 2010 04:07
À : [email protected]
Objet : Re: What replaces GetEntityAsForm?
Thanks for the reply.
My input is a regular POST form such as:
-------------------------------
<html><body> <h1>Register a server:</h1><p>(note: each server requires a unique
login, multiple logins from different ips may result in a
ban)</p><p>(note: Write this login information down, you will not be able to
retrieve it later)</p><p><form
action="http://localhost:8182/main/pubserver/register?" method="post">
<P><LABEL>Alphanumeric characters only. Max length of 20.</label></p><p><LABEL
for="login">Login: </LABEL> <INPUT type="text"
id="login"><BR> <LABEL for="pass">Password: </LABEL> <INPUT type="text"
id="pass"><BR><INPUT type="hidden" id="gameid" value="minecraft"><INPUT
type="submit" value="Send"> <INPUT type="reset"></P></FORM></body></html>
----------------------------------
I have tried:
-------------------------------
@Post("html")
public String submit() throws Exception {
Form form = new Form(this.getRequestEntity());
.....
-------------------------------
Which throws an exception: java.lang.IllegalStateException: 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
Also I tried:
--------------------------------
@Post("html")
public String submit(Representation entity) throws Exception {
Form form = new Form(entity);
.....
---------------------------------
But in this case entity is sent in as null.
The last method i could find in the wiki or anywhere was
http://wiki.restlet.org/docs_2.1/13-restlet/27-restlet/326-restlet/380-restlet.html
http://wiki.restlet.org/docs_2.1/13-restlet/27-restlet/326-restlet/380-restlet.html
But this method changes my entire router setup into an extractor? In which case
I am not sure how I would send these variables into Resource instances.
--
View this message in context:
http://restlet-discuss.1400322.n2.nabble.com/What-replaces-GetEntityAsForm-tp5860492p5863041.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2693481
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2693502