Difference between revisions of "GxRest"

From Gcube Wiki
Jump to: navigation, search
(Module: gxHTTP)
Line 10: Line 10:
  
 
== Module: gxHTTP ==
 
== Module: gxHTTP ==
[[gxHTTP|gxHTTP]] defines the HTTP interface for a client of a gCube service and basic extensions to plain HTTP requests with zero-dependencies.  
+
[[GxRest/GxHTTP|gxHTTP]] defines the HTTP interface for a client of a gCube service and basic extensions to plain HTTP requests with zero-dependencies.  
 
More specifically, it help create context-aware requests sent from a client to a web application. No support for managing responses both at service and client side is provided.
 
More specifically, it help create context-aware requests sent from a client to a web application. No support for managing responses both at service and client side is provided.
  

Revision as of 03:05, 2 April 2019

Goals and Principles

The gCube eXtensions to the Rest Protocol (gxRest) is set if Java libraries designed to provide convenient round-trip interaction between a Restful web application (also known as "service") and its clients.

Exploitation

gxRest has the flexibility for different degrees of exploitation of the library:

  • it can be entirely adopted both at client and service side with full benefit of its conventions;
  • it can be used just to send REST requests based only on plain HTTP;
  • it can be used to parse the HTTP code of a response;
  • it can be used only to return HTTP codes from the service.

Module: gxHTTP

gxHTTP defines the HTTP interface for a client of a gCube service and basic extensions to plain HTTP requests with zero-dependencies. More specifically, it help create context-aware requests sent from a client to a web application. No support for managing responses both at service and client side is provided.

Module: gxJRS

gxJRS is much more advanced than gxHTTP and offers fully-fledged extensions built on top of JAX-RS and gxHTTP.

Prominent features of gxJRS are:

  • to achieve independence from the web framework used to develop the web application;
  • to guarantee the correctness of requests/responses across the D4Science infrastructure;
  • to abstract over the HTTP-based details required by the gCube framework when invoking a remote service;
  • to avoid that each service implements its own conventions over the returned responses;
  • to return error responses at the familiar (for any Java programmer) level of exceptions and error codes, while web frameworks usually just let return an HTTP status, headers and streams.

Integration with the client libraries of FWS

gxRest smoothly integrates with the client libraries (common-jaxrs-client, common-clients) of the FeatherWeight Stack by providing a request (GXWebTargetAdapterRequest) fully compatible with javax.ws.rs.client.WebTarget. The integration is described in a dedicate section of the request page.