我的应用程序在后端使用聚合物作为前端和app引擎 endpoints (Java) . 由于我不明白的原因,我的 endpoints 客户端没有加载,我可以看到一些奇怪的URL请求失败,似乎已经在我的聚合物前端的app-route修改 . 我看到以下失败: -

https://(app-id).appspot.com / _ah / api / images / gweld_logo.png - 无法加载资源:服务器响应状态为404()https://(app-id) . appspot.com/src/_ah.html - 无法加载资源:服务器响应状态为404()

我的聚合物代码基于聚合物-cli提供的入门试剂盒 . 这是my-app.html的代码: -

<app-location route="{{route}}"></app-location>
<app-route
    route="{{route}}"
    pattern="/:page"
    data="{{routeData}}"
    tail="{{subroute}}"></app-route>
.
.
<template is="dom-if" if="{{!userSignedIn}}">
  <div class="container">
    <paper-card image="/images/gweld_logo.png" alt="(Company Name)" class="logo">
       <div class="card-content horizontal layout center-justified">
                    Company Portal
       </div>
       <div class="card-actions horizontal layout center-justified">
         <google-signin label-signin="Sign-in"
                                   client-id="(client-id)"
                                   scopes="https://www.googleapis.com/auth/userinfo.email"
                                   signed-in="{{userSignedIn}}">
         </google-signin>
      </div>
    </paper-card>
  </div>
</template>
<template is="dom-if" if="{{userSignedIn}}">
.
.
  <iron-selector selected="[[page]]" attr-for-selected="name" class="drawer-list" role="navigation">
     <a name="view1" href="/view1" paper-drawer-toggle>View One</a>
  </iron-selector>
  .
  .
  <iron-pages
        selected="[[page]]"
        attr-for-selected="name"
        fallback-selection="view404"
        role="main">
      <my-view1 name="view1"></my-view1>
      <my-view404 name="view404"></my-view404>
  </iron-pages>
.
.
</template>
.
.
Polymer({
  is: 'my-app',

  properties: {
    page: {
      type: String,
      reflectToAttribute: true,
      observer: '_pageChanged'
    }
  },

  observers: [
    '_routePageChanged(routeData.page)'
  ],

  _routePageChanged: function(page) {
    this.page = page || 'view1';
  },

  _pageChanged: function(page) {
    // Load page import on demand. Show 404 page if fails
    var resolvedPageUrl = this.resolveUrl('my-' + page + '.html');
    this.importHref(resolvedPageUrl, null, this._showPage404, true);
  },

  _showPage404: function() {
    this.page = 'view404';
  }

在my-view1.html中,我使用google-client-loader元素为我的app引擎 endpoints api加载客户端 .

以下是我在appengine-web.xml中定义静态文件的方法: -

<static-files>
      <include path="/service-worker.js"/>
      <include path="/bower_components/**.js"/>
      <include path="/*.json"/>
      <include path="/index.html"/>
      <include path="/src/**.html"/>
      <include path="/bower_components/**.html"/>
      <include path="/bower_components/**.css"/>
      <include path="/images/*.png"/>
      <include path="/**.ico"/>
   </static-files>

我的web.xml中有以下内容: -

<servlet>
    <servlet-name>SystemServiceServlet</servlet-name>
    <servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
    <init-param>
        <param-name>services</param-name>
        <param-value>(values removed here)</param-value>
    </init-param>
</servlet>
<servlet-mapping>
    <servlet-name>SystemServiceServlet</servlet-name>
    <url-pattern>/_ah/spi/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>

虽然我希望为所有请求加载index.html,但我不希望任何请求加载我的客户端路由拦截的客户端库 . 请让我知道如何解决上述问题 . 此外,使用客户端路由(app-route)与app引擎 endpoints 的正确做法是什么?