简体   繁体   English

将URL从AppEngine发送到Java应用程序

[英]Sending URL's from AppEngine to Java application

I'm using a Java application with Google AppEngine. 我正在将Java应用程序与Google AppEngine一起使用。 I send post requests to the servlet and it needs to response with some unknown number of URL's. 我将发布请求发送到servlet,它需要使用一些未知数量的URL进行响应。

I was wondering what would be the best way to implement this. 我想知道什么是实现此目标的最佳方法。 Making URL object in the app and sending it as JSON or then reconverting it in the Java application or just sending the URLs as String with some delimiter ? 在应用程序中创建URL对象并将其作为JSON发送,或者在Java应用程序中将其重新转换,或者仅使用一些分隔符将URL作为String发送?

Is there a way to send parameters in response objects like we do with request objects or maybe set the MIME type so we can get the URLs easily in the Java application ? 有没有办法像在请求对象中那样在响应对象中发送参数,或者设置MIME类型,以便我们可以在Java应用程序中轻松获取URL?

I'd recommend just returning a JSON array; 我建议只返回一个JSON数组; there are good libraries in Java (see Jackson Vs. Gson ) to create JSON from Java objects and parsing JSON in javascript is obviously a solved problem. Java中有很好的库(请参阅Jackson Vs. Gson ),可以从Java对象创建JSON,而在javascript中解析JSON显然是一个已解决的问题。 Relying on well-known code to do all the encoding/decoding is a huge help. 依靠著名的代码进行所有的编码/解码是巨大的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM