【发布时间】:2016-10-24 20:27:25
【问题描述】:
对于第一个请求,我得到 JSON 响应。从下一个请求开始,我开始获取此日志和 HTTP 状态代码 204,即使 ServerResource 已成功返回表示
org.restlet.engine.adapter.ServerAdapter commit
WARNING: A response with an unavailable and potentially non empty entity was returned. Ignoring the entity for resource http://localhost:8888/xyz?abc=def
布线应用类
@Override
public Restlet createInboundRoot() {
router = new Router(getContext());
CorsService corsService = new CorsService();
corsService.setAllowedOrigins( new HashSet<String>(Arrays.asList("http://example.com")));
corsService.setAllowedCredentials(true);
getServices().add(corsService);
router.attach("/xyz", XYZ.class);
}
处理并返回 JSON 表示的服务器资源
public class XYZ extends ServerResource {
private static final Logger logger = Logger.getLogger("API:XyZ");
@Get(":json")
public Representation handleGetRequest() {
..
return API_RESPONSE_JSON_REPRESENTATION_SUCCESS;
}
}
【问题讨论】:
标签: java google-app-engine restlet