Tuesday, November 29, 2011

GWT with JAX-RS (aka RPC/REST) Part 0 (preamble ramble)

This is a preamble ramble about deploying REST with GWT. To skip this GWT/REST advertisement, you should proceed to the next post.

What is the purpose of deploying REST when GWT-RPC suffices? Why REST with GWT?

There is an oft cited motivation for doing REST.
  • so that you could reimplement your client using Fortran, Cobol, PHP, Python, other whatnots.
  • OTH, so that you could reimplement your server using the above stated whatnots.

Honestly, those are insufficient excuses to do REST with GWT. The purpose of having a door on your house is not "so that I could have many locks on the door". Being able to have many locks is not the direct motivation, but is simply an enabler. Therefore, the above reasons combined with the following  reasons complete the motivation why you should deploy REST instead of GWT-RPC or XML-RPC or SOAP.
  • Scalability = Mashup-ability - multi-providers, multi war, application mash-up scenarios.
  • Scalability - loose coupling between client and server.
  • Visibility = Debugability - knowing exactly the data formats and schemata that are passed between client and server.
  • Standards = Visibility - I have no idea how to decode the transported data in GWT-RPC; however, JAX-RS allows you to employ established standards of JSON and XML object schemata - namely, Jackson JSON and JAX-B XML have become popular modes of object schemata.
  • Flexibility and Simplicity = Plugin-ability - loose coupling and visibility promote ease of development, enhancement and maintenance.
  • Flexibility and Simplicity does ensure that your application can be reimplemented in a more capable future language that would one day replace Java's popularity as a business enterprise language - just as Java had replaced Cobol. It's good to plan in advance for future contingencies - but having many locks is not the motivation for having a door.
  • Diversity and MVP-friendly - you could have a diversity of clients: Desktop heavy clients such as Swing, non-ASP .NET, Qt and light clients such as GWT, Qt. Qt is an interesting technology in that the same C++ code can be recompiled on Linux, Windows, and various mobile devices.
  • Agile - Visibility, Simplicity and Flexibility allows rapid prototyping using scripts, Fiddler2 (or its FireFox equivalent), to be replaced by proper Java code when the DTO and SAPI hierarchies become more complex and entwined.
  • Agile - allow a mishmash of services written mostly in Java but supplemented with script-based service providers.
  • Simplicity, Diversity, Flexibility, Scalability, Mashup-ability = Agile and gradual technology renewal. When it is time to upgrade any part of your service framework, a RESTful implementation would allow you to do it piece-meal. 
  • Bookmarkability. This is the strongest motivation in many projects to use REST. When a bank sends you an email letting you reset your password, it is probably a URL link to a REST service. REST APIs are convenient as bookmarks and actions links. For example, your grandma does not know how to update her profile but she asks you to do it for her. Fortunately that particular web site operates on REST. So you crafted a URL and mailed/skyped it to her, telling her to click on the link after logging in to her account she wishes to update.
  • RPC-ability. I don't think it is a hyperbole to say that many, if not most, RPC and XML-RPC proponents do not realise that REST can function as RPC. In fact, this series of posts focus on using REST as the RPC mechanism.
  • XMLRPC-ability. Using the right framework, REST is XMLRPC+the advantages of REST.
  • Terminologically SOAP - If you have used SOAP (Simple Object Access Protocol), you would agree that SOAP is a total misnomer because SOAP is not simple. Technically, REST is the actual simple object access protocol.

As long as your services or JEE server contexts reside within the same SLD-SOP restriction, REST would allow your GWT application to subscribe to multiple independently deployed server-side services. In fact, most enterprise GWT apps would need to subscribe to multiple independent services. For one, logging-in and user authentication should be a service of its own. Especially when you are using OAuth or OpenID.

You should see that GWT-RPC by itself is ill-equipped as a proper enterprise level enabler. GWT-RPC constrains you to only one service provider - the same service that serves the GWT UI itself has to serve the RPC service. Whereas REST would allow your GWT UI to communicate with another application context (i.e., deployed on a different war).

And then, if your service is on a different SLD origin, you could write a simple http proxy to forward-the-request/return-the-response, which invariably would run on its own war. In ancient terminology, a HTTP tunnel.


Continue next GWT with JAX-RS (aka RPC/REST) Part 1

15 comments:

  1. Nuevo autor: ¿Quieres vivir casi Melo ganando nuestra experiencia sin duda trascendente? Mi compañero y yo somos un formidable dispositivo en caso de que Le Bron steve también Kobe Camisetas Baratas De Futbol Bryant sea un tonto camisetas de futbol comprar excelente. Confío en Carmelo Anthony para obtener una temporada de competencia MVP con estos Nuggets. Transmitir que hemos sido testigos de lo mejor de Melo es totalmente irrazonable.

    ReplyDelete
  2. Replies
    1. La Nike Air Max Mujer se ha convertido en una locura internacional durante mucho tiempo.
      En los últimos tiempos, muchas marcas han lanzado su colección de Camisetas Nba 2018.
      Hay tanto camisetas caras y camisetas baratas, especialmente la Camisetas Nba Baratas.
      Con el número creciente de fanáticos locos, la Camisetas Nba no solo está pensada para los jugadores.
      Las tiendas de deportes pueden querer Comprar Camisetas De Futbol.
      Para las tiendas, puede comprar Camisetas De Futbol Baratas de China y otros países a bajo precio.
      Estos Camisetas De Futbol Baratas están hechos a medida y diseñados para dar el mejor ajuste.
      La mejor forma de Comprar Camisetas De Futbol es buscar en nuestra auténtica tienda en línea.

      Delete
  3. Uno de los estilos más populares hechos por mk hoy es el Bolsos Michael Kors Rebajas. El Bolsos Michael Kors Baratos es un estilo clásico y funcional que las mujeres aman. Bolsas Michael Kors Outlet de materiales de calidad con artesanía detallada. Con todas estas ventajas, no es de extrañar que los bolsos michael kors baratos sean tan populares. Este bolsos michael kors rebajas es un bolso estilo embrague que es más tradicional en su diseño.

    Denna MK Väska kan bära böcker om du är en student och alla dina hemma arbeten om du har gått in i arbetslivet. Michael Kors Väska Rea gör också en påse stil väska och en swing stil. Väskor Michael Kors Rea har utökat sin linje för att inkludera en mängd tillbehör som inkluderar plånböcker, nyckelkedjor, kortväskor, checkbooköverdrag och kameratäckar. michael kors väska rea erbjuder också en fransk handväska och mini plånbok. michael kors väska har blivit känd som en kvalitetsdesigner som tillverkar en kvalitetsprodukt.

    Posséder un Longchamp Soldes Destockage n'est pas simplement une déclaration de mode. Toute femme intéressée par la qualité, la fonctionnalité et l’accessibilité financière devrait envisager un Sac Longchamp Bandouliere. Sac A Main Pas Cher, l’une des gammes de sacs à main et d’accessoires les plus populaires sur le marché à ce jour, propose une vaste gamme de produits longchamp soldes destockage. Puisque longchamp est si populaire, les sac longchamp pas cher sont souvent copiés.

    ReplyDelete
  4. Ray Ban Sunglasses Sale Uk are prepping for that fashionable holiday.
    Ray Ban Sale Uk are in the savvy eye of the stylish beholder.
    Ray Ban Sunglasses Sale Uk are much cheaper than you would pay in a regular store.
    Sunglasses UK meant for women are slightly different from men' varieties, so when you are choosing sun glasses for the women, you should keep in mind certain factors.
    Oakley Sunglasses Sale are very functional and known as spy sunglasses, because they are meant for recording videos and images.
    Cheap Oakley Sunglasses also offer polarization feature of the lens.

    ReplyDelete