Glassfish与Tomcat的RESTful服务

时间:2021-09-09 13:41:33

I have a .net development background but relatively new to Java world. We have started development of RESTful services (public web APIs) with JAX-RS to be consumed mostly by mobile platforms (Android, iPhone, windows phone etc.)

我有.net开发背景,但对Java世界来说相对较新。我们已经开始使用JAX-RS开发RESTful服务(公共Web API),主要由移动平台(Android,iPhone,Windows Phone等)使用。

  1. We need some guidance on selection of appropriate server such as Tomcat or Glassfish etc.? Please share reason as well.
  2. 我们需要一些关于选择适当服务器的指导,如Tomcat或Glassfish等?请分享理由。
  3. Also please guide whether our decision of JAX-RS is appropriate for build RESTful services.
  4. 另请指导我们对JAX-RS的决定是否适合构建RESTful服务。

2 个解决方案

#1


20  

Tomcat is a servlet container only, which simply means that it will not provide support for Java EE features.

Tomcat只是一个servlet容器,这意味着它不会提供对Java EE功能的支持。

More than looking at RESTful services, see what you intend to use to implement your tier functionality. If you are sticking with Servlet/JSP only, then Tomcat would definitely be a very reasonable choice. If you need to use JavaEE features, then look at GlassFish.

除了查看RESTful服务之外,还可以查看您打算使用什么来实现层功能。如果你只坚持使用Servlet / JSP,那么Tomcat绝对是一个非常合理的选择。如果您需要使用JavaEE功能,请查看GlassFish。

Purely in terms of functionality, GlassFish can do everything Tomcat can, and a lot more, because it is a fully JavaEE compliant application server. But, take note, that Tomcat is used to great effect for a lot of complex applications (that don't use Java EE features).

纯粹在功能方面,GlassFish可以完成Tomcat可以做的所有事情,还有更多,因为它是一个完全符合JavaEE的应用服务器。但是,请注意,Tomcat用于很多复杂应用程序(不使用Java EE功能)的效果很好。

In terms of performance, Tomcat is lightweight, starts really fast, and is well supported in the Eclipse environment. GlassFish startup is a bit slower (around 11 seconds on my horrible laptop), but deploys are blazing fast.

在性能方面,Tomcat是轻量级的,启动速度非常快,并且在Eclipse环境中得到了很好的支持。 GlassFish的启动速度有点慢(在我可怕的笔记本电脑上大约11秒),但部署速度非常快。

Tomcat has a manager application for basic app deployment, but JNDI and similar resource configurations (like user configs) have to be done by editing XML files manually. Glassfish has a nice administration console which allows you to do all this from a central UI without manual configuration editing.

Tomcat有一个用于基本应用程序部署的管理器应用程序,但JNDI和类似的资源配置(如用户配置)必须通过手动编辑XML文件来完成。 Glassfish有一个很好的管理控制台,允许您从*UI完成所有这些操作,无需手动配置编辑。

Anyways, what I'm getting at is that your choice should be based solely on what you intend to use from the Java/Java EE APIs, and the server that minimally fits that bill. Don't go by any popularity consensus, as your requirements are your best guide.

无论如何,我所得到的是,您的选择应该完全基于您打算从Java / Java EE API使用的内容,以及最低限度适合该法案的服务器。不要达到任何人气共识,因为您的要求是您最好的指导。

As far as implementing with JAX-RS is concerned, I don't see any concerns there. I've worked with Jersey, and here's a sneak peek looking at the two: http://www.slideshare.net/pelegri/jersey-and-jaxrs-presentation

就JAX-RS的实施而言,我没有看到任何担忧。我和泽西岛一起工作过,看看这两个是偷偷摸摸的:http://www.slideshare.net/pelegri/jersey-and-jaxrs-presentation

Lastly, as far as SSL is concerned: Both Tomcat and Glassfish will happily do SSL, no issues in either whatsoever.

最后,就SSL而言:Tomcat和Glassfish都很乐意做SSL,无论如何都没有问题。

GlassFish SSL tut: http://javadude.wordpress.com/2010/04/06/getting-started-with-glassfish-v3-and-ssl/

GlassFish SSL tut:http://javadude.wordpress.com/2010/04/06/getting-started-with-glassfish-v3-and-ssl/

Good luck.

祝你好运。

#2


3  

You may take a look at Play Framework. It is scalable, stateless, restful Web-framework. Normally it don't need an application server like Tomcat. It has it's own built-in high performance webserver based on Netty. But an application can be packed as .war if you'll need it.

您可以查看Play Framework。它是可扩展的,无状态的,宁静的Web框架。通常它不需要像Tomcat这样的应用服务器。它拥有自己内置的基于Netty的高性能网络服务器。但是,如果您需要,应用程序可以打包为.war。

Building RESTful web-service won't be a problem using Play.

使用Play构建RESTful Web服务不会成为问题。

We use it on production environment and pretty happy with it. Development is very fast and easy. It is like Ruby on Rails in Java World.

我们在生产环境中使用它并且非常满意。开发非常快速和简单。它就像Java World中的Ruby on Rails。

EDIT

编辑

For an example, you may see this post.

例如,您可能会看到此帖子。

#1


20  

Tomcat is a servlet container only, which simply means that it will not provide support for Java EE features.

Tomcat只是一个servlet容器,这意味着它不会提供对Java EE功能的支持。

More than looking at RESTful services, see what you intend to use to implement your tier functionality. If you are sticking with Servlet/JSP only, then Tomcat would definitely be a very reasonable choice. If you need to use JavaEE features, then look at GlassFish.

除了查看RESTful服务之外,还可以查看您打算使用什么来实现层功能。如果你只坚持使用Servlet / JSP,那么Tomcat绝对是一个非常合理的选择。如果您需要使用JavaEE功能,请查看GlassFish。

Purely in terms of functionality, GlassFish can do everything Tomcat can, and a lot more, because it is a fully JavaEE compliant application server. But, take note, that Tomcat is used to great effect for a lot of complex applications (that don't use Java EE features).

纯粹在功能方面,GlassFish可以完成Tomcat可以做的所有事情,还有更多,因为它是一个完全符合JavaEE的应用服务器。但是,请注意,Tomcat用于很多复杂应用程序(不使用Java EE功能)的效果很好。

In terms of performance, Tomcat is lightweight, starts really fast, and is well supported in the Eclipse environment. GlassFish startup is a bit slower (around 11 seconds on my horrible laptop), but deploys are blazing fast.

在性能方面,Tomcat是轻量级的,启动速度非常快,并且在Eclipse环境中得到了很好的支持。 GlassFish的启动速度有点慢(在我可怕的笔记本电脑上大约11秒),但部署速度非常快。

Tomcat has a manager application for basic app deployment, but JNDI and similar resource configurations (like user configs) have to be done by editing XML files manually. Glassfish has a nice administration console which allows you to do all this from a central UI without manual configuration editing.

Tomcat有一个用于基本应用程序部署的管理器应用程序,但JNDI和类似的资源配置(如用户配置)必须通过手动编辑XML文件来完成。 Glassfish有一个很好的管理控制台,允许您从*UI完成所有这些操作,无需手动配置编辑。

Anyways, what I'm getting at is that your choice should be based solely on what you intend to use from the Java/Java EE APIs, and the server that minimally fits that bill. Don't go by any popularity consensus, as your requirements are your best guide.

无论如何,我所得到的是,您的选择应该完全基于您打算从Java / Java EE API使用的内容,以及最低限度适合该法案的服务器。不要达到任何人气共识,因为您的要求是您最好的指导。

As far as implementing with JAX-RS is concerned, I don't see any concerns there. I've worked with Jersey, and here's a sneak peek looking at the two: http://www.slideshare.net/pelegri/jersey-and-jaxrs-presentation

就JAX-RS的实施而言,我没有看到任何担忧。我和泽西岛一起工作过,看看这两个是偷偷摸摸的:http://www.slideshare.net/pelegri/jersey-and-jaxrs-presentation

Lastly, as far as SSL is concerned: Both Tomcat and Glassfish will happily do SSL, no issues in either whatsoever.

最后,就SSL而言:Tomcat和Glassfish都很乐意做SSL,无论如何都没有问题。

GlassFish SSL tut: http://javadude.wordpress.com/2010/04/06/getting-started-with-glassfish-v3-and-ssl/

GlassFish SSL tut:http://javadude.wordpress.com/2010/04/06/getting-started-with-glassfish-v3-and-ssl/

Good luck.

祝你好运。

#2


3  

You may take a look at Play Framework. It is scalable, stateless, restful Web-framework. Normally it don't need an application server like Tomcat. It has it's own built-in high performance webserver based on Netty. But an application can be packed as .war if you'll need it.

您可以查看Play Framework。它是可扩展的,无状态的,宁静的Web框架。通常它不需要像Tomcat这样的应用服务器。它拥有自己内置的基于Netty的高性能网络服务器。但是,如果您需要,应用程序可以打包为.war。

Building RESTful web-service won't be a problem using Play.

使用Play构建RESTful Web服务不会成为问题。

We use it on production environment and pretty happy with it. Development is very fast and easy. It is like Ruby on Rails in Java World.

我们在生产环境中使用它并且非常满意。开发非常快速和简单。它就像Java World中的Ruby on Rails。

EDIT

编辑

For an example, you may see this post.

例如,您可能会看到此帖子。