使用Swing瘦客户端的Java Server应用程序架构

时间:2021-08-09 21:44:51

I am currently looking to set up a client/server application. I am planning on having the clients written as a Swing thin client. I am not really sure how I should set up the Server side application.

我目前正在寻找设置客户端/服务器应用程序。我计划将客户端编写为Swing瘦客户端。我不确定如何设置服务器端应用程序。

The Java Server side application would have the application business logic, database access, etc. I see a lot information on the web about setting Java Server side applications that are use Web front ends. So I see a lot of information on Tomcat and full application servers like JBOSS, etc. Since I'm not going to be using a web front end I am not exactly sure how I should set up the server. I have been looking at Spring as well as Java EE.

Java Server端应用程序将具有应用程序业务逻辑,数据库访问等。我在Web上看到很多关于设置使用Web前端的Java Server端应用程序的信息。所以我看到很多关于Tomcat和JBOSS等完整应用服务器的信息。由于我不打算使用Web前端,我不确定应该如何设置服务器。我一直在关注Spring和Java EE。

Are these my best options? Are there other options that I'm not thinking of? Should I use them together or is it something that I can use separately?

这些是我最好的选择吗?还有其他我没想过的选择吗?我应该一起使用它们还是我可以单独使用的东西?

If I am only going to be using Java EE do I need a full application server like JBOSS, Weblogic, Websphere, etc or is this over kill? If I also want to use JMS, should I use an application server as well or are there alternatives? My first thoughts are that an application server is kind of over kill but I'm not exactly sure.

如果我只是要使用Java EE,我需要一个完整的应用程序服务器,如JBOSS,Weblogic,Websphere等,还是这个过度杀戮?如果我也想使用JMS,我是否应该使用应用程序服务器还是有替代方案?我的第一个想法是,应用程序服务器有点过度杀,但我不完全确定。

Thanks in advance for all your thoughts!

提前感谢您的所有想法!

5 个解决方案

#1


I think I'm pretty much in the same situation like yours. I'm planning to go ahead with Swing + Spring + JPA. The remoting shall be done through Spring Http Invoker. The only downside is you need a servlet container like Tomcat or Jetty to route the http requests to the Spring beans. But servers like winstone (which Hudson CI use) are quite lightweight and can be embedded in the application.

我想我和你的情况差不多。我打算继续使用Swing + Spring + JPA。远程处理应通过Spring Http Invoker完成。唯一的缺点是你需要一个像Tomcat或Jetty这样的servlet容器来将http请求路由到Spring bean。但像winstone这样的服务器(Hudson CI使用的)非常轻巧,可以嵌入到应用程序中。

Having a Spring back-end will mean that you don't need an application server. But should you need an application server in future, Spring can seamlessly support that as well.

拥有Spring后端意味着您不需要应用程序服务器。但是,如果您将来需要应用程序服务器,Spring也可以无缝支持它。

#2


An application server is an over kill if you are not using the features provided. If your application have only JSP and Servlets then Tomcat is a better choice. If using EJBs then you need an application server like Jboss.

如果您没有使用提供的功能,应用程序服务器就会被过度杀死。如果您的应用程序只有JSP和Servlet,那么Tomcat是更好的选择。如果使用EJB,则需要像Jboss这样的应用程序服务器。

First thing you have to decide is how your swing client will interact with your server. Are you going to use HTTP protocol, EJB lookup, simple RMI, etc?

首先要确定的是你的swing客户端如何与你的服务器进行交互。您打算使用HTTP协议,EJB查找,简单的RMI等吗?

If your client will be used by people who sits outside of your server network then you should use HTTP protocol so Servlets are the best choice. You can expose your server as webservice as well. If the client users are in the server network then you can use anything like EJB or socket programming or even http here as well.

如果您的客户端将由位于服务器网络之外的人使用,那么您应该使用HTTP协议,因此Servlet是最佳选择。您也可以将服务器公开为webservice。如果客户端用户在服务器网络中,那么您可以使用EJB或套接字编程等任何内容,甚至也可以使用http。

You can certainly use Spring in your server and client. Spring is a big framework, you need to decide what features you want to utilize. Spring can be used in servlet environment, EJB environment or any other environment.

您当然可以在服务器和客户端中使用Spring。 Spring是一个很大的框架,您需要决定要使用哪些功能。 Spring可以在servlet环境,EJB环境或任何其他环境中使用。

#3


http is a good but simple protocol which probably can do what you need.

http是一个很好但很简单的协议,可能会做你需要的。

To get inspired, try playing with the Jetty server (an alternative to Tomcat) - it has a simple Ajax based chat client as one of the demo applications which might be a basis for whatever you need to do.

要获得灵感,请尝试使用Jetty服务器(Tomcat的替代方案) - 它有一个简单的基于Ajax的聊天客户端作为演示应用程序之一,它可能是您需要做的任何事情的基础。

Get version 6 from http://dist.codehaus.org/jetty/jetty-6.1.19/

从http://dist.codehaus.org/jetty/jetty-6.1.19/获取版本6

I would recommend keeping it simple so you do not need a huge number of architectural libraries which you all need to learn.

我建议保持简单,这样你就不需要大量的建筑库,你们都需要学习它们。

#4


Maybe you should take a look at CaptainCasa - I once saw this on the JAX conference. They seem to provide a nice-looking Swing client, but handle all the logic stuff on the backend. I have no personal experience with the product, but from what they presented it looked quite interesting for "dumb" clients.

也许你应该看看CaptainCasa - 我曾经在JAX会议上看过这个。他们似乎提供了一个漂亮的Swing客户端,但处理后端的所有逻辑内容。我没有这个产品的个人经验,但从它们呈现的内容看起来对于“愚蠢”的客户来说非常有趣。

#5


An application server will probably be the easiest solution. You might consider creating a RESTful api on the server side, which can be done with spring on an application server. Then you can use a simple http client library on the client side.

应用程序服务器可能是最简单的解决方案。您可以考虑在服务器端创建RESTful api,这可以通过应用程序服务器上的spring来完成。然后,您可以在客户端使用简单的http客户端库。

#1


I think I'm pretty much in the same situation like yours. I'm planning to go ahead with Swing + Spring + JPA. The remoting shall be done through Spring Http Invoker. The only downside is you need a servlet container like Tomcat or Jetty to route the http requests to the Spring beans. But servers like winstone (which Hudson CI use) are quite lightweight and can be embedded in the application.

我想我和你的情况差不多。我打算继续使用Swing + Spring + JPA。远程处理应通过Spring Http Invoker完成。唯一的缺点是你需要一个像Tomcat或Jetty这样的servlet容器来将http请求路由到Spring bean。但像winstone这样的服务器(Hudson CI使用的)非常轻巧,可以嵌入到应用程序中。

Having a Spring back-end will mean that you don't need an application server. But should you need an application server in future, Spring can seamlessly support that as well.

拥有Spring后端意味着您不需要应用程序服务器。但是,如果您将来需要应用程序服务器,Spring也可以无缝支持它。

#2


An application server is an over kill if you are not using the features provided. If your application have only JSP and Servlets then Tomcat is a better choice. If using EJBs then you need an application server like Jboss.

如果您没有使用提供的功能,应用程序服务器就会被过度杀死。如果您的应用程序只有JSP和Servlet,那么Tomcat是更好的选择。如果使用EJB,则需要像Jboss这样的应用程序服务器。

First thing you have to decide is how your swing client will interact with your server. Are you going to use HTTP protocol, EJB lookup, simple RMI, etc?

首先要确定的是你的swing客户端如何与你的服务器进行交互。您打算使用HTTP协议,EJB查找,简单的RMI等吗?

If your client will be used by people who sits outside of your server network then you should use HTTP protocol so Servlets are the best choice. You can expose your server as webservice as well. If the client users are in the server network then you can use anything like EJB or socket programming or even http here as well.

如果您的客户端将由位于服务器网络之外的人使用,那么您应该使用HTTP协议,因此Servlet是最佳选择。您也可以将服务器公开为webservice。如果客户端用户在服务器网络中,那么您可以使用EJB或套接字编程等任何内容,甚至也可以使用http。

You can certainly use Spring in your server and client. Spring is a big framework, you need to decide what features you want to utilize. Spring can be used in servlet environment, EJB environment or any other environment.

您当然可以在服务器和客户端中使用Spring。 Spring是一个很大的框架,您需要决定要使用哪些功能。 Spring可以在servlet环境,EJB环境或任何其他环境中使用。

#3


http is a good but simple protocol which probably can do what you need.

http是一个很好但很简单的协议,可能会做你需要的。

To get inspired, try playing with the Jetty server (an alternative to Tomcat) - it has a simple Ajax based chat client as one of the demo applications which might be a basis for whatever you need to do.

要获得灵感,请尝试使用Jetty服务器(Tomcat的替代方案) - 它有一个简单的基于Ajax的聊天客户端作为演示应用程序之一,它可能是您需要做的任何事情的基础。

Get version 6 from http://dist.codehaus.org/jetty/jetty-6.1.19/

从http://dist.codehaus.org/jetty/jetty-6.1.19/获取版本6

I would recommend keeping it simple so you do not need a huge number of architectural libraries which you all need to learn.

我建议保持简单,这样你就不需要大量的建筑库,你们都需要学习它们。

#4


Maybe you should take a look at CaptainCasa - I once saw this on the JAX conference. They seem to provide a nice-looking Swing client, but handle all the logic stuff on the backend. I have no personal experience with the product, but from what they presented it looked quite interesting for "dumb" clients.

也许你应该看看CaptainCasa - 我曾经在JAX会议上看过这个。他们似乎提供了一个漂亮的Swing客户端,但处理后端的所有逻辑内容。我没有这个产品的个人经验,但从它们呈现的内容看起来对于“愚蠢”的客户来说非常有趣。

#5


An application server will probably be the easiest solution. You might consider creating a RESTful api on the server side, which can be done with spring on an application server. Then you can use a simple http client library on the client side.

应用程序服务器可能是最简单的解决方案。您可以考虑在服务器端创建RESTful api,这可以通过应用程序服务器上的spring来完成。然后,您可以在客户端使用简单的http客户端库。