本文整理汇总了Java中com.google.ipc.invalidation.external.client.android.service.Request.getAction方法的典型用法代码示例。如果您正苦于以下问题:Java Request.getAction方法的具体用法?Java Request.getAction怎么用?Java Request.getAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.ipc.invalidation.external.client.android.service.Request
的用法示例。
在下文中一共展示了Request.getAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleRequest
import com.google.ipc.invalidation.external.client.android.service.Request; //导入方法依赖的package包/类
protected void handleRequest(Bundle input, Bundle output) {
synchronized (lock) {
if (!isCreated) {
logger.warning("Dropping bundle since not created: %s", input);
return;
}
Request request = new Request(input);
Response.Builder response = Response.newBuilder(request.getActionOrdinal(), output);
Action action = request.getAction();
logger.fine("%s request from %s", action, request.getClientKey());
try {
switch(action) {
case CREATE:
create(request, response);
break;
case RESUME:
resume(request, response);
break;
case START:
start(request, response);
break;
case STOP:
stop(request, response);
break;
case REGISTER:
register(request, response);
break;
case UNREGISTER:
unregister(request, response);
break;
case ACKNOWLEDGE:
acknowledge(request, response);
break;
case DESTROY:
destroy(request, response);
break;
default:
throw new IllegalStateException("Unknown action:" + action);
}
} catch (Exception e) {
logger.severe("Client request error", e);
response.setStatus(Status.RUNTIME_ERROR); // Subclass might already have set status.
response.setException(e);
}
}
}