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