使用基于 Java 的客户端实现的最简单的应用程序服务器是什么?

发布于 2024-09-24 11:53:10 字数 824 浏览 2 评论 0原文

简介

本学期我们有一个项目要设计和实施。对于我们的项目,我们选择为客户创建一个使用 Android 手机的库存系统。 有关该项目部分的更多信息

问题

我们遇到的下一个问题是,我们要设计某种中间服务器来验证用户身份并规范向数据库发出哪些命令——换句话说,是一个应用程序服务器。

我们的时间有点有限(尤其是这个学期的这个项目),我们意识到这种问题已经被比我们聪明得多的人解决了。

到目前为止我们的想法

正如标题所说,使用基于 Java 的客户端实现的最简单的应用程序服务器是什么?目前,我们这个项目有 3 个独立的客户端:一个工作站(运行 Windows XP)、一部 Android 手机和一个 Web 界面。

Ruby on Rails 服务器将用于 Web 界面。在与我的一位教授交谈后,他提到我们实际上可以通过 HTTP 和 XML 进行通信,使用 RoR 充当应用程序服务器。这将简化整个应用程序的开发,因为我们可以同时编写 Web 界面和应用程序服务器的代码。

我们的另一个选择是 JBoss 或 GlassFish(或者是吗?我们在这方面确实没有经验)。虽然我们可以轻松创建 Java 客户端,但我们还没有深入研究 JBoss/GlassFish 之类的东西。

我们愿意花时间去学习技术,但是我们想知道该使用哪种技术,然后才能在一个月前发现是因为我们使用了错误的应用服务器。

任何指导将不胜感激,提前谢谢您。

Intro

We have a project to design and implement this semester. For our project, we chose to create an inventory system that uses Android phones for clients. More information on that portion of the project.

The Problem

The next problem that we have run into is that we are to design some kind of intermediary server that authenticates users and regulates what commands are issued to the database -- in other words, an application server.

We are a bit constrained for time (especially this semester with this project) and we realize that this kind of a problem has already been solved by people much smarter than us.

Our Ideas So Far

As the title says, what is the easiest application server to implement with Java-based clients? We currently have 3 separate clients for this project: a workstation (running Windows XP), an Android phone and a web-interface.

A Ruby on Rails server will be used for the web-interface already. After talking with one of my professors, he mentioned that we could actually use RoR to act as the application server by communicating through HTTP and XML. This would simply the development of the entire application since we could code the web-interface and the application server along side each other.

Our other option is something like JBoss or GlassFish (or is it? We really aren't experienced in this area). While we are comfortable creating Java clients, we haven't delved into something like JBoss/GlassFish in the slightest bit.

We're willing to spend the time to learn the technology, but we want to know which technology to use before we find out a month before it's due that we used the wrong application server.

Any guidance would be greatly appreciated, thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花开柳相依 2024-10-01 11:53:10

我建议使用 RoR 的 JSON 或 XML 以及 REST 风格的 API。 XML 是 JSON 的不错替代品。我不会为 JBOSS 等烦恼——这太过分了。有时,当人们说 HTTP 和 XML 时,他们也指 SOAP,我也认为这有点矫枉过正。如果是基于 REST 的 XML,那就没问题。

只需一个简单的基于 URL 的 API 就很容易实现,并且足以满足学校项目的需要。

I would suggest JSON or XML and a REST-style API using RoR. XML is an ok replacement for JSON. I wouldn't bother with JBOSS, etc -- it's overkill. Sometimes when people say HTTP and XML, they also mean SOAP, which I also think will be overkill. If it's XML over REST, then that's fine.

Just a simple URL based API is easy to implement and sufficient for a school project.

我为君王 2024-10-01 11:53:10

使用像 Glassfish 这样的 EJB 3.1 容器,公开 EJB 实际上非常容易通过 REST/JSON 接口的方法:

@Path("/orders/")
@Stateless public class OrderService {

    @EJB BillingService billing;
    @EJB DeliveryService delivery;
    @EJB Warehouse warehouse;

    @PUT
    @Produces({"application/xml","application/json"})
    @Consumes({"application/xml","application/json"})
    public Order order(Order newOrder){
        Order order = warehouse.checkout(newOrder);
        billing.payForOrder(order);
        delivery.deliver(order);
        return order;
    }

    @GET
    @Path("{orderid}/")
    @Produces({"application/xml","application/json"})
    public Order status(@PathParam("orderid") long orderId){
       return delivery.status(orderId);
    }
}

基本上,容器会为您完成所有工作。唯一的问题是,许多非常复杂的事情在幕后进行,如果出现任何问题或者您需要的不仅仅是简单的功能,那么您将面临相当陡峭的学习曲线。但是,同样的情况也适用于 Ruby on Rails 背后的所有元编程魔法。

With an EJB 3.1 container like Glassfish, It's actually amazingly easy to expose EJB methods via a REST/JSON interface:

@Path("/orders/")
@Stateless public class OrderService {

    @EJB BillingService billing;
    @EJB DeliveryService delivery;
    @EJB Warehouse warehouse;

    @PUT
    @Produces({"application/xml","application/json"})
    @Consumes({"application/xml","application/json"})
    public Order order(Order newOrder){
        Order order = warehouse.checkout(newOrder);
        billing.payForOrder(order);
        delivery.deliver(order);
        return order;
    }

    @GET
    @Path("{orderid}/")
    @Produces({"application/xml","application/json"})
    public Order status(@PathParam("orderid") long orderId){
       return delivery.status(orderId);
    }
}

Basically, the container does all the work for you. The only problem is that a lot of very complex stuff goes on behind the curtains, and if anything goes wrong or you need more than the straightforward functionality, you're up for rather steep learning curve. But then, the same can be said about all the metaprogramming magic behind Ruby on Rails.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文