开发者

What is the easiest application server to implement with Java-based clients?

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 prof开发者_开发知识库essors, 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜