Hello. I don't understand how server can take an object sent by the client.
For example.
I have such an interface on the client side:

/*****
public interface AuthorizationResource {
    @Post
    public void login(Authentication auth);
}
******/

then i send to server the object of Authentication class:

/******
Authentication auth = new Authentication ("login", "password");

resource.login(auth);

*******/

The Authentication class (Both classes are also available on the server and
client): 
/******
public class Authentication implements Serializable{
    
    private static final long serialVersionUID = 1L;
    
    public String login;
    public String password;     
    
        public Authentication() {}

    public Authentication(String login, String password) {
super();
        this.login = login;
        this.password = password;
    }
    
    public String getLogin() {
        return login;
    }
    
    public String getPassword() {
        return password;
    }
    
    public void setLogin(String login) {
        this.login = login;
        
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
}
******/

Then on the server side i want to get the object of Authentication class

/******

public class AuthenticationServerResource extends ServerResource {
    
    Authentication auth = new Authentication("defaultLogin",
"defaultPassword");
    
    @Post
    public void login (Authentication auth) {
        this.auth = au;
                System.out.println(a​uth.getLogin());
    }
}

******/

but nothing happens. The console doesn't output anything

My questions, which is best way to serialize object? and is my way right?

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Restlet-Framework-Serialization-Don-t-understand-how-send-and-receive-object-tp7451788p7451788.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2946658

Reply via email to