JAX-RS services in Google App Engine

半城伤御伤魂 提交于 2020-01-01 05:51:26

问题


I'm developing a Google App Enigne application that uses some REST services and offers in turn web services. I'm using the GAE Eclipse plugin. I have 2 questions:

  1. What is the best JAX-RS library to use with GAE nowadays? I'd like to use Jersey because I understand is the most "standard" library (isn't it?), but I could use any in principle... I've been looking for documentation, but I've only found some samples in blogs that only work with old versions of Jersey, etc...

  2. For the web services I have to offer, I thought of using JAX-RS as well, but now I'm not sure if it's the best option...


回答1:


You can use Jersey 1.5. You can see all frameworks that will play on GAE at http://code.google.com/p/googleappengine/wiki/WillItPlayInJava

But GAE has realized on version 1.7.5 as experimental service Endpoints which in term are rest service. Check https://developers.google.com/appengine/docs/java/endpoints/

For web service I don't know if you mean soap service..JAX-RS is the specification for rest service, instead you should use JAX-WS I don't try the compatibility with this specification.




回答2:


After a little research on this subject, I've found out that the best way to offer web services from Google App Engine is using Google Cloud Endpoints, which is still an experimental technology but as far as I've tried, it works well. Furthermore it is very well integrated with GAE and the Google Plugin for Eclipse.

To cosume REST services from Google App Engine, I've opted for using just Java build-in HTTP client library as explained here. I don't know if it's the best way, but it is very simple and you avoid compatibility problems that could arise between GAE and JAX-RS APIs such as Jersey.

In order to work with JSON in GAE (very useful for RESTful services), I'm using Google's gson, which is a Java library that can be used to convert Java Objects into their JSON representation and vice-versa.



来源:https://stackoverflow.com/questions/15254232/jax-rs-services-in-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!