SlideShare una empresa de Scribd logo
1 de 60
Descargar para leer sin conexión
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Novelties in Java™ EE 7: JAX – RS 2.0 
Trayan Iliev 
IPT – Intellectual Products & Technologies 
e-mail: tiliev@iproduct.org 
web: http://www.iproduct.org 
Oracle®, Java™ and JavaScript™ are trademarks or registered trademarks of Oracle and/or its affiliates. 
Other names may be trademarks of their respective owners. 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 1 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Agenda I 
Service Oriented Architecture (SOA), REST & HATEOAS 
Richardson Maturity Model of Web Applications 
IPT Proposal: Separation of Query & Command Representations & 
dynamically generated meta-data for RESTful resources 
Novelties in Java™ EE 7: Java API for RESTful Web Services – 
JAX-RS 2.0 (JSR 339) 
Standardized REST Client API; 
Client-side and server-side asynchronous HTTP request processing 
Integration of declarative validation of resources, response entities, 
method parameters, and fields using JSR 349: Bean Validation 1.1 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 2 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Agenda II 
Improved server-suggested content negotiation in addition to that 
suggested by client 
Aspect-oriented extensibility of request/response processing using 
Filters (non wrapping) and Interceptors (wrapping) client and server 
extensions 
Dynamic extension registration using DynamicFeature interface; 
Hypermedia As The Engine Of Application State (HATEOAS) REST 
architectural constraint support using state transition links (support 
for new HTTP Link header as well as JAXB serialization of resource 
links). 
Let's try it (IPT Polling Demo + hands-on) 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 3 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Question 1 
How many people know what 
REST means? 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 4 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Question 2 
How many know what HATEOAS 
stays for? 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 5 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Question 3 
How many people have 
developed at least one RESTful 
service with JAX-RS? 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 6 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Software Architecture – Definitions [1] 
Almost everybody feels at peace with nature: listening to the ocean 
waves against the shore, by a still lake, in a field of grass, on a 
windblown heath. One day, when we have learned the timeless way 
again, we shall feel the same about our towns, and we shall feel as 
much at peace in them, as we do today walking by the ocean, or 
stretched out in the long grass of a meadow. 
— Christopher Alexander, The Timeless Way of Building (1979) 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 7 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Software Architecture – Definitions [2] 
According to Dr. Roy Thomas Fielding [Architectural Styles and 
the Design of Network-based Software Architectures, 2000]: 
A software architecture is an abstraction of the run-time 
elements of a software system during some phase of its 
operation. A system may be composed of many levels of 
abstraction and many phases of operation,each with its own 
software architecture. 
A software architecture is defined by a configuration of 
architectural elements - components, connectors, and data - 
constrained in their relaionships in order to achieve a desired set 
of architectural properties. 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 8 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Software Architecture – Definitions [3] 
According to Dr. Roy Thomas Fielding [Architectural Styles and 
the Design of Network-based Software Architectures, 2000]: 
An architectural style is a coordinated set of architectural 
constraints that restricts the roles/features of architectural 
elements and the allowed relationships among those elements 
within any architecture that conforms to that style. 
The primary distinction between Network-based architectures 
and software architectures in general is that communication 
between components is restricted to message passing, or the 
equivalent of message passing if a more efficient mechanism can 
be selected at runtime based on the location of components. 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 9 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Architectural Properties 
According to Dr. Roy Thomas Fielding [Architectural Styles and 
the Design of Network-based Software Architectures, 2000]: 
Performance 
Scalability 
Reliability 
Simplicity 
Extensibility 
Dynamic evolvability 
Cusomizability 
Configurability 
Visibility 
All of them should be present in a desired Web Architecture 
and REST architectural style tries to preserve them by 
consistently applying several architectural constraints 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 10 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Service Oriented Architecture (SOA) – 
Definitions 
Thomas Erl: SOA represents an open, agile, extensible, 
federated, composable architecture comprised of autonomous, 
QoS-capable, vendor diverse, interoperable, discoverable, and 
potentially reusable services, implemented as Web services. SOA 
can establish an abstraction of business logic and technology, 
resulting in a loose coupling between these domains. SOA is an 
evolution of past platforms, preserving successful characteristics 
of traditional architectures, and bringing with it distinct principles 
that foster service-orientation in support of a service-oriented 
enterprise. SOA is ideally standardized throughout an enterprise, 
but achieving this state requires a planned transition and the 
support of a still evolving technology set 
References: Erl, Thomas. Serviceorientation.org – About the Principles, 2005–06 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 11 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
SOA == SOAP + WSDL? 
Web Services are: 
Semantic 
Models 
components for building distributed 
applications in SOA architectural style 
communicate using open protocols 
are self-descriptive and self-content 
can be searched and found using 
UDDI or ebXML registries (and more 
recent specifications – WSIL & 
Semantic Web Services) 
Mapping 
WSDL 
Messages 
Source: http://en.wikipedia.org/wiki/File:Webservices.png, Author: H. Voormann 
License: Creative Commons Attribution 3.0 Unported 
WSDL 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 12 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Service Oriented Architecture (SOA) 
Java EE 6 
Architecture 
Source: http://en.wikipedia.org/wiki/File:SO A_Detailed_Diagram.png, 
Author: JamesLWilliams2010, License: Creative Commons Attribution 3.0 Unported 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 13 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
SOA Implemetation - Java SE/EE 7 APIs 
According to Java™ EE Specification: 
Web Services (SOAP) 
Java API for XML Web Services (JAX-WS) 
Java Architecture for XML Binding (JAXB) 
SOAP with Attachments API for Java (SAAJ) 
Java API for XML Registries (JAXR) 
RESTful Web Services 
Java API for RESTful Web Services - JAX-RS 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 14 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Representational State Transfer (REST) [1] 
REpresentational State Transfer (REST) is an architecture 
for accessing distributed hypermedia web-services 
The resources are identified by URIs and are accessed and 
manipulated using an HHTP interface base methods (GET, 
POST, PUT, DELETE, OPTIONS, HEAD, PATCH) 
Information is exchanged using representations of these 
resources 
Lightweight alternative to SOAP+WSDL -> HTTP + Any 
representation format (e.g. JavaScript™ Object Notation – 
JSON) 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 15 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Representational State Transfer (REST) [2] 
Identification of resources – URIs 
Representation of resources – e.g. HTML, XML, JSON, etc. 
Manipulation of resources through these representations 
Self-descriptive messages - Internet media type (MIME type) 
provides enough information to describe how to process the 
message. Responses also explicitly indicate their cacheability. 
Hypermedia as the engine of application state (aka HATEOAS) 
Application contracts are expressed as media types and 
[semantic] link realtions (rel attribute - RFC5988, "Web Linking") 
[Source: http://en.wikipedia.org/wiki/Representational_state_transfer] 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 16 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Advantages of REST 
Scalability of component interactions – through layering the client 
server-communication and enabling load-balancing, shared 
caching, security policy enforcement; 
Generality of interfaces – allowing simplicity, reliability, security 
and improved visibility by intermediaries, easy configuration, 
robustness, and greater efficiency by fully utilizing the 
capabilities of HTTP protocol; 
Independent development and evolution of components, 
dynamic evolvability of services, without breaking existing 
clients. 
Fault tolerat, Recoverable, Secure, Loosely coupled 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 17 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Richardson's Maturity Model of Web Services 
According to Leonard Richardson [Talk at QCon, 2008 - 
http://www.crummy.com/writing/speaking/2008-QCon/act3.html]: 
Level 0 – POX: Single URI (XML-RPC, SOAP) 
Level 1 – Resources: Many URIs, Single Verb (URI Tunneling) 
Level 2 – HTTP Verbs: Many URIs, Many Verbs (CRUD – e.g 
Amazon S3) 
Level 3 – Hypermedia Links Control the Application State = 
HATEOAS (Hypertext As The Engine Of Application State) 
=== truely RESTful Services 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 18 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Is There A Level 4 for WebApp Maturity? 
Considerations: 
Command Query Responsibility Segregation (CQRS): 
http://martinfowler.com/bliki/CQRS.html (gentle introduction by 
Martin Fowler) & ReportingDatabases: 
http://martinfowler.com/bliki/ReportingDatabase.html 
A single representation type can not be optimal for both 
reading (Query) and updating the application state 
(Command) 
We may prefer to model Query and Command as separate 
resources / representation types 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 19 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
What About Meta-Data? 
Very important for a RESTful applications where resources and 
resource states are dynamically discoverable / changeable 
But what we have? 
For SOAP services there is a WSDL (XML Schema based data 
type descriptions) 
REST should have the same -> Welcome WADL ! 
But is it really a good thing to have a static description of 
dynamically changeable resources and valid resource state 
change transitions? 
Static model can be evil in a Live World! 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 20 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Web Application Description Language (WADL) 
XML-based file format providing machine-readable description 
of HTTP-based web application resources – typically RESTful 
web services 
WADL is a W3C Member Submission 
Multiple resources 
Inter-connections between resources 
HTTP methods that can be applied accessing each resource 
Expected inputs, outputs and their data-type formats 
XML Schema data-type formats for representing the RESTful 
resources 
But WADL resource description is static ... let's make it 
dynamic! 
Източник: http://en.wikipedia.org/wiki/File:Webservices.png, автор: H. Voormann 
Лиценз: Creative Commons Attribution 3.0 Unported 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 21 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
The New Kids on the Block: JSON, JSON Schema & 
Hyper Schema, Microformats 
There are good use cases for WADL (REST resource metadata 
descriptions): automatic generation of client code & functional 
REST service tests, client data validation, building of generic 
REST clients. 
WADL is XML (and relies on XML Schema Definitions) – this is 
a limitation for JavaScript Clients 
Welcome JSON Schema & JSON Hyper-Schema ! 
But there are also Microformats (XHTML Meta Data Profiles – 
XMDP): e.g. hCard, hReview, hProduct, hCalendar ... 
Talking about meta-data: W3C Resource Description 
Framework (RDF) and Web Ontology Language (OWL) 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 22 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Metadata-Representations Proposal (& Questions) 
Meta-data can be very useful for generic REST clients and 
agents crawling the Web! 
Meta-data should be dynamically generated 
... but can be more stable than the data it describes 
Separation of data and meta-data representations (different 
life-cycles – allows optional retrieval, caching) 
Meta-data should be dynamically discoverable using hyper 
links in resource representations (rel= type/ describedby/ lrdd?) 
Separation of Command and Query representations -> 
optimal representations for each task (possibly with separate 
MIME types – application/vnd.*+json/xml?) 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 23 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Java API for RESTful Web Service (JAX-RS 2.0) 
Allows modelling (and more importantly decoupling) of RESTful 
resource controllers, models and representations – enables 
HATEOAS: Level 3 in Richardson WebApp Maturity Model 
Resource Controllers are modelled as Plain Old Java Objects 
(POJO) + declarative annotations mapping HTTP request & 
response URIs / Headers / Body / Parameters / Cookies/ to 
Java Classes / Methods / Method Arguments / Sub-resources 
Models are again POJO + (eventually) some XML / JSON 
mapping annotations – e.g. JAX-B / Jackson / Jettison / MOXy 
Representations – custom HATEOAS resource 
representations can be easily build using provided Link class 
and @XmlJavaTypeAdapter(JaxbAdapter.class) annotation 
Източник: http://Licensed en.wikipedia.under org/the wiki/Creative File:Commons Webservices.Attribution-png, автор: NonCommercial-H. Voormann 
NoDerivs 3.0 Slide 24 
Лиценз: Creative Unported Commons License 
Attribution 3.0 Unported
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Java API for RESTful Web Service (JAX-RS) 
Packages: javax.ws.rs, javax.ws.rs.core, javax.ws.rs.ext 
Basic annotations: 
@Path 
@PathParam 
@QueryParam 
@FormParam 
@HeaderParam 
@CookieParam 
@MatrixParam 
@DefaultValue 
@Encoded 
@Produces 
@Consumes, 
@HttpMethod 
@GET 
@POST 
@PUT 
@DELETE 
@Provider 
@Context 
Източник: http://en.wikipedia.org/wiki/File:Webservices.png, автор: H. Voormann 
Лиценз: Creative Commons Attribution 3.0 Unported 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 25 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Implementing REST Resources using JAX-RS [1] 
@Stateless 
@Path("courses") 
@TransactionManagement(TransactionManagementType.BEAN) 
public class CoursesResource extends 
AbstractFacade<Course> { 
@PersistenceContext(unitName = "IPTCourseManagerPU") 
private EntityManager em; 
@Context 
private UriInfo context; 
@Resource 
UserTransaction utx; 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 26 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Implementing REST Resources using JAX-RS [2] 
@POST 
@Consumes({"application/json", "application/xml"}) 
public Response createCourse(Course entity){ 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 27 
Unported License 
try { 
utx.begin(); 
super.create(entity); 
utx.commit(); 
return 
Response.created(UriBuilder.fromUri(context.getAbsolutePa 
th()).path(entity.getId().toString()).build()).build(); 
} catch (Exception ex) { 
throw new WebApplicationException(ex); 
} 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Implementing REST Resources using JAX-RS [3] 
@GET 
@Produces({"application/xml", "application/json"}) 
public CoursesRepresentation getAllCourses() { 
return new CoursesRepresentation(super.findAll()); 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 28 
Unported License 
} 
@Path("{id}") 
public CourseResource getCourseResource( 
@PathParam("id") Integer id) { 
return new CourseResource(id, em, utx); 
} 
Sub-resource
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Novelties in JAX-RS 2.0 by Example: 
IPT Polling Demo 
You can clone (or download) IPT RESTful Polling Demo at GitHub: 
https://github.com/iproduct/IPT-Polling-Demo-JAXRS20-HATEOAS 
The demo shows how to integrate multiple Java EE 7 technologies: 
EJB 3.1, CDI 1.1, JPA 2 + EclipseLink, JTA, Bean Validation. 
It is a Maven project and can be deployed as Web application 
(.WAR) or started from command line, as simple as: 
mvn embedded-glassfish:run (in project's root folder) 
I demonstrates also how to develelop functional/integration tests 
using embedded GlassFish 4 and maven-surefire / maven-failsafe 
plugins; to start the integration tests from command line: mvn verify 
There is also a project Wiki page discussing the details of the demo: 
https://github.com/iproduct/IPT-Polling-Demo-JAXRS20-HATEOAS/wiki 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 29 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
IPT Polling Demo Resources 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 30 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
IPT Polling Demo – Poll Resource States 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 31 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
IPT Polling Demo + Hands-on Exercises 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 32 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Proposed Architecture: 
jQuery Client + RESTful Backend 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 33 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Some Open Source WS Implementation Stacks 
Glassfish Metro – http://metro.java.net/ – JAX-WS (SOAP 
+ WSDL) Reference Implementation 
Glassfish Jersey – http://jersey.java.net/ – JAX-RS 
(JSR 311) Reference Implementation for building 
RESTful Web services 
RESTEasy – http://resteasy.jboss.org/ – JBoss JAX-RS 
implementation 
Apache CXF – http://cxf.apache.org/ – JAX-WS & JAX-RS 
Apache Axis 2 – http://axis.apache.org/axis2/java/core/ – 
SOAP & REST web services 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 34 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
JAX-RS 2.0: Standardized REST Client API 
Java Client API is important for: 
RESTful services integration – building composite RESTful 
services and server-side mashups 
Functional & integration testing of web applications – using JUnit/ 
TestNG for testing integration scenarios 
Load / Perfomance / Stress testing of REST services 
Building GUI clients – could utilize rich interface capabilities of 
Swing & Java FX 
Before Java EE 7 each of JAX-RS implementations had its 
own client API 
Now the client code can be standardized and portable between 
implementations 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 35 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Standardized REST Client API Example (1) 
public class PollsResourceTest { 
public static final String BASE_URI = 
"http://localhost:8080/polling/resources/polls"; 
private static WebTarget target; 
... 
@BeforeClass 
public static void setUpClass() { 
// Initialize base REST client and target 
URI uri = UriBuilder.fromUri(BASE_URI).build(); 
ClientConfig config = new ClientConfig(); 
Client client = ClientBuilder.newClient(config); 
target = client.target(uri); 
setupResources(); 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 36 
Unported License 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Standardized REST Client API Example (2) 
private static List<Poll> setupResources() { 
List<Poll> updatedPolls = Arrays.asList(SAMPLE_POLLS) 
.stream().map(poll -> { 
try{ 
Poll updatedPoll =target.request(APPLICATION_JSON) 
.post(Entity.entity(poll, APPLICATION_JSON), 
Poll.class); 
if(updatedPoll != null) 
forCleanup(updatedPoll); 
return updatedPoll; 
} catch (Exception e) { … } return null; 
}).collect(Collectors.toList()); 
return updatedPolls; 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 37 
Unported License 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Standardized REST Client API Example (3) 
@Test 
public void testGetAllPollsJSONReturnsNotNull() { 
List<Poll> allPolls = target.request(APPLICATION_JSON) 
.get(new GenericType<List<Poll>>(){}); 
assertNotNull(allPolls); 
} 
@Test 
public void testGetPollByIdReturns404ForNonexisitingResource() { 
Response resp =target.path(Long.toString(NONEXISTING_POLL_ID)) 
.request(APPLICATION_JSON).get(); 
assertEquals("Status code not 404", 404, resp.getStatus()); 
assertThat("Response does not contain espected string: '" , 
resp.readEntity(String.class), containsString( 
NONEXISTING_POLL_ID + " does not exist")); 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 38 
Unported License 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Asynchronous HTTP Request Processing 
Allows for efficient non-blocking concurrency 
Useful for long running business operations – e.g. DB queries 
AsyncResponse generation can be suspended till results are 
ready and then resumed 
Both client and server side APIs available 
Different types of callback listeners can be registered to 
suspended response on server side: 
ResumeCallback – onResume() method 
CompletionCallback – onComplete(), onError() methods 
ConnectionCallback – onDisconnect() method 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 39 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
AsyncResponse Main Methods 
boolean cancel(Date retryAfter) – cancels processing 
boolean isCancelled() - checks if processing canceled 
boolean isDone() - checks if processing finished 
Collection<Class<?>> register(Class<?> callback) 
Collection<Class<?>> register(Object callback) - register 
asynchronous processing callback 
boolean resume(Object response) – resume suspended resp. 
boolean resume(Throwable response) – resume + exception 
boolean setTimeout(long time, TimeUnit unit) – set timeout 
void setTimeoutHandler(TimeoutHandler handler) 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 40 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Asynch Server-Side Processing Example (1) 
@GET @Produces(value = {APPLICATION_XML, APPLICATION_JSON}) 
@Asynchronous 
public void getAllPolls(@Suspended final AsyncResponse 
asyncResponse) { 
asyncResponse.setTimeoutHandler( 
(AsyncResponse aResp) -> { 
if(isBusy()) aResp.resume( 
new WebApplicationException( 
"Server is too busy. Try again later.", 
SERVICE_UNAVAILABLE)); 
//aResp.cancel(300); 
else aResp.setTimeout(10, SECONDS); 
}); 
asyncResponse.setTimeout(10, TimeUnit.SECONDS); 
asyncResponse.resume(doGetAllPolls(selfLink)); 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 41 
Unported License 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Asynch Server-Side Processing Example (2) 
private static boolean isBusy() { 
return serverBusy; 
} 
private PollsRepresentation doGetAllPolls(Link selfLink){ 
return new PollsRepresentation( 
pollController.findPollEntities(), 
Arrays.asList(selfLink)); 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 42 
Unported License 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Asynch Client-Side Processing Example (1) 
protected List<Poll> setupResourcesAsync() throws 
InterruptedException, ExecutionException{ 
List<Future<Poll>> updateFutures = 
Arrays.asList(SAMPLE_POLLS).stream() 
.map(poll -> { 
Future<Poll> updateFuture = 
target.request(APPLICATION_JSON) 
.async() 
.post(Entity.entity(poll, APPLICATION_XML), 
new InvocationCallback<Poll>(){ 
@Override public void completed(Poll updatedPoll) { 
forCleanup(updatedPoll); } 
@Override public void failed(Throwable throwable) {} 
}); 
return updateFuture; }).collect(Collectors.toList()); 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 43 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Asynch Client-Side Processing Example (2) 
do{ 
Thread.sleep(100); 
} while(!updateFutures.stream() 
.allMatch((Future<Poll> fp) -> fp.isDone())); 
//return collected results 
List<Poll> results = new ArrayList<>(); 
for(Future<Poll> fp: updateFutures){ 
Poll resPoll = fp.get(); 
if(resPoll != null) 
results.add(resPoll); 
} 
return results; 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 44 
Unported License 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Declarative Validation Using Bean Validation 1.1 
Method parameters: 
@GET 
@Path("/{id}") 
@Produces({APPLICATION_XML, APPLICATION_JSON}) 
public Response getPollById( 
@PathParam("id") @NotNull @Min(1) Long id) { ... } 
Beans fields & properties: 
@NotNull 
@Size(min = 1, max = 255) 
@Email 
@Basic(optional = false) 
private String email; 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 45 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Declarative Validation Using Bean Validation 1.1 
Declarative validation annotations can be attached to: 
Request entity body 
@POST 
@Consumes({APPLICATION_XML, APPLICATION_JSON}) 
public Response addPoll(@Valid Poll poll) { ... } 
Response entity: 
@GET 
@Path("/count") 
@Produces(TEXT_PLAIN) 
@Pattern(regexp = "d+") 
public String getPollsCount() { 
return Integer.toString(pollController.getPollCount()); 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 46 
Unported License 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Improved Server-Suggested Content Negotiation 
Client driven content negotiation has been traditional capability 
of HTTP protocol – for example: 
GET /polling/resources/polls HTTP/1.1 
Host: localhost:8080 
Accept: application/xml; q=0.5, application/json; q=0.4 
Cache-Control: no-cache 
But when client does not specify Accept header preference? 
- Server can: 
@GET 
@Produces(value = {APPLICATION_XML + "; qs=0.75", 
APPLICATION_JSON + "; qs=0.9"}) 
public Collection<Poll> getAllPolls() { ...} 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 47 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Filters & Interceptors – Client & Server 
Aspect-oriented extensibility of request/response processing 
Resource Filters – very similar to “classical” HttpServlet filters, non 
wrapping, do not invoke next processors in the chain directly, can filter 
HttpRequest (ContainerRequestFilter, ClientRequestFilter) or 
HttpResponse (ContainerResponseFilter, ClientResponseFilter). can 
bypass the next filters and resources by calling: 
ContainerRequestContext.abortWith(javax.ws.rs.core.Response) 
Resource Interceptors – they “wrap” the call to the entity readers/writers 
by explicitly calling [Reader/Writer]InterceptorContext.proceed() to pass 
the input stream or entity body read / written by next interceptor / resource/ 
sub-resource method in the chain. 
Filters & interceptors can manipulate headers and entity body. The main 
difference is that filters can change the requested resource URI (if 
@PreMatching), while interceptors can not (they are executed after 
resource processing method has been matched). 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 48 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Filters & Interceptors – Client & Server 
Aspect-oriented extensibility of request/response processing 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 49 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
LoggingFilter Example (1) 
@Provider 
//@PreMatching 
@Priority(1000) 
@Logged 
public class LoggingFilter implements ContainerRequestFilter, 
ContainerResponseFilter { 
@Override 
public void filter(ContainerRequestContext requestContext) { 
Logger.getLogger("Logging Resource Request >>>>> ", 
LoggingFilter.class).log(Level.INFO, "Method: " 
+ requestContext.getMethod() + ", URI: " 
+ requestContext.getUriInfo().getAbsolutePath() 
+ ", Headers: " + requestContext.getHeaders() ); 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 50 
Unported License 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
LoggingFilter Example (2) 
@Override 
public void filter(ContainerRequestContext requestContext, 
ContainerResponseContext responseContext) { 
Logger.getLogger("Logging Service Response >>>>> ", 
LoggingFilter.class).log(Level.INFO, "Method: " 
+ requestContext.getMethod()+ ", URI: " 
+ requestContext.getUriInfo().getAbsolutePath() 
+ ", Status Code: " + responseContext.getStatus() 
+ ", MIME Type: " + responseContext.getHeaders() 
+ ", Entity Body: " + responseContext.getEntity() 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 51 
Unported License 
); 
} 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
@Logged + @NameBinding Example (1) 
@NameBinding 
@Retention(value = RetentionPolicy.RUNTIME) 
@Target({ElementType.TYPE, ElementType.METHOD}) 
public @interface Logged { 
} 
@GET 
@Logged 
@Profiled 
@Path("/{id}") 
@Produces({APPLICATION_XML, APPLICATION_JSON}) 
public Response getPollById( 
@PathParam("id") @NotNull @Min(1) Long id) { ... } 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 52 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
AddSelfLinkInterceptor Example (1) 
@Provider 
@SelfLinked 
public class AddSelfLinkInterceptor implementsWriterInterceptor{ 
@Context UriInfo uriInfo; 
@Override 
public void aroundWriteTo(WriterInterceptorContext 
responseContext)throws WebApplicationException, IOException{ 
List<Object> links = responseContext.getHeaders().get("Link"); 
if(links == null) links = new ArrayList<>(); 
links.add("<" + uriInfo.getAbsolutePath() + ">; rel=self"); 
responseContext.getHeaders().put("Link", links); 
responseContext.proceed(); 
} 
} 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 53 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Dynamic extension registration using 
DynamicFeature interface 
Allows dynamic programmatic registration of post-matching 
providers during JAX-RS setup at deployment time 
public void configure(ResourceInfo resourceInfo, 
FeatureContext context) method called for each resource 
allows to dynamically decide during application configuration 
phase which ContainerRequestFilter, 
ContainerResponseFilter, ReaderInterceptor, 
WriterInterceptor, and Feature classes to register for that 
resource / subresource class / method (based on annotations 
provided for the method for example) 
May be annotated with @Provider annotation to be 
dynamically discovered 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 54 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
DynamicFeature Example (1) 
@Provider 
public class SelfLinkingDynamicFeature implements DynamicFeature{ 
@Override 
public void configure(ResourceInfo resourceInfo, 
FeatureContext context) { 
if(resourceInfo.getResourceMethod() 
.isAnnotationPresent(GET.class) 
||resourceInfo.getResourceMethod() 
.isAnnotationPresent(POST.class) ){ 
context.register(AddSelfLinkInterceptor.class); 
} 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 55 
Unported License 
} 
}
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Hypermedia As The Engine Of Application State 
(HATEOAS) – Document Links Example (1) 
@XmlAccessorType(XmlAccessType.FIELD) 
@XmlRootElement(name="poll") 
public class PollRepresentationDocumentLinks { 
private Long id; 
private PollStatus status = PollStatus.CREATED; 
private String title; private String question; 
private Date start; private Date end; 
@XmlElementWrapper(name = "_embedded") 
@XmlElement(name = "alternative") 
private List<Alternative> alternatives; 
@XmlElementWrapper(name = "_links") 
@XmlElement(name = "link") 
@XmlJavaTypeAdapter(JaxbAdapter.class) 
private Collection<Link> links; 
... 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 56 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Hypermedia As The Engine Of Application State 
(HATEOAS) – New Link Header (RFC 5988) (2) 
Response resp = Response.ok( 
new PollRepresentationHeaderLinks(poll)) 
.links(links.toArray(new Link[]{})); 
Content-Length →1656 
Content-Type →application/xml 
Link →<http://localhost:8080/polling/resources/polls/629>; rel="prev"; 
type="application/json"; title="Previous poll", 
<http://localhost:8080/polling/resources/polls/632>; rel="next"; 
type="application/json"; title="Next poll", 
<http://localhost:8080/polling/resources/polls>; rel="collection"; 
type="application/json"; title="Polls collection", 
<http://localhost:8080/polling/resources/polls>; rel="collection up"; 
type="application/json"; title="Root resource", 
<http://localhost:8080/polling/resources/polls/630>; rel="self"; 
type="application/json"; title="Self link", 
<http://localhost:8080/polling/resources/polls/630>; rel=self 
Server →GlassFish Server Open Source Edition 4.1 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 57 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Want to Learn More? 
Welcome to IPT Java™ trainings [http://iproduct.org/]: 
Programming in Java Language - 3 modules 
Web Programming with Java Technology: Servlet 3.1, JSP, JSTL, EL, JSF 
2.2, Facelets & Templating, AJAX, JSON, WebSocket, SSE, WebRTC 
Java Enterprise Technologies (Java EE 7) – EJB 3.2, JSF 2.2, JAX-RS 2.0, 
Web Services, WebSocket, JMS, CDI, Bean Validation, JPA, JTA, Batch 
and Concurrency 
Service Oriented Architecture (SOA) & Contemporary Standards for 
Business Process Modeling (BPM) – Apache AXIS 2 & CXF, Glassfish 
Metro & Jersey, JBoss RESTEasy, SoapUI & Service Testing, SOAP, 
WSDL 2.0, WS-*, SOA, SCA, SDO, BPMN, WS-BPEL 
Java™ Portlet Development with JSR 286: Portlet 2.0 API, Liferay® 6 & 
GateIn 3 – JSP™, JSF 2.2, Spring & AJAX Portlets 
Oracle®, Java™ and JavaScript™ are trademarks or registered trademarks of Oracle and/or its affiliates. 
Liferay® is a registered trademark of Liferay, Inc. Other names may be trademarks of their respective owners. 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 58 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
References 
R. Fielding, Architectural Styles and the Design of Networkbased 
Software Architectures, PhD Thesis, University of California, Irvine, 
2000 
Fielding's blog discussing REST – 
http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven 
Representational state transfer (REST) in Wikipedia – 
http://en.wikipedia.org/wiki/Representational_state_transfer 
Hypermedia as the Engine of Application State (HATEOAS) in 
Wikipedia – http://en.wikipedia.org/wiki/HATEOAS 
JavaScript Object Notation (JSON) – http://www.json.org/ 
JAX-RS 2.0 (JSR 339) Reference Implementation for building 
RESTful Web services – http://jersey.java.net/ 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 59 
Unported License
IPT – Intellectual Products & Technologies 
Trayan Iliev, http://www.iproduct.org/ 
BGOUG Meeting – Pravets 
November 14, 2014 
Thanks for Your Attention! 
Questions? 
Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 60 
Unported License

Más contenido relacionado

La actualidad más candente

Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with javaVinay Gopinath
 
Using Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSUsing Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSKatrien Verbert
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web servicesnbuddharaju
 
Json to hive_schema_generator
Json to hive_schema_generatorJson to hive_schema_generator
Json to hive_schema_generatorPayal Jain
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座Li Yi
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India
 
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEREST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEreneechemel
 
Representational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOASRepresentational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOASGuy K. Kloss
 
REST - Representational state transfer
REST - Representational state transferREST - Representational state transfer
REST - Representational state transferTricode (part of Dept)
 
ReST (Representational State Transfer) Explained
ReST (Representational State Transfer) ExplainedReST (Representational State Transfer) Explained
ReST (Representational State Transfer) ExplainedDhananjay Nene
 
RESTful services with JAXB and JPA
RESTful services with JAXB and JPARESTful services with JAXB and JPA
RESTful services with JAXB and JPAShaun Smith
 
The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016Restlet
 
HATEOAS: The Confusing Bit from REST
HATEOAS: The Confusing Bit from RESTHATEOAS: The Confusing Bit from REST
HATEOAS: The Confusing Bit from RESTelliando dias
 
The RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with OracleThe RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with OracleEmiliano Pecis
 
Open source masterclass - Life in the Apache Incubator
Open source masterclass - Life in the Apache IncubatorOpen source masterclass - Life in the Apache Incubator
Open source masterclass - Life in the Apache IncubatorJukka Zitting
 
Introduction to RESTful Webservices in JAVA
Introduction to RESTful Webservices  in JAVA Introduction to RESTful Webservices  in JAVA
Introduction to RESTful Webservices in JAVA psrpatnaik
 

La actualidad más candente (20)

Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with java
 
Introduction to JAX-RS
Introduction to JAX-RSIntroduction to JAX-RS
Introduction to JAX-RS
 
Using Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RSUsing Java to implement RESTful Web Services: JAX-RS
Using Java to implement RESTful Web Services: JAX-RS
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
Json to hive_schema_generator
Json to hive_schema_generatorJson to hive_schema_generator
Json to hive_schema_generator
 
Jersey and JAX-RS
Jersey and JAX-RSJersey and JAX-RS
Jersey and JAX-RS
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jerseyEclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
 
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLEREST Easy with AngularJS - ng-grid CRUD EXAMPLE
REST Easy with AngularJS - ng-grid CRUD EXAMPLE
 
Representational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOASRepresentational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOAS
 
REST - Representational state transfer
REST - Representational state transferREST - Representational state transfer
REST - Representational state transfer
 
ReST (Representational State Transfer) Explained
ReST (Representational State Transfer) ExplainedReST (Representational State Transfer) Explained
ReST (Representational State Transfer) Explained
 
RESTful services with JAXB and JPA
RESTful services with JAXB and JPARESTful services with JAXB and JPA
RESTful services with JAXB and JPA
 
The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016
 
Rest and Rails
Rest and RailsRest and Rails
Rest and Rails
 
HATEOAS: The Confusing Bit from REST
HATEOAS: The Confusing Bit from RESTHATEOAS: The Confusing Bit from REST
HATEOAS: The Confusing Bit from REST
 
The RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with OracleThe RESTful Soa Datagrid with Oracle
The RESTful Soa Datagrid with Oracle
 
Open source masterclass - Life in the Apache Incubator
Open source masterclass - Life in the Apache IncubatorOpen source masterclass - Life in the Apache Incubator
Open source masterclass - Life in the Apache Incubator
 
Introduction to RESTful Webservices in JAVA
Introduction to RESTful Webservices  in JAVA Introduction to RESTful Webservices  in JAVA
Introduction to RESTful Webservices in JAVA
 

Destacado

MTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new APIMTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new APISix Apart KK
 
Data API ことはじめ
Data API ことはじめData API ことはじめ
Data API ことはじめYuji Takayama
 
Fork/Join Framework。そしてLambdaへ。
Fork/Join Framework。そしてLambdaへ。Fork/Join Framework。そしてLambdaへ。
Fork/Join Framework。そしてLambdaへ。Yuichi Sakuraba
 
Introducing C# in AWS Lambda
Introducing C# in AWS LambdaIntroducing C# in AWS Lambda
Introducing C# in AWS LambdaAtsushi Fukui
 
Running Java Apps with Amazon EC2, AWS Elastic Beanstalk or Serverless
Running Java Apps with Amazon EC2, AWS Elastic Beanstalk or ServerlessRunning Java Apps with Amazon EC2, AWS Elastic Beanstalk or Serverless
Running Java Apps with Amazon EC2, AWS Elastic Beanstalk or ServerlessKeisuke Nishitani
 
20161111 java one2016-feedback
20161111 java one2016-feedback20161111 java one2016-feedback
20161111 java one2016-feedbackTakashi Ito
 
Going Serverless, Building Applications with No Servers
Going Serverless, Building Applications with No ServersGoing Serverless, Building Applications with No Servers
Going Serverless, Building Applications with No ServersKeisuke Nishitani
 
Awsで作るビッグデータ解析今とこれから
Awsで作るビッグデータ解析今とこれからAwsで作るビッグデータ解析今とこれから
Awsで作るビッグデータ解析今とこれからShohei Kobayashi
 
AWSのサーバレス関連アップデートを10分で紹介します
AWSのサーバレス関連アップデートを10分で紹介しますAWSのサーバレス関連アップデートを10分で紹介します
AWSのサーバレス関連アップデートを10分で紹介しますKeisuke Nishitani
 
デモから見るOpenWhisk - Docker Action -
デモから見るOpenWhisk - Docker Action - デモから見るOpenWhisk - Docker Action -
デモから見るOpenWhisk - Docker Action - Hideaki Tokida
 
Serverless meetup02 openwhisk
Serverless meetup02 openwhiskServerless meetup02 openwhisk
Serverless meetup02 openwhiskHideaki Tokida
 
The Internal of Serverless Plugins
The Internal of Serverless PluginsThe Internal of Serverless Plugins
The Internal of Serverless PluginsTerui Masashi
 
Building Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayBuilding Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayAmazon Web Services
 
Deep-Dive: Building Mobile Web Applications with AWS Mobile SDK
Deep-Dive: Building Mobile Web Applications with AWS Mobile SDKDeep-Dive: Building Mobile Web Applications with AWS Mobile SDK
Deep-Dive: Building Mobile Web Applications with AWS Mobile SDKAmazon Web Services
 
CRM分析サービス crm analyzer expressを 支えるサーバレスな色々
CRM分析サービス  crm analyzer expressを 支えるサーバレスな色々CRM分析サービス  crm analyzer expressを 支えるサーバレスな色々
CRM分析サービス crm analyzer expressを 支えるサーバレスな色々Kazuhiro Sasaki
 
Salesforce Einstein - SaaS企業のAI戦略とテクノロジ -
Salesforce Einstein - SaaS企業のAI戦略とテクノロジ - Salesforce Einstein - SaaS企業のAI戦略とテクノロジ -
Salesforce Einstein - SaaS企業のAI戦略とテクノロジ - Mitch Okamoto
 

Destacado (20)

MTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new APIMTDDC 2010.2.5 Tokyo - Brand new API
MTDDC 2010.2.5 Tokyo - Brand new API
 
Data API ことはじめ
Data API ことはじめData API ことはじめ
Data API ことはじめ
 
Fork/Join Framework。そしてLambdaへ。
Fork/Join Framework。そしてLambdaへ。Fork/Join Framework。そしてLambdaへ。
Fork/Join Framework。そしてLambdaへ。
 
Introducing C# in AWS Lambda
Introducing C# in AWS LambdaIntroducing C# in AWS Lambda
Introducing C# in AWS Lambda
 
Running Java Apps with Amazon EC2, AWS Elastic Beanstalk or Serverless
Running Java Apps with Amazon EC2, AWS Elastic Beanstalk or ServerlessRunning Java Apps with Amazon EC2, AWS Elastic Beanstalk or Serverless
Running Java Apps with Amazon EC2, AWS Elastic Beanstalk or Serverless
 
20161111 java one2016-feedback
20161111 java one2016-feedback20161111 java one2016-feedback
20161111 java one2016-feedback
 
Going Serverless, Building Applications with No Servers
Going Serverless, Building Applications with No ServersGoing Serverless, Building Applications with No Servers
Going Serverless, Building Applications with No Servers
 
Introduction to AWS X-Ray
Introduction to AWS X-RayIntroduction to AWS X-Ray
Introduction to AWS X-Ray
 
Awsで作るビッグデータ解析今とこれから
Awsで作るビッグデータ解析今とこれからAwsで作るビッグデータ解析今とこれから
Awsで作るビッグデータ解析今とこれから
 
AWSのサーバレス関連アップデートを10分で紹介します
AWSのサーバレス関連アップデートを10分で紹介しますAWSのサーバレス関連アップデートを10分で紹介します
AWSのサーバレス関連アップデートを10分で紹介します
 
デモから見るOpenWhisk - Docker Action -
デモから見るOpenWhisk - Docker Action - デモから見るOpenWhisk - Docker Action -
デモから見るOpenWhisk - Docker Action -
 
Serverless meetup02 openwhisk
Serverless meetup02 openwhiskServerless meetup02 openwhisk
Serverless meetup02 openwhisk
 
The Internal of Serverless Plugins
The Internal of Serverless PluginsThe Internal of Serverless Plugins
The Internal of Serverless Plugins
 
Building Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayBuilding Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API Gateway
 
What's new with Serverless
What's new with ServerlessWhat's new with Serverless
What's new with Serverless
 
Deep-Dive: Building Mobile Web Applications with AWS Mobile SDK
Deep-Dive: Building Mobile Web Applications with AWS Mobile SDKDeep-Dive: Building Mobile Web Applications with AWS Mobile SDK
Deep-Dive: Building Mobile Web Applications with AWS Mobile SDK
 
CRM分析サービス crm analyzer expressを 支えるサーバレスな色々
CRM分析サービス  crm analyzer expressを 支えるサーバレスな色々CRM分析サービス  crm analyzer expressを 支えるサーバレスな色々
CRM分析サービス crm analyzer expressを 支えるサーバレスな色々
 
Salesforce Einstein - SaaS企業のAI戦略とテクノロジ -
Salesforce Einstein - SaaS企業のAI戦略とテクノロジ - Salesforce Einstein - SaaS企業のAI戦略とテクノロジ -
Salesforce Einstein - SaaS企業のAI戦略とテクノロジ -
 
Serverless Revolution
Serverless RevolutionServerless Revolution
Serverless Revolution
 
Serverless for Developers
Serverless for DevelopersServerless for Developers
Serverless for Developers
 

Similar a Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Conference, Pravets 2014

New MVC 1.0 JavaEE 8 API
New MVC 1.0 JavaEE 8 APINew MVC 1.0 JavaEE 8 API
New MVC 1.0 JavaEE 8 APITrayan Iliev
 
Exploring MERN Stack and Tech Stacks: A Comparative Analysis
Exploring MERN Stack and Tech Stacks: A Comparative AnalysisExploring MERN Stack and Tech Stacks: A Comparative Analysis
Exploring MERN Stack and Tech Stacks: A Comparative AnalysisIRJET Journal
 
Cs 1023 lec 13 web (week 4)
Cs 1023 lec 13 web (week 4)Cs 1023 lec 13 web (week 4)
Cs 1023 lec 13 web (week 4)stanbridge
 
Webface - Passion is Innovation
Webface - Passion is InnovationWebface - Passion is Innovation
Webface - Passion is InnovationAbhishek kumar
 
IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016Trayan Iliev
 
Secc tutorials development and deployment of rest web services in java_v2.0
Secc tutorials development and deployment of rest web services in java_v2.0Secc tutorials development and deployment of rest web services in java_v2.0
Secc tutorials development and deployment of rest web services in java_v2.0Aravindharamanan S
 
REST & RESTful APIs: The State of Confusion
REST & RESTful APIs: The State of ConfusionREST & RESTful APIs: The State of Confusion
REST & RESTful APIs: The State of ConfusionGlenn Antoine
 
Vijay Mix Presentation
Vijay Mix PresentationVijay Mix Presentation
Vijay Mix Presentationvijayrvr
 
Teched India Vijay Interop Track
Teched India Vijay Interop TrackTeched India Vijay Interop Track
Teched India Vijay Interop Trackvijayrvr
 
Fullstack Interview Questions and Answers.pdf
Fullstack Interview Questions and Answers.pdfFullstack Interview Questions and Answers.pdf
Fullstack Interview Questions and Answers.pdfcsvishnukumar
 
IRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET Journal
 
Reactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring ReactorReactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring ReactorTrayan Iliev
 
WebRTC with Java
WebRTC with JavaWebRTC with Java
WebRTC with Javaamithap07
 
Next gen tech from QuickXpert Infotech
Next gen tech   from QuickXpert InfotechNext gen tech   from QuickXpert Infotech
Next gen tech from QuickXpert InfotechNarendra Jakhotia
 
17 applied architectures
17 applied architectures17 applied architectures
17 applied architecturesMajong DevJfu
 

Similar a Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Conference, Pravets 2014 (20)

New MVC 1.0 JavaEE 8 API
New MVC 1.0 JavaEE 8 APINew MVC 1.0 JavaEE 8 API
New MVC 1.0 JavaEE 8 API
 
Exploring MERN Stack and Tech Stacks: A Comparative Analysis
Exploring MERN Stack and Tech Stacks: A Comparative AnalysisExploring MERN Stack and Tech Stacks: A Comparative Analysis
Exploring MERN Stack and Tech Stacks: A Comparative Analysis
 
Cs 1023 lec 13 web (week 4)
Cs 1023 lec 13 web (week 4)Cs 1023 lec 13 web (week 4)
Cs 1023 lec 13 web (week 4)
 
Webface - Passion is Innovation
Webface - Passion is InnovationWebface - Passion is Innovation
Webface - Passion is Innovation
 
soa1.ppt
soa1.pptsoa1.ppt
soa1.ppt
 
IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016
 
Secc tutorials development and deployment of rest web services in java_v2.0
Secc tutorials development and deployment of rest web services in java_v2.0Secc tutorials development and deployment of rest web services in java_v2.0
Secc tutorials development and deployment of rest web services in java_v2.0
 
REST & RESTful APIs: The State of Confusion
REST & RESTful APIs: The State of ConfusionREST & RESTful APIs: The State of Confusion
REST & RESTful APIs: The State of Confusion
 
Vijay Mix Presentation
Vijay Mix PresentationVijay Mix Presentation
Vijay Mix Presentation
 
Teched India Vijay Interop Track
Teched India Vijay Interop TrackTeched India Vijay Interop Track
Teched India Vijay Interop Track
 
Fullstack Interview Questions and Answers.pdf
Fullstack Interview Questions and Answers.pdfFullstack Interview Questions and Answers.pdf
Fullstack Interview Questions and Answers.pdf
 
IRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce Site
 
Reactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring ReactorReactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring Reactor
 
SAP Net Weaver Architecture,
SAP Net Weaver Architecture, SAP Net Weaver Architecture,
SAP Net Weaver Architecture,
 
Overview of JEE Technology
Overview of JEE TechnologyOverview of JEE Technology
Overview of JEE Technology
 
WebRTC with Java
WebRTC with JavaWebRTC with Java
WebRTC with Java
 
Rest overview briefing
Rest  overview briefingRest  overview briefing
Rest overview briefing
 
Next gen tech from QuickXpert Infotech
Next gen tech   from QuickXpert InfotechNext gen tech   from QuickXpert Infotech
Next gen tech from QuickXpert Infotech
 
17 applied architectures
17 applied architectures17 applied architectures
17 applied architectures
 
1213532535.pdf
1213532535.pdf1213532535.pdf
1213532535.pdf
 

Más de Trayan Iliev

Making Machine Learning Easy with H2O and WebFlux
Making Machine Learning Easy with H2O and WebFluxMaking Machine Learning Easy with H2O and WebFlux
Making Machine Learning Easy with H2O and WebFluxTrayan Iliev
 
Rapid Web API development with Kotlin and Ktor
Rapid Web API development with Kotlin and KtorRapid Web API development with Kotlin and Ktor
Rapid Web API development with Kotlin and KtorTrayan Iliev
 
IPT Reactive Java IoT Demo - BGOUG 2018
IPT Reactive Java IoT Demo - BGOUG 2018IPT Reactive Java IoT Demo - BGOUG 2018
IPT Reactive Java IoT Demo - BGOUG 2018Trayan Iliev
 
Learning Programming Using Robots - Sofia University Conference 2018
Learning Programming Using Robots - Sofia University Conference 2018 Learning Programming Using Robots - Sofia University Conference 2018
Learning Programming Using Robots - Sofia University Conference 2018 Trayan Iliev
 
Active Learning Using Connected Things - 2018 (in Bulgarian)
Active Learning Using Connected Things - 2018 (in Bulgarian)Active Learning Using Connected Things - 2018 (in Bulgarian)
Active Learning Using Connected Things - 2018 (in Bulgarian)Trayan Iliev
 
Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Trayan Iliev
 
Fog Computing - DEV.BG 2018
Fog Computing - DEV.BG 2018Fog Computing - DEV.BG 2018
Fog Computing - DEV.BG 2018Trayan Iliev
 
Microservices with Spring 5 Webflux - jProfessionals
Microservices  with Spring 5 Webflux - jProfessionalsMicroservices  with Spring 5 Webflux - jProfessionals
Microservices with Spring 5 Webflux - jProfessionalsTrayan Iliev
 
Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Trayan Iliev
 
What's new in java 9?
What's new in java 9?What's new in java 9?
What's new in java 9?Trayan Iliev
 
NGRX Apps in Depth
NGRX Apps in DepthNGRX Apps in Depth
NGRX Apps in DepthTrayan Iliev
 
Stream Processing with CompletableFuture and Flow in Java 9
Stream Processing with CompletableFuture and Flow in Java 9Stream Processing with CompletableFuture and Flow in Java 9
Stream Processing with CompletableFuture and Flow in Java 9Trayan Iliev
 
React HOCs, Context and Observables
React HOCs, Context and ObservablesReact HOCs, Context and Observables
React HOCs, Context and ObservablesTrayan Iliev
 
Hackathon: “IPTPI and LeJaRo Meet The Real World”
Hackathon: “IPTPI and LeJaRo Meet The Real World”Hackathon: “IPTPI and LeJaRo Meet The Real World”
Hackathon: “IPTPI and LeJaRo Meet The Real World”Trayan Iliev
 
Reactive robotics io_t_2017
Reactive robotics io_t_2017Reactive robotics io_t_2017
Reactive robotics io_t_2017Trayan Iliev
 
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionalsJava & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionalsTrayan Iliev
 
IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016Trayan Iliev
 
Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016Trayan Iliev
 
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016Trayan Iliev
 
IPT High Performance Reactive Programming with JAVA 8 and JavaScript
IPT High Performance Reactive Programming with JAVA 8 and JavaScriptIPT High Performance Reactive Programming with JAVA 8 and JavaScript
IPT High Performance Reactive Programming with JAVA 8 and JavaScriptTrayan Iliev
 

Más de Trayan Iliev (20)

Making Machine Learning Easy with H2O and WebFlux
Making Machine Learning Easy with H2O and WebFluxMaking Machine Learning Easy with H2O and WebFlux
Making Machine Learning Easy with H2O and WebFlux
 
Rapid Web API development with Kotlin and Ktor
Rapid Web API development with Kotlin and KtorRapid Web API development with Kotlin and Ktor
Rapid Web API development with Kotlin and Ktor
 
IPT Reactive Java IoT Demo - BGOUG 2018
IPT Reactive Java IoT Demo - BGOUG 2018IPT Reactive Java IoT Demo - BGOUG 2018
IPT Reactive Java IoT Demo - BGOUG 2018
 
Learning Programming Using Robots - Sofia University Conference 2018
Learning Programming Using Robots - Sofia University Conference 2018 Learning Programming Using Robots - Sofia University Conference 2018
Learning Programming Using Robots - Sofia University Conference 2018
 
Active Learning Using Connected Things - 2018 (in Bulgarian)
Active Learning Using Connected Things - 2018 (in Bulgarian)Active Learning Using Connected Things - 2018 (in Bulgarian)
Active Learning Using Connected Things - 2018 (in Bulgarian)
 
Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018Spring 5 Webflux - Advances in Java 2018
Spring 5 Webflux - Advances in Java 2018
 
Fog Computing - DEV.BG 2018
Fog Computing - DEV.BG 2018Fog Computing - DEV.BG 2018
Fog Computing - DEV.BG 2018
 
Microservices with Spring 5 Webflux - jProfessionals
Microservices  with Spring 5 Webflux - jProfessionalsMicroservices  with Spring 5 Webflux - jProfessionals
Microservices with Spring 5 Webflux - jProfessionals
 
Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux Reactive Microservices with Spring 5: WebFlux
Reactive Microservices with Spring 5: WebFlux
 
What's new in java 9?
What's new in java 9?What's new in java 9?
What's new in java 9?
 
NGRX Apps in Depth
NGRX Apps in DepthNGRX Apps in Depth
NGRX Apps in Depth
 
Stream Processing with CompletableFuture and Flow in Java 9
Stream Processing with CompletableFuture and Flow in Java 9Stream Processing with CompletableFuture and Flow in Java 9
Stream Processing with CompletableFuture and Flow in Java 9
 
React HOCs, Context and Observables
React HOCs, Context and ObservablesReact HOCs, Context and Observables
React HOCs, Context and Observables
 
Hackathon: “IPTPI and LeJaRo Meet The Real World”
Hackathon: “IPTPI and LeJaRo Meet The Real World”Hackathon: “IPTPI and LeJaRo Meet The Real World”
Hackathon: “IPTPI and LeJaRo Meet The Real World”
 
Reactive robotics io_t_2017
Reactive robotics io_t_2017Reactive robotics io_t_2017
Reactive robotics io_t_2017
 
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionalsJava & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
Java & JavaScipt Reactive Robotics and IoT 2016 @ jProfessionals
 
IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016IPT High Performance Reactive Java BGOUG 2016
IPT High Performance Reactive Java BGOUG 2016
 
Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016Reactive Java Robotics IoT - jPrime 2016
Reactive Java Robotics IoT - jPrime 2016
 
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
Reactive Java Robotics and IoT - IPT Presentation @ Voxxed Days 2016
 
IPT High Performance Reactive Programming with JAVA 8 and JavaScript
IPT High Performance Reactive Programming with JAVA 8 and JavaScriptIPT High Performance Reactive Programming with JAVA 8 and JavaScript
IPT High Performance Reactive Programming with JAVA 8 and JavaScript
 

Último

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Último (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Novelties in Java EE 7: JAX-RS 2.0 + IPT REST HATEOAS Polling Demo @ BGOUG Conference, Pravets 2014

  • 1. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Novelties in Java™ EE 7: JAX – RS 2.0 Trayan Iliev IPT – Intellectual Products & Technologies e-mail: tiliev@iproduct.org web: http://www.iproduct.org Oracle®, Java™ and JavaScript™ are trademarks or registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 1 Unported License
  • 2. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Agenda I Service Oriented Architecture (SOA), REST & HATEOAS Richardson Maturity Model of Web Applications IPT Proposal: Separation of Query & Command Representations & dynamically generated meta-data for RESTful resources Novelties in Java™ EE 7: Java API for RESTful Web Services – JAX-RS 2.0 (JSR 339) Standardized REST Client API; Client-side and server-side asynchronous HTTP request processing Integration of declarative validation of resources, response entities, method parameters, and fields using JSR 349: Bean Validation 1.1 Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 2 Unported License
  • 3. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Agenda II Improved server-suggested content negotiation in addition to that suggested by client Aspect-oriented extensibility of request/response processing using Filters (non wrapping) and Interceptors (wrapping) client and server extensions Dynamic extension registration using DynamicFeature interface; Hypermedia As The Engine Of Application State (HATEOAS) REST architectural constraint support using state transition links (support for new HTTP Link header as well as JAXB serialization of resource links). Let's try it (IPT Polling Demo + hands-on) Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 3 Unported License
  • 4. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Question 1 How many people know what REST means? Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 4 Unported License
  • 5. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Question 2 How many know what HATEOAS stays for? Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 5 Unported License
  • 6. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Question 3 How many people have developed at least one RESTful service with JAX-RS? Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 6 Unported License
  • 7. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Software Architecture – Definitions [1] Almost everybody feels at peace with nature: listening to the ocean waves against the shore, by a still lake, in a field of grass, on a windblown heath. One day, when we have learned the timeless way again, we shall feel the same about our towns, and we shall feel as much at peace in them, as we do today walking by the ocean, or stretched out in the long grass of a meadow. — Christopher Alexander, The Timeless Way of Building (1979) Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 7 Unported License
  • 8. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Software Architecture – Definitions [2] According to Dr. Roy Thomas Fielding [Architectural Styles and the Design of Network-based Software Architectures, 2000]: A software architecture is an abstraction of the run-time elements of a software system during some phase of its operation. A system may be composed of many levels of abstraction and many phases of operation,each with its own software architecture. A software architecture is defined by a configuration of architectural elements - components, connectors, and data - constrained in their relaionships in order to achieve a desired set of architectural properties. Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 8 Unported License
  • 9. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Software Architecture – Definitions [3] According to Dr. Roy Thomas Fielding [Architectural Styles and the Design of Network-based Software Architectures, 2000]: An architectural style is a coordinated set of architectural constraints that restricts the roles/features of architectural elements and the allowed relationships among those elements within any architecture that conforms to that style. The primary distinction between Network-based architectures and software architectures in general is that communication between components is restricted to message passing, or the equivalent of message passing if a more efficient mechanism can be selected at runtime based on the location of components. Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 9 Unported License
  • 10. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Architectural Properties According to Dr. Roy Thomas Fielding [Architectural Styles and the Design of Network-based Software Architectures, 2000]: Performance Scalability Reliability Simplicity Extensibility Dynamic evolvability Cusomizability Configurability Visibility All of them should be present in a desired Web Architecture and REST architectural style tries to preserve them by consistently applying several architectural constraints Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 10 Unported License
  • 11. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Service Oriented Architecture (SOA) – Definitions Thomas Erl: SOA represents an open, agile, extensible, federated, composable architecture comprised of autonomous, QoS-capable, vendor diverse, interoperable, discoverable, and potentially reusable services, implemented as Web services. SOA can establish an abstraction of business logic and technology, resulting in a loose coupling between these domains. SOA is an evolution of past platforms, preserving successful characteristics of traditional architectures, and bringing with it distinct principles that foster service-orientation in support of a service-oriented enterprise. SOA is ideally standardized throughout an enterprise, but achieving this state requires a planned transition and the support of a still evolving technology set References: Erl, Thomas. Serviceorientation.org – About the Principles, 2005–06 Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 11 Unported License
  • 12. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 SOA == SOAP + WSDL? Web Services are: Semantic Models components for building distributed applications in SOA architectural style communicate using open protocols are self-descriptive and self-content can be searched and found using UDDI or ebXML registries (and more recent specifications – WSIL & Semantic Web Services) Mapping WSDL Messages Source: http://en.wikipedia.org/wiki/File:Webservices.png, Author: H. Voormann License: Creative Commons Attribution 3.0 Unported WSDL Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 12 Unported License
  • 13. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Service Oriented Architecture (SOA) Java EE 6 Architecture Source: http://en.wikipedia.org/wiki/File:SO A_Detailed_Diagram.png, Author: JamesLWilliams2010, License: Creative Commons Attribution 3.0 Unported Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 13 Unported License
  • 14. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 SOA Implemetation - Java SE/EE 7 APIs According to Java™ EE Specification: Web Services (SOAP) Java API for XML Web Services (JAX-WS) Java Architecture for XML Binding (JAXB) SOAP with Attachments API for Java (SAAJ) Java API for XML Registries (JAXR) RESTful Web Services Java API for RESTful Web Services - JAX-RS Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 14 Unported License
  • 15. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Representational State Transfer (REST) [1] REpresentational State Transfer (REST) is an architecture for accessing distributed hypermedia web-services The resources are identified by URIs and are accessed and manipulated using an HHTP interface base methods (GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH) Information is exchanged using representations of these resources Lightweight alternative to SOAP+WSDL -> HTTP + Any representation format (e.g. JavaScript™ Object Notation – JSON) Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 15 Unported License
  • 16. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Representational State Transfer (REST) [2] Identification of resources – URIs Representation of resources – e.g. HTML, XML, JSON, etc. Manipulation of resources through these representations Self-descriptive messages - Internet media type (MIME type) provides enough information to describe how to process the message. Responses also explicitly indicate their cacheability. Hypermedia as the engine of application state (aka HATEOAS) Application contracts are expressed as media types and [semantic] link realtions (rel attribute - RFC5988, "Web Linking") [Source: http://en.wikipedia.org/wiki/Representational_state_transfer] Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 16 Unported License
  • 17. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Advantages of REST Scalability of component interactions – through layering the client server-communication and enabling load-balancing, shared caching, security policy enforcement; Generality of interfaces – allowing simplicity, reliability, security and improved visibility by intermediaries, easy configuration, robustness, and greater efficiency by fully utilizing the capabilities of HTTP protocol; Independent development and evolution of components, dynamic evolvability of services, without breaking existing clients. Fault tolerat, Recoverable, Secure, Loosely coupled Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 17 Unported License
  • 18. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Richardson's Maturity Model of Web Services According to Leonard Richardson [Talk at QCon, 2008 - http://www.crummy.com/writing/speaking/2008-QCon/act3.html]: Level 0 – POX: Single URI (XML-RPC, SOAP) Level 1 – Resources: Many URIs, Single Verb (URI Tunneling) Level 2 – HTTP Verbs: Many URIs, Many Verbs (CRUD – e.g Amazon S3) Level 3 – Hypermedia Links Control the Application State = HATEOAS (Hypertext As The Engine Of Application State) === truely RESTful Services Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 18 Unported License
  • 19. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Is There A Level 4 for WebApp Maturity? Considerations: Command Query Responsibility Segregation (CQRS): http://martinfowler.com/bliki/CQRS.html (gentle introduction by Martin Fowler) & ReportingDatabases: http://martinfowler.com/bliki/ReportingDatabase.html A single representation type can not be optimal for both reading (Query) and updating the application state (Command) We may prefer to model Query and Command as separate resources / representation types Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 19 Unported License
  • 20. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 What About Meta-Data? Very important for a RESTful applications where resources and resource states are dynamically discoverable / changeable But what we have? For SOAP services there is a WSDL (XML Schema based data type descriptions) REST should have the same -> Welcome WADL ! But is it really a good thing to have a static description of dynamically changeable resources and valid resource state change transitions? Static model can be evil in a Live World! Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 20 Unported License
  • 21. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Web Application Description Language (WADL) XML-based file format providing machine-readable description of HTTP-based web application resources – typically RESTful web services WADL is a W3C Member Submission Multiple resources Inter-connections between resources HTTP methods that can be applied accessing each resource Expected inputs, outputs and their data-type formats XML Schema data-type formats for representing the RESTful resources But WADL resource description is static ... let's make it dynamic! Източник: http://en.wikipedia.org/wiki/File:Webservices.png, автор: H. Voormann Лиценз: Creative Commons Attribution 3.0 Unported Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 21 Unported License
  • 22. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 The New Kids on the Block: JSON, JSON Schema & Hyper Schema, Microformats There are good use cases for WADL (REST resource metadata descriptions): automatic generation of client code & functional REST service tests, client data validation, building of generic REST clients. WADL is XML (and relies on XML Schema Definitions) – this is a limitation for JavaScript Clients Welcome JSON Schema & JSON Hyper-Schema ! But there are also Microformats (XHTML Meta Data Profiles – XMDP): e.g. hCard, hReview, hProduct, hCalendar ... Talking about meta-data: W3C Resource Description Framework (RDF) and Web Ontology Language (OWL) Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 22 Unported License
  • 23. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Metadata-Representations Proposal (& Questions) Meta-data can be very useful for generic REST clients and agents crawling the Web! Meta-data should be dynamically generated ... but can be more stable than the data it describes Separation of data and meta-data representations (different life-cycles – allows optional retrieval, caching) Meta-data should be dynamically discoverable using hyper links in resource representations (rel= type/ describedby/ lrdd?) Separation of Command and Query representations -> optimal representations for each task (possibly with separate MIME types – application/vnd.*+json/xml?) Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 23 Unported License
  • 24. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Java API for RESTful Web Service (JAX-RS 2.0) Allows modelling (and more importantly decoupling) of RESTful resource controllers, models and representations – enables HATEOAS: Level 3 in Richardson WebApp Maturity Model Resource Controllers are modelled as Plain Old Java Objects (POJO) + declarative annotations mapping HTTP request & response URIs / Headers / Body / Parameters / Cookies/ to Java Classes / Methods / Method Arguments / Sub-resources Models are again POJO + (eventually) some XML / JSON mapping annotations – e.g. JAX-B / Jackson / Jettison / MOXy Representations – custom HATEOAS resource representations can be easily build using provided Link class and @XmlJavaTypeAdapter(JaxbAdapter.class) annotation Източник: http://Licensed en.wikipedia.under org/the wiki/Creative File:Commons Webservices.Attribution-png, автор: NonCommercial-H. Voormann NoDerivs 3.0 Slide 24 Лиценз: Creative Unported Commons License Attribution 3.0 Unported
  • 25. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Java API for RESTful Web Service (JAX-RS) Packages: javax.ws.rs, javax.ws.rs.core, javax.ws.rs.ext Basic annotations: @Path @PathParam @QueryParam @FormParam @HeaderParam @CookieParam @MatrixParam @DefaultValue @Encoded @Produces @Consumes, @HttpMethod @GET @POST @PUT @DELETE @Provider @Context Източник: http://en.wikipedia.org/wiki/File:Webservices.png, автор: H. Voormann Лиценз: Creative Commons Attribution 3.0 Unported Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 25 Unported License
  • 26. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Implementing REST Resources using JAX-RS [1] @Stateless @Path("courses") @TransactionManagement(TransactionManagementType.BEAN) public class CoursesResource extends AbstractFacade<Course> { @PersistenceContext(unitName = "IPTCourseManagerPU") private EntityManager em; @Context private UriInfo context; @Resource UserTransaction utx; Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 26 Unported License
  • 27. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Implementing REST Resources using JAX-RS [2] @POST @Consumes({"application/json", "application/xml"}) public Response createCourse(Course entity){ Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 27 Unported License try { utx.begin(); super.create(entity); utx.commit(); return Response.created(UriBuilder.fromUri(context.getAbsolutePa th()).path(entity.getId().toString()).build()).build(); } catch (Exception ex) { throw new WebApplicationException(ex); } }
  • 28. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Implementing REST Resources using JAX-RS [3] @GET @Produces({"application/xml", "application/json"}) public CoursesRepresentation getAllCourses() { return new CoursesRepresentation(super.findAll()); Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 28 Unported License } @Path("{id}") public CourseResource getCourseResource( @PathParam("id") Integer id) { return new CourseResource(id, em, utx); } Sub-resource
  • 29. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Novelties in JAX-RS 2.0 by Example: IPT Polling Demo You can clone (or download) IPT RESTful Polling Demo at GitHub: https://github.com/iproduct/IPT-Polling-Demo-JAXRS20-HATEOAS The demo shows how to integrate multiple Java EE 7 technologies: EJB 3.1, CDI 1.1, JPA 2 + EclipseLink, JTA, Bean Validation. It is a Maven project and can be deployed as Web application (.WAR) or started from command line, as simple as: mvn embedded-glassfish:run (in project's root folder) I demonstrates also how to develelop functional/integration tests using embedded GlassFish 4 and maven-surefire / maven-failsafe plugins; to start the integration tests from command line: mvn verify There is also a project Wiki page discussing the details of the demo: https://github.com/iproduct/IPT-Polling-Demo-JAXRS20-HATEOAS/wiki Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 29 Unported License
  • 30. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 IPT Polling Demo Resources Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 30 Unported License
  • 31. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 IPT Polling Demo – Poll Resource States Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 31 Unported License
  • 32. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 IPT Polling Demo + Hands-on Exercises Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 32 Unported License
  • 33. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Proposed Architecture: jQuery Client + RESTful Backend Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 33 Unported License
  • 34. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Some Open Source WS Implementation Stacks Glassfish Metro – http://metro.java.net/ – JAX-WS (SOAP + WSDL) Reference Implementation Glassfish Jersey – http://jersey.java.net/ – JAX-RS (JSR 311) Reference Implementation for building RESTful Web services RESTEasy – http://resteasy.jboss.org/ – JBoss JAX-RS implementation Apache CXF – http://cxf.apache.org/ – JAX-WS & JAX-RS Apache Axis 2 – http://axis.apache.org/axis2/java/core/ – SOAP & REST web services Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 34 Unported License
  • 35. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 JAX-RS 2.0: Standardized REST Client API Java Client API is important for: RESTful services integration – building composite RESTful services and server-side mashups Functional & integration testing of web applications – using JUnit/ TestNG for testing integration scenarios Load / Perfomance / Stress testing of REST services Building GUI clients – could utilize rich interface capabilities of Swing & Java FX Before Java EE 7 each of JAX-RS implementations had its own client API Now the client code can be standardized and portable between implementations Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 35 Unported License
  • 36. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Standardized REST Client API Example (1) public class PollsResourceTest { public static final String BASE_URI = "http://localhost:8080/polling/resources/polls"; private static WebTarget target; ... @BeforeClass public static void setUpClass() { // Initialize base REST client and target URI uri = UriBuilder.fromUri(BASE_URI).build(); ClientConfig config = new ClientConfig(); Client client = ClientBuilder.newClient(config); target = client.target(uri); setupResources(); Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 36 Unported License }
  • 37. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Standardized REST Client API Example (2) private static List<Poll> setupResources() { List<Poll> updatedPolls = Arrays.asList(SAMPLE_POLLS) .stream().map(poll -> { try{ Poll updatedPoll =target.request(APPLICATION_JSON) .post(Entity.entity(poll, APPLICATION_JSON), Poll.class); if(updatedPoll != null) forCleanup(updatedPoll); return updatedPoll; } catch (Exception e) { … } return null; }).collect(Collectors.toList()); return updatedPolls; Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 37 Unported License }
  • 38. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Standardized REST Client API Example (3) @Test public void testGetAllPollsJSONReturnsNotNull() { List<Poll> allPolls = target.request(APPLICATION_JSON) .get(new GenericType<List<Poll>>(){}); assertNotNull(allPolls); } @Test public void testGetPollByIdReturns404ForNonexisitingResource() { Response resp =target.path(Long.toString(NONEXISTING_POLL_ID)) .request(APPLICATION_JSON).get(); assertEquals("Status code not 404", 404, resp.getStatus()); assertThat("Response does not contain espected string: '" , resp.readEntity(String.class), containsString( NONEXISTING_POLL_ID + " does not exist")); Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 38 Unported License }
  • 39. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Asynchronous HTTP Request Processing Allows for efficient non-blocking concurrency Useful for long running business operations – e.g. DB queries AsyncResponse generation can be suspended till results are ready and then resumed Both client and server side APIs available Different types of callback listeners can be registered to suspended response on server side: ResumeCallback – onResume() method CompletionCallback – onComplete(), onError() methods ConnectionCallback – onDisconnect() method Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 39 Unported License
  • 40. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 AsyncResponse Main Methods boolean cancel(Date retryAfter) – cancels processing boolean isCancelled() - checks if processing canceled boolean isDone() - checks if processing finished Collection<Class<?>> register(Class<?> callback) Collection<Class<?>> register(Object callback) - register asynchronous processing callback boolean resume(Object response) – resume suspended resp. boolean resume(Throwable response) – resume + exception boolean setTimeout(long time, TimeUnit unit) – set timeout void setTimeoutHandler(TimeoutHandler handler) Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 40 Unported License
  • 41. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Asynch Server-Side Processing Example (1) @GET @Produces(value = {APPLICATION_XML, APPLICATION_JSON}) @Asynchronous public void getAllPolls(@Suspended final AsyncResponse asyncResponse) { asyncResponse.setTimeoutHandler( (AsyncResponse aResp) -> { if(isBusy()) aResp.resume( new WebApplicationException( "Server is too busy. Try again later.", SERVICE_UNAVAILABLE)); //aResp.cancel(300); else aResp.setTimeout(10, SECONDS); }); asyncResponse.setTimeout(10, TimeUnit.SECONDS); asyncResponse.resume(doGetAllPolls(selfLink)); Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 41 Unported License }
  • 42. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Asynch Server-Side Processing Example (2) private static boolean isBusy() { return serverBusy; } private PollsRepresentation doGetAllPolls(Link selfLink){ return new PollsRepresentation( pollController.findPollEntities(), Arrays.asList(selfLink)); Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 42 Unported License }
  • 43. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Asynch Client-Side Processing Example (1) protected List<Poll> setupResourcesAsync() throws InterruptedException, ExecutionException{ List<Future<Poll>> updateFutures = Arrays.asList(SAMPLE_POLLS).stream() .map(poll -> { Future<Poll> updateFuture = target.request(APPLICATION_JSON) .async() .post(Entity.entity(poll, APPLICATION_XML), new InvocationCallback<Poll>(){ @Override public void completed(Poll updatedPoll) { forCleanup(updatedPoll); } @Override public void failed(Throwable throwable) {} }); return updateFuture; }).collect(Collectors.toList()); Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 43 Unported License
  • 44. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Asynch Client-Side Processing Example (2) do{ Thread.sleep(100); } while(!updateFutures.stream() .allMatch((Future<Poll> fp) -> fp.isDone())); //return collected results List<Poll> results = new ArrayList<>(); for(Future<Poll> fp: updateFutures){ Poll resPoll = fp.get(); if(resPoll != null) results.add(resPoll); } return results; Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 44 Unported License }
  • 45. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Declarative Validation Using Bean Validation 1.1 Method parameters: @GET @Path("/{id}") @Produces({APPLICATION_XML, APPLICATION_JSON}) public Response getPollById( @PathParam("id") @NotNull @Min(1) Long id) { ... } Beans fields & properties: @NotNull @Size(min = 1, max = 255) @Email @Basic(optional = false) private String email; Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 45 Unported License
  • 46. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Declarative Validation Using Bean Validation 1.1 Declarative validation annotations can be attached to: Request entity body @POST @Consumes({APPLICATION_XML, APPLICATION_JSON}) public Response addPoll(@Valid Poll poll) { ... } Response entity: @GET @Path("/count") @Produces(TEXT_PLAIN) @Pattern(regexp = "d+") public String getPollsCount() { return Integer.toString(pollController.getPollCount()); Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 46 Unported License }
  • 47. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Improved Server-Suggested Content Negotiation Client driven content negotiation has been traditional capability of HTTP protocol – for example: GET /polling/resources/polls HTTP/1.1 Host: localhost:8080 Accept: application/xml; q=0.5, application/json; q=0.4 Cache-Control: no-cache But when client does not specify Accept header preference? - Server can: @GET @Produces(value = {APPLICATION_XML + "; qs=0.75", APPLICATION_JSON + "; qs=0.9"}) public Collection<Poll> getAllPolls() { ...} Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 47 Unported License
  • 48. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Filters & Interceptors – Client & Server Aspect-oriented extensibility of request/response processing Resource Filters – very similar to “classical” HttpServlet filters, non wrapping, do not invoke next processors in the chain directly, can filter HttpRequest (ContainerRequestFilter, ClientRequestFilter) or HttpResponse (ContainerResponseFilter, ClientResponseFilter). can bypass the next filters and resources by calling: ContainerRequestContext.abortWith(javax.ws.rs.core.Response) Resource Interceptors – they “wrap” the call to the entity readers/writers by explicitly calling [Reader/Writer]InterceptorContext.proceed() to pass the input stream or entity body read / written by next interceptor / resource/ sub-resource method in the chain. Filters & interceptors can manipulate headers and entity body. The main difference is that filters can change the requested resource URI (if @PreMatching), while interceptors can not (they are executed after resource processing method has been matched). Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 48 Unported License
  • 49. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Filters & Interceptors – Client & Server Aspect-oriented extensibility of request/response processing Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 49 Unported License
  • 50. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 LoggingFilter Example (1) @Provider //@PreMatching @Priority(1000) @Logged public class LoggingFilter implements ContainerRequestFilter, ContainerResponseFilter { @Override public void filter(ContainerRequestContext requestContext) { Logger.getLogger("Logging Resource Request >>>>> ", LoggingFilter.class).log(Level.INFO, "Method: " + requestContext.getMethod() + ", URI: " + requestContext.getUriInfo().getAbsolutePath() + ", Headers: " + requestContext.getHeaders() ); Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 50 Unported License }
  • 51. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 LoggingFilter Example (2) @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) { Logger.getLogger("Logging Service Response >>>>> ", LoggingFilter.class).log(Level.INFO, "Method: " + requestContext.getMethod()+ ", URI: " + requestContext.getUriInfo().getAbsolutePath() + ", Status Code: " + responseContext.getStatus() + ", MIME Type: " + responseContext.getHeaders() + ", Entity Body: " + responseContext.getEntity() Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 51 Unported License ); } }
  • 52. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 @Logged + @NameBinding Example (1) @NameBinding @Retention(value = RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface Logged { } @GET @Logged @Profiled @Path("/{id}") @Produces({APPLICATION_XML, APPLICATION_JSON}) public Response getPollById( @PathParam("id") @NotNull @Min(1) Long id) { ... } Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 52 Unported License
  • 53. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 AddSelfLinkInterceptor Example (1) @Provider @SelfLinked public class AddSelfLinkInterceptor implementsWriterInterceptor{ @Context UriInfo uriInfo; @Override public void aroundWriteTo(WriterInterceptorContext responseContext)throws WebApplicationException, IOException{ List<Object> links = responseContext.getHeaders().get("Link"); if(links == null) links = new ArrayList<>(); links.add("<" + uriInfo.getAbsolutePath() + ">; rel=self"); responseContext.getHeaders().put("Link", links); responseContext.proceed(); } } Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 53 Unported License
  • 54. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Dynamic extension registration using DynamicFeature interface Allows dynamic programmatic registration of post-matching providers during JAX-RS setup at deployment time public void configure(ResourceInfo resourceInfo, FeatureContext context) method called for each resource allows to dynamically decide during application configuration phase which ContainerRequestFilter, ContainerResponseFilter, ReaderInterceptor, WriterInterceptor, and Feature classes to register for that resource / subresource class / method (based on annotations provided for the method for example) May be annotated with @Provider annotation to be dynamically discovered Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 54 Unported License
  • 55. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 DynamicFeature Example (1) @Provider public class SelfLinkingDynamicFeature implements DynamicFeature{ @Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { if(resourceInfo.getResourceMethod() .isAnnotationPresent(GET.class) ||resourceInfo.getResourceMethod() .isAnnotationPresent(POST.class) ){ context.register(AddSelfLinkInterceptor.class); } Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 55 Unported License } }
  • 56. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Hypermedia As The Engine Of Application State (HATEOAS) – Document Links Example (1) @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name="poll") public class PollRepresentationDocumentLinks { private Long id; private PollStatus status = PollStatus.CREATED; private String title; private String question; private Date start; private Date end; @XmlElementWrapper(name = "_embedded") @XmlElement(name = "alternative") private List<Alternative> alternatives; @XmlElementWrapper(name = "_links") @XmlElement(name = "link") @XmlJavaTypeAdapter(JaxbAdapter.class) private Collection<Link> links; ... Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 56 Unported License
  • 57. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Hypermedia As The Engine Of Application State (HATEOAS) – New Link Header (RFC 5988) (2) Response resp = Response.ok( new PollRepresentationHeaderLinks(poll)) .links(links.toArray(new Link[]{})); Content-Length →1656 Content-Type →application/xml Link →<http://localhost:8080/polling/resources/polls/629>; rel="prev"; type="application/json"; title="Previous poll", <http://localhost:8080/polling/resources/polls/632>; rel="next"; type="application/json"; title="Next poll", <http://localhost:8080/polling/resources/polls>; rel="collection"; type="application/json"; title="Polls collection", <http://localhost:8080/polling/resources/polls>; rel="collection up"; type="application/json"; title="Root resource", <http://localhost:8080/polling/resources/polls/630>; rel="self"; type="application/json"; title="Self link", <http://localhost:8080/polling/resources/polls/630>; rel=self Server →GlassFish Server Open Source Edition 4.1 Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 57 Unported License
  • 58. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Want to Learn More? Welcome to IPT Java™ trainings [http://iproduct.org/]: Programming in Java Language - 3 modules Web Programming with Java Technology: Servlet 3.1, JSP, JSTL, EL, JSF 2.2, Facelets & Templating, AJAX, JSON, WebSocket, SSE, WebRTC Java Enterprise Technologies (Java EE 7) – EJB 3.2, JSF 2.2, JAX-RS 2.0, Web Services, WebSocket, JMS, CDI, Bean Validation, JPA, JTA, Batch and Concurrency Service Oriented Architecture (SOA) & Contemporary Standards for Business Process Modeling (BPM) – Apache AXIS 2 & CXF, Glassfish Metro & Jersey, JBoss RESTEasy, SoapUI & Service Testing, SOAP, WSDL 2.0, WS-*, SOA, SCA, SDO, BPMN, WS-BPEL Java™ Portlet Development with JSR 286: Portlet 2.0 API, Liferay® 6 & GateIn 3 – JSP™, JSF 2.2, Spring & AJAX Portlets Oracle®, Java™ and JavaScript™ are trademarks or registered trademarks of Oracle and/or its affiliates. Liferay® is a registered trademark of Liferay, Inc. Other names may be trademarks of their respective owners. Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 58 Unported License
  • 59. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 References R. Fielding, Architectural Styles and the Design of Networkbased Software Architectures, PhD Thesis, University of California, Irvine, 2000 Fielding's blog discussing REST – http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven Representational state transfer (REST) in Wikipedia – http://en.wikipedia.org/wiki/Representational_state_transfer Hypermedia as the Engine of Application State (HATEOAS) in Wikipedia – http://en.wikipedia.org/wiki/HATEOAS JavaScript Object Notation (JSON) – http://www.json.org/ JAX-RS 2.0 (JSR 339) Reference Implementation for building RESTful Web services – http://jersey.java.net/ Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 59 Unported License
  • 60. IPT – Intellectual Products & Technologies Trayan Iliev, http://www.iproduct.org/ BGOUG Meeting – Pravets November 14, 2014 Thanks for Your Attention! Questions? Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Slide 60 Unported License