An Open Source Organization!

Handle Client Requests

Let’s look at this example:

@Setter
@EzyPrototype
@EzyObjectBinding(write = false)
@EzyClientRequestListener(GREET)
public class GreetRequestHandler 
        extends ClientRequestHandler 
        implements EzyDataBinding {

    private String who;
    
    @EzyAutoBind
    private Greeting greeting;
    
    @Override
    protected void execute() throws EzyBadRequestException {
        responseFactory.newObjectResponse()
            .command(GREET)
            .param("message", greeting.greet(who))
            .session(session)
            .execute();
    }
}

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

Share: