Google Blobstore App Engine教程

时间:2013-09-18 15:01:27

标签: java html google-app-engine jsp blobstore

更新见下文

我正在尝试从这个谷歌教程构建这个blobstore应用程序引擎示例:

https://developers.google.com/appengine/docs/java/blobstore/#Uploading_a_Blob

这就是我所拥有的。我可以选择要上传的文件。

http://instantedituploader.appspot.com/

当我点击提交时,我收到此错误:

    Error: Not Found

    The requested URL /%3C%=%20blobstoreService.createUploadUrl(?foo=&myFile=sprayerpic.jpg was not found on this server.

我很确定我错过了:

<%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>
<%@ page import="com.google.appengine.api.blobstore.BlobstoreService" %>

<%
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
%>

我把它拿出来是因为我无法弄清楚如何在index.html中包含它。本教程使用jsp文件包含上面的内容和上传表单/提交的html。我该怎么做?

UPDATE ----------------------

好的,我将index.jsp切换到了我的欢迎文件。现在我得到500服务器错误这是应用引擎控制台中显示的内容,我也得到了/favicon.ico错误。

013-09-18 08:33:08.601 / 500 3477ms 0kb Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko) Ubuntu/12.10 Chromium/22.0.1229.94 Chrome/22.0.1229.94 Safari/537.4
W 2013-09-18 08:33:08.412 EXCEPTION java.lang.ClassNotFoundException: Serve at com.google.appengine.runtime.Request.process-cb1588546d641fbb(Request.java) at java.lang.Class
E 2013-09-18 08:33:08.414 javax.servlet.ServletContext log: unavailable javax.servlet.UnavailableException: Serve at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:79)
W 2013-09-18 08:33:08.419 EXCEPTION java.lang.ClassNotFoundException: Upload at com.google.appengine.runtime.Request.process-cb1588546d641fbb(Request.java) at java.lang.Clas
E 2013-09-18 08:33:08.420 javax.servlet.ServletContext log: unavailable javax.servlet.UnavailableException: Upload at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:79)
W 2013-09-18 08:33:08.591 Failed startup of context com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@d206ca{/,/base/data/home/apps/s~instantedituploader/1.370311
C 2013-09-18 08:33:08.597 Uncaught exception from servlet javax.servlet.UnavailableException: Initialization failed. at com.google.apphosting.runtime.jetty.AppVersionHandlerMa
I 2013-09-18 08:33:08.600 This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This requ

1 个答案:

答案 0 :(得分:1)

示例中的文件是Java Server Pages。请参阅有关如何use JSPs with GAE的文档。

您应该将index.html重命名为index.jsp并将其设置为web.xml中的欢迎文件(当用户调用根/时,欢迎页面会被投放):

<welcome-file-list>
    <welcome-file>path/to/index.jsp</welcome-file>
</welcome-file-list>