将blob servlet与端点API相结合 [英] combining blob servlet with endpoint api

查看:116
本文介绍了将blob servlet与端点API相结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的 web.xml

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <servlet>
    <servlet-name>Upload</servlet-name>
    <servlet-class>Upload</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>Upload</servlet-name>
    <url-pattern>/upload</url-pattern>
  </servlet-mapping>

    <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>com.company.game.GameApi</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>SystemServiceServlet</servlet-name>
        <url-pattern>/_ah/spi/*</url-pattern>
    </servlet-mapping>

</web-app>

我有一个Google Cloud Endpoint API,GameApi,除了加载blob这花了太长时间。因此,我决定使用 上传 google网站上的servlet从用户上传我的blob 。我基本上将blob文件的xml代码添加到我的现有xml代码中以获得端点api,从而生成上面显示的xml。但是,上传servlet从未被调用过。我正在测试本地主机,我可以在 _BlobUploadSession _ 表中看到前端(即android应用)已经成功地将图像发送到具有正确回调url的blobstore。我知道servlet没有被调用,因为我在入口处有一个println语句。

I have a Google Cloud Endpoint api, GameApi, which had been working fine except for the loading of blobs which was taking too long. So I decide to use the Upload servlet on the google website to upload my blobs from user. I basically added the xml code for the blob file to my existing xml code for the endpoint api, resulting in the xml shown above. But then the Upload servlet is never called. I am testing on localhost and I can see in the _BlobUploadSession_ table that the front-end (i.e. android app) has successfully sent the image to the blobstore with the correct callback url. I know that the servlet is not being called because I have a println statement right at the entrance.

我需要更改我的 web.xml ?我允许将终端与servlet结合起来,就像我在 web.xml中一样

Do I need to change my web.xml? Am I allowed to combine endpoint with servlet as I am doing in my web.xml?

推荐答案

查看 https://cloud.google.com/developers/articles/how-to-build-mobile-app-with-app-engine-backend-tutorial

<servlet>
  <display-name>Remote API Servlet</display-name>
  <servlet-name>RemoteApiServlet</servlet-name>
  <servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>RemoteApiServlet</servlet-name>
  <url-pattern>/remote_api</url-pattern>
</servlet-mapping>

这篇关于将blob servlet与端点API相结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆