【发布时间】:2016-11-07 00:17:00
【问题描述】:
当直接调用此端点所在的 URL (https://<my app name>.appspot.com/_ah/api/endpoints/v1/test) 并提供正文时,我有兴趣获取到达我的端点的 HTTP POST 请求的原始正文。下面是成功调用的端点方法:
@ApiMethod(name = "test", path = "test", httpMethod = ApiMethod.HttpMethod.POST)
public WrappedBoolean test(final HttpServletRequest request, ServletContext servletContext) throws Exception {
//???
return new WrappedBoolean(true);
}
不幸的是,尝试从HttpServletRequest 检索InputStream 然后读取它,给我一个-1,这意味着所有数据都已被读取。这是有道理的,因为 App Engine 端点运行时很可能现在已经处理了请求。
有人知道如何获取发布到此端点的原始 POST 请求吗?
【问题讨论】:
标签: http google-app-engine endpoint endpoints