Tag: google app engine

Paypal Sandbox交易未显示

我在paypal沙盒中创建了一个帐户并创建了2个帐户,其中一个帐户有一些钱用于付款。 我使用我的java程序中的签名详细信息来获得付款。 当用户点击pay with paypal按钮时,我们将从paypal获取一个令牌并将其传递给此URL: https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token= 成功付款后,我无法在paypal沙盒帐户中看到任何交易? 为什么会这样,我在做什么错? 我正在使用Google App Engine java和jsp。 请给我任何帮助完成链接“Pay With Paypal” 谢谢。

在一个请求中上传JSON和二进制文件

我希望创建一个RESTful API,用于Android和iOS应用程序。 到目前为止,我一直在尝试在服务器上使用Jersey,然后在客户端使用相应的http库。 目前我一直使用multipart/related作为请求的mimetype,JSON构成了身体的第一部分,然后是jpeg图像作为第二部分。 到目前为止,我遇到了向服务器发出请求的问题,从Jersey获得了406 Not Acceptable 。 我注意到multipart/related主要用于发送电子邮件。 实际上是否有一种方法可以支持混合类型内容作为上传,或者我在这种情况下完全误解了multipart/related的用法?

Google App Engine Jersey错误格式json

我正在使用带有Jersey和JAX-RS的Google App Engine JAVA开发REST API。 我希望能够以JSON格式向用户发送自定义错误,因为我正在使用javax.ws.rs.ext.ExceptionMapper 当我在本地计算机上使用Jetty运行应用程序时,一切正常,但是当我部署到Google时,我得到了默认的HTML 404页面 这是资源代码: @GET @Produces(MediaType.APPLICATION_JSON) @Path(“{id}”) public Customer getCustomer(@PathParam(“id”) String id) { Customer customer = getCustomer(id); if(customer == null) throw new NotFoundException(“Customer not found”); return customer; } exception映射器: @Provider public class NotFoundExceptionMapper implements ExceptionMapper { @Override public Response toResponse(NotFoundException e) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setErrrorMessage(e.getMessage()); errorMessage.setResponseCode(404); return […]

持久保存@Embeddable的@ElementCollection(Google App Engine,datanucleus)

我正在尝试使用JPA2 @ElementCollection批注将JPA实体与一组自定义@Embeddable对象一起持久化。 简单的例子(这两个类都通过datanucleus增强): @Entity public class TestEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ElementCollection private Set testEmbeddables; public Set testEmbeddables() { return this.testEmbeddables; } } @Embeddable public class TestEmbeddable implements Serializable { public String s; } 但是,持久化的数据存储区实体只包含空值的集合,而不是实际的对象: TestEntity.testEmbeddables = [null, null, …] 保留一组基本类型(如字符串)或使用@Embedded嵌入单个TestEmbeddable对象非常合适。 是否有人能够澄清是否可以通过datanucleus-appengine支持嵌入式元素集合? 虽然JPA元素集合上的datanucleus部分仅给出了String集合的示例,但相应的JDO部分使用自定义的仅嵌入式类型。 function列表进一步指出嵌入式集合通常与GAE兼容,但没有说明是否支持自定义类型。 我还发现另一个人声称这应该有效 。 – 编辑 – 在DataNucleus回答之后,我又进行了一些测试: @ElementCollection […]

(Java)下载URL不起作用

我正在努力尝试使用谷歌驱动器API下载文件。 我只是编写应该从我的驱动器下载文件到我的计算机上的代码。 我终于到了一个我经过身份validation的阶段,可以查看文件元数据。 出于某种原因,我仍然无法下载文件。 我得到的downLoadURL看起来像: https://doc-04-as-docs.googleusercontent.com/docs/securesc/XXXXXXXXXXXXXX/0B4dSSlLzQCbOXzAxNGxuRUhVNEE?e=download&gd=true 当我运行代码或将其复制并粘贴到浏览器中时,此URl不会下载任何内容。 但是,在浏览器中,当我删除URL的“&gd = true”部分时,它会下载该文件。 我的下载方法直接来自google drive API文档: public static InputStream downloadFile(Drive service, File file) { if (file.getDownloadUrl() != null && file.getDownloadUrl().length() > 0) { try { System.out.println(“Downloading: “+ file.getTitle()); return service.files().get(file.getId()).executeMediaAsInputStream(); } catch (IOException e) { // An error occurred. e.printStackTrace(); return null; } } else { // The […]

使用UrlRewriteFilter从页面中删除.html扩展名? – 使用GAE

让我的url正确写入有点困难。 我刚刚发现了UrlRewriteFilter ,它似乎正是我所需要的,因为使用带GAE的Java重写URL是很困难的(使用python / go和app.yaml令人作呕的很简单,但是对于Java来说,这是一个很大的痛苦。由于某种原因,我必须使用Java)。 这是我的 – ^/test.html$ /test 我只是希望人们能够输入mysite.com/test而不是mysite.com/test.html 。 我是以正确的方式来做这件事的吗? 当我使用上面的代码时,我得到一个由java.lang.StackOverflowError引起的HTTP ERROR 500 。 任何帮助,将不胜感激! 谢谢。

App Engine上的javax.xml.ws.Service初始化出错

我正在尝试从GAE连接到SOAP服务器。 见例子 。 这一切在开发服务器上工作正常但在生产时我在初始化期间得到500错误。 经过大量挖掘后,我设法捕获了Throwable并记录了堆栈跟踪: java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:532) at java.lang.Class.newInstance0(Class.java:372) at java.lang.Class.newInstance(Class.java:325) at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:58) at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:142) at javax.xml.ws.spi.Provider.provider(Provider.java:102) 此问题可能与问题4910有关 。 有一个建议说: 我上面的意思是你不应该把任何实现jaxws的jar文件放入你的战争中。 App Engine运行时包含jaxws的实现,您应该使用它。 在我的课堂路径中,我找到了 XML的API-1.0.b2,=。jar子 JAXB-api.jar文件 JAXB – impl.jar中 它们看起来不像jaxws实现,至少据我所知。 没有jaxb真的没有(如果我删除那个jar我会收到错误)。 任何建议都是受欢迎的。 [更新] [似乎] 3在类路径中只有jaxb导致问题,因此无法找到GAE的jaxws实现。 这个答案对于理解jaxws初始化的工作原理也很有用。

在GAE / J中避免DeadlineExceededException的技巧?

我正在使用Google App Engine / Java开发一个Twitter4J Web应用程序。 我需要显示两个列表。 一个是Twitter好友,另一个是粉丝。 带照片和屏幕名称。 它适用于拥有20-30名粉丝和朋友的人。 但是当我尝试拥有150多个粉丝和朋友的用户时,它给了我DeadlineExceededException 。 如果Web请求花费的时间超过30秒,则GAE会抛出此exception。 那么我可以采用哪些技术来避免这种exception。 我应该为每个列表生成两个AJAX调用。 页面加载后。 这样每次通话都有30秒的限制吗? 或者你还有什么想法? 我已经离开了。 请帮忙。

Google App Engine后端servlet没有响应

我构建了一个我试图在后端运行的servlet。 但是在启动后端并向http://mybackend.myapp.appspot.com/update发送post后,没有任何内容可供选择。 当我访问: http : //myapp.appspot.com/update servlet正在工作但不在后端。 我究竟做错了什么? Servlet代码: public class UpdateServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println(“start long task”); } } backends.xml B1 true true web.xml中 update server.UpdateServlet update /update

eclipse中的谷歌数据(gdata)与app引擎,java

我之前有一个类似的问题,当它解决了这个问题。 所以我们再来一次 doGet的内容几乎可以工作但是当我尝试将它作为eclipse为我创建的servlet的一部分时,我会遇到错误。 它看起来有点像我没有库中引用的相应文件,但我想我做到了。 java代码如下所示: package picasatest; import java.io.IOException; import java.net.URL; import javax.servlet.http.*; import com.google.gdata.client.photos.PicasawebService; import com.google.gdata.data.photos.AlbumEntry; import com.google.gdata.data.photos.UserFeed; @SuppressWarnings(“serial”) public class PicasaTestServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType(“text/plain”); try { PicasawebService service = new PicasawebService(“Picasa test”); service.setUserCredentials(“username@gmail.com”, “password”); URL feedURL = new URL(“http://picasaweb.google.com/data/feed/api/user/username?kind=album”); UserFeed feed = service.getFeed(feedURL, […]