404用于驻留在静态资源中的所有文件

时间:2016-02-12 06:29:32

标签: java maven google-app-engine spring-mvc gcloud

localhost:8080所有脚本,图片和css文件都可用时,使用mvn gcloud:run在Google App引擎上托管这些文件时,无法找到这些文件。

enter image description here

这就是我将它们联系起来的方式

<link rel="shortcut icon" type="image/x-icon" href="${pageContext.request.contextPath}/static-resources/images/icons/favicon-32x32.png" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/static-resources/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/static-resources/bootstrap/3.3.5/css/bootstrap-theme.min.css">

以下是我的目标文件夹结构:

+-- appengine-staging
¦   +-- app.yaml
¦   +-- index.jsp
¦   +-- __static__
¦   ¦   +-- app.yaml
¦   ¦   +-- static-resources
¦   ¦       +-- animate
¦   ¦       ¦   +-- animate.css
¦   ¦       +-- bootstrap
¦   ¦       ¦   +-- 3.3.5
¦   ¦       ¦       +-- css
¦   ¦       ¦       ¦   +-- bootstrap.css
¦   ¦       ¦       ¦   +-- bootstrap.css.map
¦   ¦       ¦       ¦   +-- bootstrap.min.css
¦   ¦       ¦       ¦   +-- bootstrap-theme.css
¦   ¦       ¦       ¦   +-- bootstrap-theme.css.map
¦   ¦       ¦       ¦   +-- bootstrap-theme.min.css
¦   ¦       ¦       +-- fonts
¦   ¦       ¦       ¦   +-- glyphicons-halflings-regular.eot
¦   ¦       ¦       ¦   +-- glyphicons-halflings-regular.svg
¦   ¦       ¦       ¦   +-- glyphicons-halflings-regular.ttf
¦   ¦       ¦       ¦   +-- glyphicons-halflings-regular.woff
¦   ¦       ¦       ¦   +-- glyphicons-halflings-regular.woff2
¦   ¦       ¦       +-- js
¦   ¦       ¦           +-- bootstrap.js
¦   ¦       ¦           +-- bootstrap.min.js
¦   ¦       ¦           +-- npm.js
¦   ¦       +-- css
¦   ¦       ¦   +-- basic.css
¦   ¦       +-- images
¦   ¦       ¦   +-- 403.png
¦   ¦       ¦   +-- 500.png
¦   ¦       ¦   +-- background.jpg
¦   ¦       ¦   +-- brand2_copy.png
¦   ¦       ¦   +-- brand2.png
¦   ¦       ¦   +-- icon.png
¦   ¦       ¦   +-- icons
¦   ¦       ¦   ¦   +-- android-icon-144x144.png
¦   ¦       ¦   ¦   +-- android-icon-192x192.png
¦   ¦       ¦   ¦   +-- android-icon-36x36.png
¦   ¦       ¦   ¦   +-- android-icon-48x48.png
¦   ¦       ¦   ¦   +-- android-icon-72x72.png
¦   ¦       ¦   ¦   +-- android-icon-96x96.png
¦   ¦       ¦   ¦   +-- apple-icon-114x114.png
¦   ¦       ¦   ¦   +-- apple-icon-120x120.png
¦   ¦       ¦   ¦   +-- apple-icon-144x144.png
¦   ¦       ¦   ¦   +-- apple-icon-152x152.png
¦   ¦       ¦   ¦   +-- apple-icon-180x180.png
¦   ¦       ¦   ¦   +-- apple-icon-57x57.png
¦   ¦       ¦   ¦   +-- apple-icon-60x60.png
¦   ¦       ¦   ¦   +-- apple-icon-72x72.png
¦   ¦       ¦   ¦   +-- apple-icon-76x76.png
¦   ¦       ¦   ¦   +-- apple-icon.png
¦   ¦       ¦   ¦   +-- apple-icon-precomposed.png
¦   ¦       ¦   ¦   +-- browserconfig.xml
¦   ¦       ¦   ¦   +-- favicon-16x16.png
¦   ¦       ¦   ¦   +-- favicon-32x32.png
¦   ¦       ¦   ¦   +-- favicon-96x96.png
¦   ¦       ¦   ¦   +-- favicon.ico
¦   ¦       ¦   ¦   +-- manifest.json
¦   ¦       ¦   ¦   +-- ms-icon-144x144.png
¦   ¦       ¦   ¦   +-- ms-icon-150x150.png
¦   ¦       ¦   ¦   +-- ms-icon-310x310.png
¦   ¦       ¦   ¦   +-- ms-icon-70x70.png
¦   ¦       ¦   +-- loading.gif
¦   ¦       ¦   +-- login-background.jpg
¦   ¦       ¦   +-- pacman.gif
¦   ¦       +-- jquery
¦   ¦       ¦   +-- jquery-2.1.4.js
¦   ¦       +-- js
¦   ¦       ¦   +-- home.js
¦   ¦       +-- notify
¦   ¦           +-- notify.min.js
¦   +-- static-resources
¦   ¦   +-- animate
¦   ¦   ¦   +-- animate.css
¦   ¦   +-- bootstrap
¦   ¦   ¦   +-- 3.3.5
¦   ¦   ¦       +-- css
¦   ¦   ¦       ¦   +-- bootstrap.css
¦   ¦   ¦       ¦   +-- bootstrap.css.map
¦   ¦   ¦       ¦   +-- bootstrap.min.css
¦   ¦   ¦       ¦   +-- bootstrap-theme.css
¦   ¦   ¦       ¦   +-- bootstrap-theme.css.map
¦   ¦   ¦       ¦   +-- bootstrap-theme.min.css
¦   ¦   ¦       +-- fonts
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.eot
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.svg
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.ttf
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.woff
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.woff2
¦   ¦   ¦       +-- js
¦   ¦   ¦           +-- bootstrap.js
¦   ¦   ¦           +-- bootstrap.min.js
¦   ¦   ¦           +-- npm.js
¦   ¦   +-- css
¦   ¦   ¦   +-- basic.css
¦   ¦   +-- images
¦   ¦   ¦   +-- 403.png
¦   ¦   ¦   +-- 500.png
¦   ¦   ¦   +-- background.jpg
¦   ¦   ¦   +-- brand2_copy.png
¦   ¦   ¦   +-- brand2.png
¦   ¦   ¦   +-- icon.png
¦   ¦   ¦   +-- icons
¦   ¦   ¦   +-- loading.gif
¦   ¦   ¦   +-- login-background.jpg
¦   ¦   ¦   +-- pacman.gif
¦   ¦   +-- jquery
¦   ¦   ¦   +-- jquery-2.1.4.js
¦   ¦   +-- js
¦   ¦   ¦   +-- home.js
¦   ¦   +-- notify
¦   ¦       +-- notify.min.js
¦   +-- WEB-INF
¦       +-- appengine-generated
¦       ¦   +-- app.yaml
¦       +-- appengine-web.xml
¦       +-- classes
¦       ¦   +-- jetty-config.xml
¦       ¦   +-- logback.xml
¦       ¦   +-- pl
¦       ¦   ¦   +-- imguploadimg
¦       ¦   ¦       +-- webapp
¦       ¦   ¦           +-- controller
¦       ¦   ¦           ¦   +-- BaseController.class
¦       ¦   ¦           +-- service
¦       ¦   ¦           ¦   +-- CrawlerService.class
¦       ¦   ¦           ¦   +-- HTMLService.class
¦       ¦   ¦           +-- threads
¦       ¦   ¦               +-- LinkConsumer.class
¦       ¦   ¦               +-- LinkProducer.class
¦       ¦   ¦               +-- LinkQueue.class
¦       ¦   ¦               +-- LinkQueue$Link.class
¦       ¦   +-- property-files
¦       ¦   ¦   +-- config-info.properties
¦       ¦   +-- spring-config
¦       ¦       +-- spring-context.xml
¦       +-- layouts
¦       ¦   +-- layout.xml
¦       +-- lib

¦       +-- view
¦       ¦   +-- admin-page.jsp
¦       ¦   +-- error403.jsp
¦       ¦   +-- error500.jsp
¦       ¦   +-- home.jsp
¦       ¦   +-- index.jsp
¦       ¦   +-- login_form.jsp
¦       ¦   +-- search-page.jsp
¦       ¦   +-- student_form.jsp
¦       ¦   +-- template
¦       ¦       +-- footer.jsp
¦       ¦       +-- header.jsp
¦       ¦       +-- menu.jsp
¦       ¦       +-- no-template.jsp
¦       ¦       +-- site-template.jsp
¦       +-- web.xml
+-- classes
¦   +-- jetty-config.xml
¦   +-- logback.xml
¦   +-- pl
¦   ¦   +-- imguploadimg
¦   ¦       +-- webapp
¦   ¦           +-- controller
¦   ¦           ¦   +-- BaseController.class
¦   ¦           +-- service
¦   ¦           ¦   +-- CrawlerService.class
¦   ¦           ¦   +-- HTMLService.class
¦   ¦           +-- threads
¦   ¦               +-- LinkConsumer.class
¦   ¦               +-- LinkProducer.class
¦   ¦               +-- LinkQueue.class
¦   ¦               +-- LinkQueue$Link.class
¦   +-- property-files
¦   ¦   +-- config-info.properties
¦   +-- spring-config
¦       +-- spring-context.xml
+-- generated-sources
¦   +-- annotations
+-- maven-archiver
¦   +-- pom.properties
+-- webapp
¦   +-- app.yaml
¦   +-- index.jsp
¦   +-- META-INF
¦   +-- static-resources
¦   ¦   +-- animate
¦   ¦   ¦   +-- animate.css
¦   ¦   +-- bootstrap
¦   ¦   ¦   +-- 3.3.5
¦   ¦   ¦       +-- css
¦   ¦   ¦       ¦   +-- bootstrap.css
¦   ¦   ¦       ¦   +-- bootstrap.css.map
¦   ¦   ¦       ¦   +-- bootstrap.min.css
¦   ¦   ¦       ¦   +-- bootstrap-theme.css
¦   ¦   ¦       ¦   +-- bootstrap-theme.css.map
¦   ¦   ¦       ¦   +-- bootstrap-theme.min.css
¦   ¦   ¦       +-- fonts
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.eot
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.svg
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.ttf
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.woff
¦   ¦   ¦       ¦   +-- glyphicons-halflings-regular.woff2
¦   ¦   ¦       +-- js
¦   ¦   ¦           +-- bootstrap.js
¦   ¦   ¦           +-- bootstrap.min.js
¦   ¦   ¦           +-- npm.js
¦   ¦   +-- css
¦   ¦   ¦   +-- basic.css
¦   ¦   +-- images
¦   ¦   ¦   +-- 403.png
¦   ¦   ¦   +-- 500.png
¦   ¦   ¦   +-- background.jpg
¦   ¦   ¦   +-- brand2_copy.png
¦   ¦   ¦   +-- brand2.png
¦   ¦   ¦   +-- icon.png
¦   ¦   ¦   +-- icons
¦   ¦   ¦   +-- loading.gif
¦   ¦   ¦   +-- login-background.jpg
¦   ¦   ¦   +-- pacman.gif
¦   ¦   +-- jquery
¦   ¦   ¦   +-- jquery-2.1.4.js
¦   ¦   +-- js
¦   ¦   ¦   +-- home.js
¦   ¦   +-- notify
¦   ¦       +-- notify.min.js
¦   +-- WEB-INF
¦       +-- appengine-web.xml
¦       +-- classes
¦       ¦   +-- jetty-config.xml
¦       ¦   +-- logback.xml
¦       ¦   +-- pl
¦       ¦   ¦   +-- imguploadimg
¦       ¦   ¦       +-- webapp
¦       ¦   ¦           +-- controller
¦       ¦   ¦           ¦   +-- BaseController.class
¦       ¦   ¦           +-- service
¦       ¦   ¦           ¦   +-- CrawlerService.class
¦       ¦   ¦           ¦   +-- HTMLService.class
¦       ¦   ¦           +-- threads
¦       ¦   ¦               +-- LinkConsumer.class
¦       ¦   ¦               +-- LinkProducer.class
¦       ¦   ¦               +-- LinkQueue.class
¦       ¦   ¦               +-- LinkQueue$Link.class
¦       ¦   +-- property-files
¦       ¦   ¦   +-- config-info.properties
¦       ¦   +-- spring-config
¦       ¦       +-- spring-context.xml
¦       +-- layouts
¦       ¦   +-- layout.xml
¦       +-- lib
¦       +-- view
¦       ¦   +-- admin-page.jsp
¦       ¦   +-- error403.jsp
¦       ¦   +-- error500.jsp
¦       ¦   +-- home.jsp
¦       ¦   +-- index.jsp
¦       ¦   +-- login_form.jsp
¦       ¦   +-- search-page.jsp
¦       ¦   +-- student_form.jsp
¦       ¦   +-- template
¦       ¦       +-- footer.jsp
¦       ¦       +-- header.jsp
¦       ¦       +-- menu.jsp
¦       ¦       +-- no-template.jsp
¦       ¦       +-- site-template.jsp
¦       +-- web.xml
+-- webapp.war

另外,webapp / WEB-INF / appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>ImgUploadImg</application>
    <version>1</version>
    <threadsafe>true</threadsafe>
    <public-root>/static-resources</public-root>
    <static-files>
        <include path="/**.png" />
        <include path="/**.ico" />
        <include path="/**.js" />
        <include path="/**.css" />
        <include path="/static/**" />
        <include path="/static-resources/**" />
    </static-files>
</appengine-web-app>

以下是从控制台登录:

[INFO] Feb 15, 2016 5:56:50 AM com.google.appengine.tools.development.devappserver2.RemoteApiDelegate log
[INFO] INFO: [1455515810721000] javax.servlet.ServletContext log: Initializing Spring FrameworkServlet 'appServlet'
[INFO] Feb 15, 2016 5:56:53 AM com.google.apphosting.utils.jetty.JettyLogger info
[INFO] INFO: Started SelectChannelConnector@localhost:58435
[INFO] Feb 15, 2016 5:56:53 AM com.google.appengine.tools.development.AbstractModule startup
[INFO] INFO: Module instance default is running at http://localhost:58435/
[INFO] Feb 15, 2016 5:56:53 AM com.google.appengine.tools.development.AbstractModule startup
[INFO] INFO: The admin console is running at http://localhost:58435/_ah/admin
[INFO] Feb 15, 2016 5:56:53 AM com.google.appengine.tools.development.devappserver2.DevAppServer2Impl doStart
[INFO] Feb 15, 2016 5:56:58 AM com.google.appengine.tools.development.LocalResourceFileServlet doGet
[INFO] WARNING: No file found for: /_ah/warmup
[INFO] INFO     2016-02-15 05:56:58,212 module.py:787] default: "GET /_ah/warmup HTTP/1.1" 404 83
[INFO] INFO     2016-02-15 05:56:58,842 module.py:787] default: "GET /static-resources/images/brand2.png HTTP/1.1" 404 -
[INFO] INFO     2016-02-15 05:56:58,867 module.py:787] default: "GET /static-resources/images/loading.gif HTTP/1.1" 404 -
[INFO] INFO     2016-02-15 05:56:59,579 module.py:787] default: "GET /static-resources/images/icons/favicon-32x32.png HTTP/1.1" 404 -
[INFO] INFO     2016-02-15 05:57:04,113 module.py:787] default: "GET /static-resources/animate/animate.css HTTP/1.1" 404 -
[INFO] INFO     2016-02-15 05:57:04,114 module.py:787] default: "GET /static-resources/css/basic.css HTTP/1.1" 404 -
[INFO] INFO     2016-02-15 05:57:04,115 module.py:787] default: "GET /static-resources/bootstrap/3.3.5/css/bootstrap.min.css HTTP/1.1" 404 -
[INFO] INFO     2016-02-15 05:57:04,116 module.py:787] default: "GET /static-resources/bootstrap/3.3.5/css/bootstrap-theme.min.css HTTP/1.1" 404 -

0 个答案:

没有答案