下面是用 Java 实现一个 Restful 风格的异步接口的示例代码:
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Response;
@Path("/async")
public class AsyncResource {
@GET
public void asyncGet(@Suspended