Hello all,
I send you my sample GAE project. It is actually the same as the "jse" one
sent previously. I've just removed the basic libraries (gae, and so on)
from the WEB-INF/lib directory.
It simply works for me, using the following interface :
public interface AuthenticationResource {
@Get
public Authentication represent();
@Post
public Authentication login(Authentication auth);
}
and this client code on the android side:
ClientResource cr = new
ClientResource("http://192.168.2.4:8888/test/login<http://192.168.2.3:8182/test/login>
");
cr.setRequestEntityBuffering(true);
AuthenticationResource res = cr.wrap(AuthenticationResource.class);
Authentication a = res.login(new Authentication("mylogin2", "mypassword"));
Please note the presence of this line of code:
cr.setRequestEntityBuffering(true);
This is mandatory since the GAE platform does not support chunked encoding.
You may need also to add a parameter to your GAE Eclipse running task. By
default, when you go to the "Run configurations" menu, the launching
arguments are as follow:
--port=8888 /media/workspace/gwt/testSultan/war
You should add the "--address" parameter in order to reference your network
IP:
--port=8888 --address=192.168.2.4 /media/workspace/gwt/testSultan/war
I hope this will help you.
Best regards,
Thierry Boileau
When i send to server simple object of Authentication class, this error also
> show me. But then i change my AuthenticationServerResource, i receive not
> object of Authentication class, but JacksonRepresentation, as bellow
> @Post
> public void login(JacksonRepresentation<Authentication> auth);
>
> I send you simple client side
> In the server side simple add interface AuhtenticationResource
> Create class AuthenticationServerResource and implement
> AuthenticationResource
>
> /********** interface
> *public interface AuthenticationResource {
>
> @Post
> public void login(JacksonRepresentation<Authentication> auth) throws
> IOException;
> }*
>
>
> /*********class
>
> public class AuthenticationServerResource extends ServerResource implements
> AuthenticationResource {
>
> @Post
> public void login(JacksonRepresentation<Authentication> jackObj) throws
> IOException {
> Representation rep = jackObj;
> JsonRepresentation jsonRep = new JsonRepresentation(rep);
> try {
> JSONObject jsonObj = jsonRep.getJsonObject();
> String str = jsonObj.getString("login");
> String str2 = jsonObj.getString("password");
> System.out.println(str);
> System.out.println(str2);
> } catch (JSONException e) {
>
> e.printStackTrace();
> }
> }
> }
> and of course add all the libraries
>
> http://restlet-discuss.1400322.n2.nabble.com/file/n7467069/TestClient.zip
> TestClient.zip
>
> --
> View this message in context:
> http://restlet-discuss.1400322.n2.nabble.com/Restlet-Framework-Serialization-Don-t-understand-how-send-and-receive-object-tp7451788p7467069.html
> Sent from the Restlet Discuss mailing list archive at Nabble.com.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2948370
>
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2949462