SlideShare uma empresa Scribd logo
1 de 43
Agenda
What is CRUD?
What is REST?
What is Spring?
What is HATEOAS?
What is Microservice?
So… hands on!
What is CRUD?
“In computer programming, create, read, update and delete
(as an acronym CRUD) (Sometimes called SCRUD with an "S" for
Search) are the four basic functions of persistent storage.”
 http://en.wikipedia.org/wiki/Create,_read,_update_and_delete
What is REST?
“Representational state transfer (REST) is an abstraction of the
architecture of the World Wide Web; more precisely, REST is an
architectural style consisting of a coordinated set of
architectural constraints applied to components, connectors,
and data elements, within a distributed hypermedia system.”
http://en.wikipedia.org/wiki/REST
Basic CRUD with REST
Operation HTTP / REST
Create PUT / POST
Read (Retrieve) GET
Update (Modify) PUT / PATCH
Delete (Destroy) DELETE
What is Spring?
“The Spring Framework is an open source application
framework and inversion of control container for the Java
platform.”
http://en.wikipedia.org/wiki/Spring_Framework
Inversion of control container is also called dependency
injection
Supports many templating engines for web-service and also
full-featured dynamic web-sites.
Support for popular Frameworks such as Bootstrap, Vaadin,
Thymleaf, etc. etc. etc.
Inversion of control container / dependency
injection:
Rather than instantiating an object using the new keyword, the
container injects (and manages) a reference for you.
This may seem just a delegation swap, but it has important
implications for the scope of those objects.
You have seem dependency injection in FXML already.
Inversion of control container is also called dependency
injection
What is HATEOAS?
“HATEOAS, an abbreviation for Hypermedia as the Engine of
Application State, is a constraint of the REST application
architecture that distinguishes it from most other network
application architectures.”
http://en.wikipedia.org/wiki/HATEOAS
HATEOAS representations/addresses
<person xmlns:atom="http://www.w3.org/2005/Atom">
<firstname>Dave</firstname>
<lastname>Matthews</lastname>
<links>
<atom:link rel="self" href="http://myhost/people/1" />
</links>
</person>
XML
{ firstname : "Dave",
lastname : "Matthews",
links : [ { rel : "self", href : "http://myhost/people/1" } ] }
JSON
What is Microservice?
“The term "Microservice Architecture" has sprung up over the last
few years to describe a particular way of designing software
applications as suites of independently deployable services.”
 http://martinfowler.com/articles/microservices.html
What are “Web Services”?
 A service is a software entity that can be discovered and
invoked by other software systems.
More precisely: Web Service

A web service is just a web page meant for a computer to request and
process

More precisely, a Web service is a Web page that’s meant to be
consumed by an autonomous program as opposed to a Web browser
which is for human consumption.
Microservices Reference
The “ID” on a HATEOAS system is mainly an URI
 Example: If you create a “teacher”, his “id” will be
“http://localhost:8080/teacher/1” instead of just “1”.
Then, each Microservice can reference other services entities.
13
14
http://spring.io/projects
15
16
Spring Boot uses convention over configuration
A very basic app
>my first spring app
@RestController is used in conjunction with @RequestMapping
What is a bean?
> add Service implementation details
There are four types of beans that spring will manage: component,
service, controller, repository
Controller: often times a RestController which defines routes, produces and
consumes defintions.
Service: This is where you put your business logic. Typically defined as an
interface to CRUD + L.
Repository: defines low-level DB operations, mostly inherited.
Component: everything else.
REST
What is REST ?
REST is a term coined by Roy Fielding to describe an
architecture style of networked systems. REST is an
acronym standing for REpresentational State Transfer.
 Resource (web server)
 URI-Uniform Resource
Identifier (or URL)
 Web Page (HTML Page)
Two Fundamental Aspects of the REST
Design Pattern
 Resources
Every distinguishable entity is a resource. A resource
may be a Web site, an HTML page, an XML document,
a Web service, a physical device, etc.
 URLs Identify Resources
Every resource is uniquely identified by a URL. This is
Tim Berners-Lee Web Design, Axiom 0.
22
Why is it called Representational State Transfer ?
Client Resource
http://weather.example.com/oaxaca
OaxacaWeather.html
"Representational State Transfer is intended to evoke an image of
how a well-designed Web application behaves: a network of web
pages (a virtual state-machine), where the user progresses
through an application by selecting links (state transitions),
resulting in the next page (representing the next state of the
application) being transferred to the user and rendered for their
use."
Roy Fielding.
REST and HTTP

HTTP 1.1 was designed to conform to REST

Its methods are defined well enough to get work done

Unsurprisingly, HTTP is the most RESTful protocol

But it's possible to apply REST concepts to other protocols and systems
REST - An Architectural Style of Networked System
Utilize the underlying architectural model of the world
wide web – rather than inventing your own.
Guiding framework for Web protocol standards.
REST based web services
Online shopping
Search services
Dictionary services
Characteristics of a REST based network
 Client-Server: a pull-based interaction style(Client request data from servers as
and when needed).
 Stateless: each request from client to server must contain all the information
necessary to understand the request, and cannot take advantage of any stored
context on the server.
 Cache: to improve network efficiency, responses must be capable of being
labeled as cacheable or non-cacheable.
 Uniform interface: all resources are accessed with a generic interface (e.g.,
HTTP GET, POST, PUT, DELETE).
 Named resources - the system is comprised of resources which are named
using a URL.
 Interconnected resource representations - the representations of the
resources are interconnected using URLs, thereby enabling a client to progress
from one state to another, and to communicate statelessly to whichever
resource it needs on the web.
Web Design, Axiom 0
(Tim Berners-Lee, director of W3C)
 Axiom 0: all resources on the Web must be uniquely identified
with a URI.
28
resource1
URL1
resource2
URL2
resource3
URL3
Approach 2:
URLs are Cheap! Use Them!
The airline provides several URLs - one URL for premier members,
a different URL for frequent flyers, and still another for regular
customers.
29
Premier Members
Frequent Flyer Members
Regular Members
client
client
client
http://www.kings-air/reservations/premier
http://www.kings-air/reservations/frequent-flyer
http://www.kings-air/reservations/regular
Premier
Member
Reservation
Service
Frequent
Flyer
Reservation
Service
Regular
Member
Reservation
Service
This Ain't the
REST Design Pattern
30
Premier Members
Frequent Flyer Members
Regular Members
Airline Reservation
Answering
Machine
Premier
Customer
Representative
F.F.
Customer
Representative
Regular
Customer
Representative
“press 7 to be
connected to the
Executive club”
This is the
REST Design Pattern
31
Premier Members
Frequent Flyer Members
Regular Members
1-800-Premier
Premier
Customer
Representative
F.F.
Customer
Representative
Regular
Customer
Representative
1-800-Frequent
1-800-Reservation
Numbers are cheap, use them.
This ain't the
REST Design Pattern
32
Premier Members
Frequent Flyer Members
Regular Members
Reservation
Web
Service
Determine
Priority
Premier
Customer
F.F.
Customer
Regular
Customer
client
client
client
This is the
REST Design Pattern
33
Premier Members
Frequent Flyer Members
Regular Members
client
client
client
http://www.kings-air/reservations/premier
http://www.kings-air/reservations/frequent-flyer
http://www.kings-air/reservations/regular
Premier
Member
Reservation
Service
Frequent
Flyer
Reservation
Service
Regular
Member
Reservation
Service
URLs are cheap, use them.
34
35
36
200 ok
404 not found
Etc.
inspect element/network
 View amazon.com
 Right click | inspect element in chrome
 Click network
 Examine the response codes
37
Content Negotiation
 Right click | inspect elemernt
 Click network
38
Atividade – Construindo uma tela de
busca de endereço
Eu. como usuário do sistema, preciso de uma tela que busque na base
dos correios as informações de endereço completo, passando para isso
o CEP do logradouro.
Para resolver este caso vamos implementar um sistema que funcione
desta forma:
•Usar o selenium para buscar as informações na página dos Correios;
•Usar SpringBoot para criar o Service Rest que exporá as informações
de CEP para os consumidores;
Busca CEP
Recursos
Representação
Main

Mais conteúdo relacionado

Semelhante a Treinamento 1

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
 
Web 2 0 Fullfeatures
Web 2 0 FullfeaturesWeb 2 0 Fullfeatures
Web 2 0 Fullfeaturesguest9b7f4753
 
Components of a Generic Web Application Architecture
Components of  a Generic Web Application ArchitectureComponents of  a Generic Web Application Architecture
Components of a Generic Web Application ArchitectureMadonnaLamin1
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-servicesrporwal
 
4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.ppt4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.pptMatthew Perrins
 
Fullstack Interview Questions and Answers.pdf
Fullstack Interview Questions and Answers.pdfFullstack Interview Questions and Answers.pdf
Fullstack Interview Questions and Answers.pdfcsvishnukumar
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIsKnoldus Inc.
 
Cloud platforms and frameworks
Cloud platforms and frameworksCloud platforms and frameworks
Cloud platforms and frameworksAnimesh Chaturvedi
 
SOA Fundamentals
SOA  FundamentalsSOA  Fundamentals
SOA Fundamentalsabhi1112
 
Talking to 25% of the web - In-depth report and analysis on the WordPress RES...
Talking to 25% of the web - In-depth report and analysis on the WordPress RES...Talking to 25% of the web - In-depth report and analysis on the WordPress RES...
Talking to 25% of the web - In-depth report and analysis on the WordPress RES...Stephane Beladaci
 
Realizing Service Finder at ESTC 2008
Realizing Service Finder at ESTC 2008Realizing Service Finder at ESTC 2008
Realizing Service Finder at ESTC 2008Emanuele Della Valle
 
Web Server Hardware and Software
Web Server Hardware and SoftwareWeb Server Hardware and Software
Web Server Hardware and Softwarewebhostingguy
 
Fundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersFundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersLemi Orhan Ergin
 

Semelhante a Treinamento 1 (20)

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
 
Web 2 0 Fullfeatures
Web 2 0 FullfeaturesWeb 2 0 Fullfeatures
Web 2 0 Fullfeatures
 
Components of a Generic Web Application Architecture
Components of  a Generic Web Application ArchitectureComponents of  a Generic Web Application Architecture
Components of a Generic Web Application Architecture
 
Unit 2
Unit 2Unit 2
Unit 2
 
Microsoft Web Technology Stack
Microsoft Web Technology StackMicrosoft Web Technology Stack
Microsoft Web Technology Stack
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
 
4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.ppt4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.ppt
 
Rest surekha
Rest surekhaRest surekha
Rest surekha
 
REST Presentation
REST PresentationREST Presentation
REST Presentation
 
Fullstack Interview Questions and Answers.pdf
Fullstack Interview Questions and Answers.pdfFullstack Interview Questions and Answers.pdf
Fullstack Interview Questions and Answers.pdf
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
REST full API Design
REST full API DesignREST full API Design
REST full API Design
 
sMash_for_zOS-users
sMash_for_zOS-userssMash_for_zOS-users
sMash_for_zOS-users
 
Cloud platforms and frameworks
Cloud platforms and frameworksCloud platforms and frameworks
Cloud platforms and frameworks
 
Cloud Platforms & Frameworks
Cloud Platforms & FrameworksCloud Platforms & Frameworks
Cloud Platforms & Frameworks
 
SOA Fundamentals
SOA  FundamentalsSOA  Fundamentals
SOA Fundamentals
 
Talking to 25% of the web - In-depth report and analysis on the WordPress RES...
Talking to 25% of the web - In-depth report and analysis on the WordPress RES...Talking to 25% of the web - In-depth report and analysis on the WordPress RES...
Talking to 25% of the web - In-depth report and analysis on the WordPress RES...
 
Realizing Service Finder at ESTC 2008
Realizing Service Finder at ESTC 2008Realizing Service Finder at ESTC 2008
Realizing Service Finder at ESTC 2008
 
Web Server Hardware and Software
Web Server Hardware and SoftwareWeb Server Hardware and Software
Web Server Hardware and Software
 
Fundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-DevelopersFundamentals of Web Development For Non-Developers
Fundamentals of Web Development For Non-Developers
 

Mais de Carlos Melo

Gestão de projetos introduçao
Gestão de projetos introduçaoGestão de projetos introduçao
Gestão de projetos introduçaoCarlos Melo
 
Roteiro da aula prática de sexta à tarde
Roteiro da aula prática de sexta à tardeRoteiro da aula prática de sexta à tarde
Roteiro da aula prática de sexta à tardeCarlos Melo
 
5a.aulacapacitor
5a.aulacapacitor5a.aulacapacitor
5a.aulacapacitorCarlos Melo
 
Atividade final acionamentos
Atividade final   acionamentosAtividade final   acionamentos
Atividade final acionamentosCarlos Melo
 
Questões clp-automação
Questões clp-automaçãoQuestões clp-automação
Questões clp-automaçãoCarlos Melo
 
Apresentação12
Apresentação12Apresentação12
Apresentação12Carlos Melo
 
Gestão da manutenção os 2
Gestão da manutenção os 2Gestão da manutenção os 2
Gestão da manutenção os 2Carlos Melo
 
Gestão da manutenção os 1
Gestão da manutenção os 1Gestão da manutenção os 1
Gestão da manutenção os 1Carlos Melo
 
Desenho técnico cap1
Desenho técnico   cap1Desenho técnico   cap1
Desenho técnico cap1Carlos Melo
 
Eletrônica básica
Eletrônica básicaEletrônica básica
Eletrônica básicaCarlos Melo
 
Analise de circuito indutores
Analise de circuito   indutoresAnalise de circuito   indutores
Analise de circuito indutoresCarlos Melo
 
Notas ete jags - destec
Notas ete   jags - destecNotas ete   jags - destec
Notas ete jags - destecCarlos Melo
 
Ucr3 fundamentos mecanica_sa1_suporte dosador_1_22_mai12
Ucr3 fundamentos mecanica_sa1_suporte dosador_1_22_mai12Ucr3 fundamentos mecanica_sa1_suporte dosador_1_22_mai12
Ucr3 fundamentos mecanica_sa1_suporte dosador_1_22_mai12Carlos Melo
 
Recuperação descrição
Recuperação   descriçãoRecuperação   descrição
Recuperação descriçãoCarlos Melo
 
Ete projetos elétricos 2
Ete projetos elétricos 2Ete projetos elétricos 2
Ete projetos elétricos 2Carlos Melo
 
Uc3.desenho técnico aplicado_a_eletromecânica (1)
Uc3.desenho técnico aplicado_a_eletromecânica (1)Uc3.desenho técnico aplicado_a_eletromecânica (1)
Uc3.desenho técnico aplicado_a_eletromecânica (1)Carlos Melo
 

Mais de Carlos Melo (20)

Zener
ZenerZener
Zener
 
Gestão de projetos introduçao
Gestão de projetos introduçaoGestão de projetos introduçao
Gestão de projetos introduçao
 
Capacitancia
CapacitanciaCapacitancia
Capacitancia
 
Roteiro da aula prática de sexta à tarde
Roteiro da aula prática de sexta à tardeRoteiro da aula prática de sexta à tarde
Roteiro da aula prática de sexta à tarde
 
5a.aulacapacitor
5a.aulacapacitor5a.aulacapacitor
5a.aulacapacitor
 
Atividade final acionamentos
Atividade final   acionamentosAtividade final   acionamentos
Atividade final acionamentos
 
Questões clp-automação
Questões clp-automaçãoQuestões clp-automação
Questões clp-automação
 
Apresentação12
Apresentação12Apresentação12
Apresentação12
 
Pneumática
PneumáticaPneumática
Pneumática
 
Gestão da manutenção os 2
Gestão da manutenção os 2Gestão da manutenção os 2
Gestão da manutenção os 2
 
Gestão da manutenção os 1
Gestão da manutenção os 1Gestão da manutenção os 1
Gestão da manutenção os 1
 
Desenho técnico cap1
Desenho técnico   cap1Desenho técnico   cap1
Desenho técnico cap1
 
Eletrônica básica
Eletrônica básicaEletrônica básica
Eletrônica básica
 
Analise de circuito indutores
Analise de circuito   indutoresAnalise de circuito   indutores
Analise de circuito indutores
 
Notas ete jags - destec
Notas ete   jags - destecNotas ete   jags - destec
Notas ete jags - destec
 
Ucr3 fundamentos mecanica_sa1_suporte dosador_1_22_mai12
Ucr3 fundamentos mecanica_sa1_suporte dosador_1_22_mai12Ucr3 fundamentos mecanica_sa1_suporte dosador_1_22_mai12
Ucr3 fundamentos mecanica_sa1_suporte dosador_1_22_mai12
 
Recuperação descrição
Recuperação   descriçãoRecuperação   descrição
Recuperação descrição
 
Recuperação 1
Recuperação 1Recuperação 1
Recuperação 1
 
Ete projetos elétricos 2
Ete projetos elétricos 2Ete projetos elétricos 2
Ete projetos elétricos 2
 
Uc3.desenho técnico aplicado_a_eletromecânica (1)
Uc3.desenho técnico aplicado_a_eletromecânica (1)Uc3.desenho técnico aplicado_a_eletromecânica (1)
Uc3.desenho técnico aplicado_a_eletromecânica (1)
 

Último

ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 

Último (20)

ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 

Treinamento 1

  • 1. Agenda What is CRUD? What is REST? What is Spring? What is HATEOAS? What is Microservice? So… hands on!
  • 2. What is CRUD? “In computer programming, create, read, update and delete (as an acronym CRUD) (Sometimes called SCRUD with an "S" for Search) are the four basic functions of persistent storage.”  http://en.wikipedia.org/wiki/Create,_read,_update_and_delete
  • 3. What is REST? “Representational state transfer (REST) is an abstraction of the architecture of the World Wide Web; more precisely, REST is an architectural style consisting of a coordinated set of architectural constraints applied to components, connectors, and data elements, within a distributed hypermedia system.” http://en.wikipedia.org/wiki/REST
  • 4. Basic CRUD with REST Operation HTTP / REST Create PUT / POST Read (Retrieve) GET Update (Modify) PUT / PATCH Delete (Destroy) DELETE
  • 5. What is Spring? “The Spring Framework is an open source application framework and inversion of control container for the Java platform.” http://en.wikipedia.org/wiki/Spring_Framework Inversion of control container is also called dependency injection Supports many templating engines for web-service and also full-featured dynamic web-sites. Support for popular Frameworks such as Bootstrap, Vaadin, Thymleaf, etc. etc. etc.
  • 6. Inversion of control container / dependency injection: Rather than instantiating an object using the new keyword, the container injects (and manages) a reference for you. This may seem just a delegation swap, but it has important implications for the scope of those objects. You have seem dependency injection in FXML already. Inversion of control container is also called dependency injection
  • 7. What is HATEOAS? “HATEOAS, an abbreviation for Hypermedia as the Engine of Application State, is a constraint of the REST application architecture that distinguishes it from most other network application architectures.” http://en.wikipedia.org/wiki/HATEOAS
  • 8. HATEOAS representations/addresses <person xmlns:atom="http://www.w3.org/2005/Atom"> <firstname>Dave</firstname> <lastname>Matthews</lastname> <links> <atom:link rel="self" href="http://myhost/people/1" /> </links> </person> XML { firstname : "Dave", lastname : "Matthews", links : [ { rel : "self", href : "http://myhost/people/1" } ] } JSON
  • 9. What is Microservice? “The term "Microservice Architecture" has sprung up over the last few years to describe a particular way of designing software applications as suites of independently deployable services.”  http://martinfowler.com/articles/microservices.html
  • 10. What are “Web Services”?  A service is a software entity that can be discovered and invoked by other software systems.
  • 11. More precisely: Web Service  A web service is just a web page meant for a computer to request and process  More precisely, a Web service is a Web page that’s meant to be consumed by an autonomous program as opposed to a Web browser which is for human consumption.
  • 12. Microservices Reference The “ID” on a HATEOAS system is mainly an URI  Example: If you create a “teacher”, his “id” will be “http://localhost:8080/teacher/1” instead of just “1”. Then, each Microservice can reference other services entities.
  • 13. 13
  • 15. 15
  • 16. 16 Spring Boot uses convention over configuration
  • 17. A very basic app >my first spring app @RestController is used in conjunction with @RequestMapping
  • 18. What is a bean? > add Service implementation details There are four types of beans that spring will manage: component, service, controller, repository Controller: often times a RestController which defines routes, produces and consumes defintions. Service: This is where you put your business logic. Typically defined as an interface to CRUD + L. Repository: defines low-level DB operations, mostly inherited. Component: everything else.
  • 19. REST
  • 20. What is REST ? REST is a term coined by Roy Fielding to describe an architecture style of networked systems. REST is an acronym standing for REpresentational State Transfer.
  • 21.  Resource (web server)  URI-Uniform Resource Identifier (or URL)  Web Page (HTML Page)
  • 22. Two Fundamental Aspects of the REST Design Pattern  Resources Every distinguishable entity is a resource. A resource may be a Web site, an HTML page, an XML document, a Web service, a physical device, etc.  URLs Identify Resources Every resource is uniquely identified by a URL. This is Tim Berners-Lee Web Design, Axiom 0. 22
  • 23. Why is it called Representational State Transfer ? Client Resource http://weather.example.com/oaxaca OaxacaWeather.html
  • 24. "Representational State Transfer is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use." Roy Fielding.
  • 25. REST and HTTP  HTTP 1.1 was designed to conform to REST  Its methods are defined well enough to get work done  Unsurprisingly, HTTP is the most RESTful protocol  But it's possible to apply REST concepts to other protocols and systems
  • 26. REST - An Architectural Style of Networked System Utilize the underlying architectural model of the world wide web – rather than inventing your own. Guiding framework for Web protocol standards. REST based web services Online shopping Search services Dictionary services
  • 27. Characteristics of a REST based network  Client-Server: a pull-based interaction style(Client request data from servers as and when needed).  Stateless: each request from client to server must contain all the information necessary to understand the request, and cannot take advantage of any stored context on the server.  Cache: to improve network efficiency, responses must be capable of being labeled as cacheable or non-cacheable.  Uniform interface: all resources are accessed with a generic interface (e.g., HTTP GET, POST, PUT, DELETE).  Named resources - the system is comprised of resources which are named using a URL.  Interconnected resource representations - the representations of the resources are interconnected using URLs, thereby enabling a client to progress from one state to another, and to communicate statelessly to whichever resource it needs on the web.
  • 28. Web Design, Axiom 0 (Tim Berners-Lee, director of W3C)  Axiom 0: all resources on the Web must be uniquely identified with a URI. 28 resource1 URL1 resource2 URL2 resource3 URL3
  • 29. Approach 2: URLs are Cheap! Use Them! The airline provides several URLs - one URL for premier members, a different URL for frequent flyers, and still another for regular customers. 29 Premier Members Frequent Flyer Members Regular Members client client client http://www.kings-air/reservations/premier http://www.kings-air/reservations/frequent-flyer http://www.kings-air/reservations/regular Premier Member Reservation Service Frequent Flyer Reservation Service Regular Member Reservation Service
  • 30. This Ain't the REST Design Pattern 30 Premier Members Frequent Flyer Members Regular Members Airline Reservation Answering Machine Premier Customer Representative F.F. Customer Representative Regular Customer Representative “press 7 to be connected to the Executive club”
  • 31. This is the REST Design Pattern 31 Premier Members Frequent Flyer Members Regular Members 1-800-Premier Premier Customer Representative F.F. Customer Representative Regular Customer Representative 1-800-Frequent 1-800-Reservation Numbers are cheap, use them.
  • 32. This ain't the REST Design Pattern 32 Premier Members Frequent Flyer Members Regular Members Reservation Web Service Determine Priority Premier Customer F.F. Customer Regular Customer client client client
  • 33. This is the REST Design Pattern 33 Premier Members Frequent Flyer Members Regular Members client client client http://www.kings-air/reservations/premier http://www.kings-air/reservations/frequent-flyer http://www.kings-air/reservations/regular Premier Member Reservation Service Frequent Flyer Reservation Service Regular Member Reservation Service URLs are cheap, use them.
  • 34. 34
  • 35. 35
  • 36. 36 200 ok 404 not found Etc.
  • 37. inspect element/network  View amazon.com  Right click | inspect element in chrome  Click network  Examine the response codes 37
  • 38. Content Negotiation  Right click | inspect elemernt  Click network 38
  • 39. Atividade – Construindo uma tela de busca de endereço Eu. como usuário do sistema, preciso de uma tela que busque na base dos correios as informações de endereço completo, passando para isso o CEP do logradouro. Para resolver este caso vamos implementar um sistema que funcione desta forma: •Usar o selenium para buscar as informações na página dos Correios; •Usar SpringBoot para criar o Service Rest que exporá as informações de CEP para os consumidores;
  • 43. Main