-
Notifications
You must be signed in to change notification settings - Fork 12
Intercept a Request
Ta Van Dung edited this page Jun 17, 2016
·
2 revisions
import com.tvd12.ezyfox.core.annotation.ClientRequestListener;
import com.tvd12.ezyfox.core.annotation.RequestParam;
import com.tvd12.ezyfox.core.content.AppContext;
import com.tvd12.ezyfox.core.exception.BadRequestException;
@ClientRequestListener(command = "sum")
public class SumRequestInteceptor {
@RequestParam private int a;
@RequestParam private int b;
public void execute(AppContext context, GameUser user) throws Exception {
if(a == 0 || b == 0)
// error code = 1 and response this error to client (false if don't need response to client)
throw new BadRequestException("Unsupport negative number", 1, true);
}
}Hello World