PA165/Lab session Webservices REST

Verze z 25. 11. 2013, 16:01; (diskuse | příspěvky)

(rozdíl) ← Starší verze | zobrazit aktuální verzi (rozdíl) | Novější verze → (rozdíl)
Přejít na: navigace, hledání

Developing RESTful webservices with Jersey

During this lab we will see how to create, and access a REST webservice by using the Jersey framework ([1]). Jersey provides support for JAX-RS APIs, providing further functionalities to simplify the development of RESTful webservices.

Just as a reminder, REpresentational State Transfer (REST) is defined as a set of architectural patterns that design web services based on resources. A RESTful webservice (compliant to REST principles) has the following characteristics:

  • Uses HTTP methods explicitly
  • Is stateless
  • It exposes URIs as directory structures to manage resources
  • Allows the transferral of XML and/or JavaScript Object Notation (JSON) formats

What is needed for the current lab:

Create a new project of type Maven - Web Application, named rest-jersey-server configured to be run under Tomcat. Add to the pom.xml file:

            <!-- if your container implements Servlet API older than 3.0, use "jersey-container-servlet-core"  -->
        <!-- Required only when you are using JAX-RS Client -->
            <!-- Java language version -->
            <!-- Servlet 3.0 without web.xml -->