23.08.2015 Views

Here - Agents Lab - University of Nottingham

Here - Agents Lab - University of Nottingham

Here - Agents Lab - University of Nottingham

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

REST methods is not directly possible or the ideal result. 3 Hence, the idea is toallow a very exible mapping between both kinds <strong>of</strong> representations. In general,three dierent types <strong>of</strong> mappings are supported ranging from fully automatic,over semi automatic with additional mapping information to completely manualdescriptions. Mapping information that needs to be generated encompassesthe set <strong>of</strong> methods that should be published and for each method the followinginformation: URL: i.e. the address that can be used to reach the service method. Typically,the URL <strong>of</strong> a service method is composed <strong>of</strong> two sections. The rstsection refers to the service itself and the second section refers to the method.This scheme treats methods as subresources <strong>of</strong> the service resource. In casemultiple methods with the same name but dierent signatures exist it hasto be ensured that dierent URLs are produced. Consumed and produced media types: REST services are intended to beusable from dierent clients such as browsers or other applications. Theseclients may produce and consume dierent media types such as plain text,XML or JSON. The REST service can be made accepting and producingdierent media types without changing the service logic by using data converterslike JAXB for XML and Jackson 4 for JSON. The conversions fromand to the transfer formats are done automatically via the REST containerinfrastructure respecting the given media types. Parameter types: i.e. the parameter types the rest service expects and thereturn value type it produces. In the simplest case these types directly correspondto the object oriented parameter types <strong>of</strong> the underlying serviceinterface but <strong>of</strong>ten RESTful APIs intend to use basic string parameters inthe URL encoded format <strong>of</strong> HTTP. If there is a mismatch between the objectoriented and the RESTful interface, parameter mappers can be employedthat transparently mask the conversion process. It has to be noted that thetransformation <strong>of</strong> parameter values is n:m, meaning that n input values <strong>of</strong>the component service need to be mapped to m parameters <strong>of</strong> the REST service.Therefore, it has to be ensured that as well more than less parameterscan be generated from the incoming value set. Parameter type generation isdone in addition to conversions with regard to the consumed and producedmedia types. HTTP method type: REST denes specic meanings for HTTP methodtypes like put, get, post, delete that roughly correspond to the CRUD (create,3It has to be noted that characteristics like stateless interactions and cacheability,which are <strong>of</strong>ten associated with REST services, do not render REST useless forimplementing multi-agent interactions. First, the web resources in REST are statefulbeing subject <strong>of</strong> creation, manipulation and deletion. Second, cacheability meansthat operations should be idempotent, which is achieved when e.g. mapping parts<strong>of</strong> an interaction protocol to the HTTP request types GET and HEAD. Given thatfor each stateful interaction a new REST resource is created both properties can bepreserved.4 http://jackson.codehaus.org/28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!