Chia sẻ kiến thức lập trình

Handle Client Requests

Let's look at this example:

@EzyObjectBinding(write = false)
public class GreetRequestHandler 
        extends ClientRequestHandler 
        implements EzyDataBinding {

    private String who;
    private Greeting greeting;
    protected void execute() throws EzyBadRequestException {
            .param("message", greeting.greet(who))

In this example:

- GreetRequestHandler handle GREET (String GREET = "greet") command from client by using @EzyClientRequestListener annotation

- Client send to server who parameter

- EzyFox bind who parameter to who property of GreetRequestHandler directly by using @EzyObjectBinding annotation

- @EzyPrototype indicate that anytime client request to server, EzyFox will create a new instance of handler class to handle request