将Content-Length标头添加到Google Endpoints应用

时间:2016-06-30 19:07:51

标签: java google-app-engine google-cloud-endpoints

我正在构建基于某些参数的Google Endpoints应用,返回json响应。端点主要用于Android / iOS应用程序,因为需要有一个进度条来显示请求的当前进度,我需要在响应头中包含Content-Length。我已经阅读了GAE文档,它告诉我必须添加

    <static-files>
  <include path="/my_static-files" >
    <http-header name="Access-Control-Allow-Origin" value="http://example.org" />
  </include>
</static-files>

在我的appengine-web.xml文件中。我已经这样做了,但是在使用邮递员寻找它时没有出现这样的标题。

我的appengine-web.xml文件:

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>myApplicationId</application>
    <version>1</version>
    <threadsafe>true</threadsafe>
    <basic-scaling>
        <max-instances>15</max-instances>
    </basic-scaling>
    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
    </system-properties>
    <static-files>
        <include  path="/WEB-INF/*">
            <http-header name="Content-Length" value="1761" />
        </include>
    </static-files>
</appengine-web-app>

我猜我有“路径”参数错误,但文档并没有帮助我找到正确的信息放在那里。这仅与访问静态文件有关吗?如果是这样,我如何将这样的标题添加到这样的请求中:

https://xyz.appspot.com/_ah/api/myApi/v7/blabla/

0 个答案:

没有答案
相关问题