O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Otavio Santana
@otaviojava
HTTP / 1, HTTP /
2 and HTTP / 3:
Past, present and
the future of
APIs
Roan Brasil
@roanbrasil
Otavio Santana
@otaviojava
DevRel Engineer
+ Java Champion
+ JCP-EC-EG-EGL
+ Apache Committer
+ Eclipse Committer
+ Eclips...
Roan Brasil
@roanbrasil
Senior Engineer
+ JCP-Member
+ Open Source Contributor
+ Book and blog writer
+ Teacher
Speaker
History of HTTP
The Past, The Present and the Future
HTTP 0.9 HTTP 1.0 HTTP 1.1 HTTP 2 HTTP 3
1991 1996 1999 2015 2018
PAS...
Three-way handshake - TCP Protocol
Sync
Sync/ACK
ACK
Response
Request
HTTP
● Resources
● client-server
How it works
● Method
● Path
● Version of the protocol
● Headers
● Cache
How it works
● Method
● Path
● Version of the protocol
● Headers
● Cache
HTTP
● Resources
● client-server
GET / HTTP/1.1
Host: developer.mozilla.org
Accept-Language: fr
HTTP/1.1 200 OK
Date: Sat,...
HTTP Status
● 1xx informational response
● 2xx successful
● 3xx redirection
● 4xx client error
● 5xx server error
1XX
● 100 Continue
● 101 Switching Protocols
● 102 Processing (WebDAV; RFC 2518)
● 103 Early Hints (RFC 8297)
2XX
● 200 OK
● 201 Created
● 202 Accepted
● 203 Non-Authoritative Information
● 204 No Content
● 205 Reset Content
● 206 P...
3XX
● 300 Multiple Choice
● 301 Moved Permanently
● 302 Found
● 303 See Other
● 304 Not Modified
● 305 Use Proxy
● 306 unus...
4XX
● 400 Bad Request
● 401 Unauthorized
● 402 Payment Required
● 403 Forbidden
● 404 Not Found
● 405 Method Not Allowed
●...
5XX
● 500 Internal Server Error
● 501 Not Implemented
● 502 Bad Gateway
● 503 Service Unavailable
● 504 Gateway Timeout
● ...
HTTP 1.1 - Rest
REST is acronym for REpresentational State Transfer. It is architectural style
for distributed hypermedia ...
Rest - Example
Api Design
● API
● Contract First
● Contract Last
Glory of Rest
● Richardson Maturity Model
○ Model of Restful Maturity
○ Integration Problems
Glory of Rest
● Level 0
○ HTTP - transport system for
remote interactions
● Level 1
○ Individual Resources
● Level 2
○ POS...
HTTP/2
● In 2009, Mike Belshe and
Roberto Peon of Google proposed
SPDY
● HTTP/2 replaces SPDY
● Same semantics HTTP/1.x
● ...
HTTP/2 - Response Multiplex
What is GRPC?
gRPC is a modern open source high performance remote procedure call (RPC) framework
that can run in any envi...
Types of GRPC
Where must I use GRPC?
● Microservices
○ Low-latency and high-throughput communication
○ Strong API contract
● Polyglot en...
HTTP/2 and GRPC - Client
HTTP/2 and GRPC - Server
HTTP/2 and Java 9
try {
HttpClient httpClient = HttpClient.newHttpClient(); //Create a HttpClient
System.out.println(httpC...
Servlet 4.0
@WebServlet(value = {"/http2"})
public class Http2Servlet extends HttpServlet {
@Override
protected void doGet...
What is RSocket?
RSocket is a binary protocol, bi-directional, multiplexed, message-based based on
Reactive Streams semant...
RSocket - Client
RSocket - Server
HTTP/1.1 x HTTP/2
HTTP/1.1 x HTTP/2
Architecture Trends 2020
HTTP 3 - The Future
HTTP/1.1 x HTTP/2 x HTTP/3
HTTP/1.1 x HTTP/2 x HTTP/3
HTTP 3 - The Future
What is new in HTTP 3?
● It is a 3rd version of Hypertext Transfer Protocol (HTTP)
● New protocol spec...
HTTP 3 - QUIC - The Future
QUIC - Quick UDP Internet Connections
● Designed in 2012 by Jim Roskind at Google
● Reduce conn...
HTTP 3 - Flupke
String url = "https://platform.sh/";
URI serverUrl = URI.create(url);
HttpRequest request = HttpRequest.ne...
Q&A Thank you
Próximos SlideShares
Carregando em…5
×
Próximos SlideShares
What to Upload to SlideShare
Avançar
Transfira para ler offline e ver em ecrã inteiro.

3

Compartilhar

Baixar para ler offline

HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs

Baixar para ler offline

HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs

HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs

  1. 1. Otavio Santana @otaviojava HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs Roan Brasil @roanbrasil
  2. 2. Otavio Santana @otaviojava DevRel Engineer + Java Champion + JCP-EC-EG-EGL + Apache Committer + Eclipse Committer + Eclipse Project Leader + Book and blog writer Speaker
  3. 3. Roan Brasil @roanbrasil Senior Engineer + JCP-Member + Open Source Contributor + Book and blog writer + Teacher Speaker
  4. 4. History of HTTP The Past, The Present and the Future HTTP 0.9 HTTP 1.0 HTTP 1.1 HTTP 2 HTTP 3 1991 1996 1999 2015 2018 PAST PRESENT FUTURE
  5. 5. Three-way handshake - TCP Protocol Sync Sync/ACK ACK Response Request
  6. 6. HTTP ● Resources ● client-server
  7. 7. How it works ● Method ● Path ● Version of the protocol ● Headers ● Cache
  8. 8. How it works ● Method ● Path ● Version of the protocol ● Headers ● Cache
  9. 9. HTTP ● Resources ● client-server GET / HTTP/1.1 Host: developer.mozilla.org Accept-Language: fr HTTP/1.1 200 OK Date: Sat, 09 Oct 2010 14:28:02 GMT Server: Apache Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT ETag: "51142bc1-7449-479b075b2891b" Accept-Ranges: bytes Content-Length: 29769 Content-Type: text/html <!DOCTYPE html... (here comes the 29769 bytes of the requested web page)
  10. 10. HTTP Status ● 1xx informational response ● 2xx successful ● 3xx redirection ● 4xx client error ● 5xx server error
  11. 11. 1XX ● 100 Continue ● 101 Switching Protocols ● 102 Processing (WebDAV; RFC 2518) ● 103 Early Hints (RFC 8297)
  12. 12. 2XX ● 200 OK ● 201 Created ● 202 Accepted ● 203 Non-Authoritative Information ● 204 No Content ● 205 Reset Content ● 206 Partial Content ● 207 Multi-Status ● 208 Already Reported ● 226 IM Used
  13. 13. 3XX ● 300 Multiple Choice ● 301 Moved Permanently ● 302 Found ● 303 See Other ● 304 Not Modified ● 305 Use Proxy ● 306 unused ● 307 Temporary Redirect ● 308 Permanent Redirect
  14. 14. 4XX ● 400 Bad Request ● 401 Unauthorized ● 402 Payment Required ● 403 Forbidden ● 404 Not Found ● 405 Method Not Allowed ● 406 Not Acceptable ● 407 Proxy Authentication Required ● 408 Request Timeout ● 409 Conflict ● 410 Gone
  15. 15. 5XX ● 500 Internal Server Error ● 501 Not Implemented ● 502 Bad Gateway ● 503 Service Unavailable ● 504 Gateway Timeout ● 505 HTTP Version Not Supported ● 506 Variant Also Negotiates ● 507 Insufficient Storage (WebDAV) ● 508 Loop Detected (WebDAV) ● 510 Not Extended ● 511 Network Authentication Required
  16. 16. HTTP 1.1 - Rest REST is acronym for REpresentational State Transfer. It is architectural style for distributed hypermedia systems and was first presented by Roy Fielding in 2000 in his famous dissertation.
  17. 17. Rest - Example
  18. 18. Api Design ● API ● Contract First ● Contract Last
  19. 19. Glory of Rest ● Richardson Maturity Model ○ Model of Restful Maturity ○ Integration Problems
  20. 20. Glory of Rest ● Level 0 ○ HTTP - transport system for remote interactions ● Level 1 ○ Individual Resources ● Level 2 ○ POST ○ GET ○ DELETE ○ PATCH / PUT ● Level 3 ○ HATEOAS (Hypertext As The Engine Of Application State)
  21. 21. HTTP/2 ● In 2009, Mike Belshe and Roberto Peon of Google proposed SPDY ● HTTP/2 replaces SPDY ● Same semantics HTTP/1.x ● Binary Protocol ● Introduced to improve performance ● HTTPBis Working Group ○ Specification HTTP ○ RFC 7540 ○ HPACK - RFC 7541
  22. 22. HTTP/2 - Response Multiplex
  23. 23. What is GRPC? gRPC is a modern open source high performance remote procedure call (RPC) framework that can run in any environment. Initially developed at Google 2015 using HTTP/2 protocol. Use protobuf as a mechanism for serializing structure data. https://grpc.io/ https://developers.google.com/protocol-buffers/
  24. 24. Types of GRPC
  25. 25. Where must I use GRPC? ● Microservices ○ Low-latency and high-throughput communication ○ Strong API contract ● Polyglot environments ● Point-to-Point real time communication ○ Bidirectional streaming ● Network Constrained environments ○ Lightweight message format (mobile application)
  26. 26. HTTP/2 and GRPC - Client
  27. 27. HTTP/2 and GRPC - Server
  28. 28. HTTP/2 and Java 9 try { HttpClient httpClient = HttpClient.newHttpClient(); //Create a HttpClient System.out.println(httpClient.version()); HttpRequest httpRequest = HttpRequest.newBuilder() .uri(new URI("https://www.google.com/")).GET().build(); //Create a GET request for the given URI Map<String,List<String>> headers = httpRequest.headers().map(); headers.forEach((k, v) - > System.out.println(k + "-" + v)); HttpResponse < String > httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandler.asString()); } catch (Exception e) { System.out.println("message " + e); }
  29. 29. Servlet 4.0 @WebServlet(value = {"/http2"}) public class Http2Servlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { PushBuilder pushBuilder = req.newPushBuilder(); pushBuilder .path("images/kodedu-logo.png") .addHeader("content-type", "image/png") .push(); try(PrintWriter respWriter = resp.getWriter();){ respWriter.write("<html><img src='images/kodedu-logo.png'></html>"); } } }
  30. 30. What is RSocket? RSocket is a binary protocol, bi-directional, multiplexed, message-based based on Reactive Streams semantics. It provides support for four interaction models. It is transport protocol agnostic. https://rsocket.io/
  31. 31. RSocket - Client
  32. 32. RSocket - Server
  33. 33. HTTP/1.1 x HTTP/2
  34. 34. HTTP/1.1 x HTTP/2
  35. 35. Architecture Trends 2020
  36. 36. HTTP 3 - The Future
  37. 37. HTTP/1.1 x HTTP/2 x HTTP/3
  38. 38. HTTP/1.1 x HTTP/2 x HTTP/3
  39. 39. HTTP 3 - The Future What is new in HTTP 3? ● It is a 3rd version of Hypertext Transfer Protocol (HTTP) ● New protocol specification (not ready for production yet) ● Use the same semantics of HTTP/1.* and HTTP/2, such as GET and POST operation ● August-2020 became Internet-Draft
  40. 40. HTTP 3 - QUIC - The Future QUIC - Quick UDP Internet Connections ● Designed in 2012 by Jim Roskind at Google ● Reduce connection and transport latency ● Multiplexed transport over UDP ● Open source development in Chromium ● Google and Facebook are already using
  41. 41. HTTP 3 - Flupke String url = "https://platform.sh/"; URI serverUrl = URI.create(url); HttpRequest request = HttpRequest.newBuilder() .uri(serverUrl) .header("User-Agent", "Flupke http3 library") .timeout(Duration.ofSeconds(10)) .build(); HttpClient client = Http3Client.newHttpClient(); HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println("Got HTTP response " + httpResponse); System.out.println("- HTTP headers: " + httpResponse.headers());
  42. 42. Q&A Thank you
  • antoniolazarobr

    Sep. 1, 2020
  • niksrn2011

    Sep. 1, 2020
  • DanielSantos259

    Aug. 27, 2020

HTTP / 1, HTTP / 2 and HTTP / 3: Past, present and the future of APIs

Vistos

Vistos totais

197

No Slideshare

0

De incorporações

0

Número de incorporações

0

Ações

Baixados

6

Compartilhados

0

Comentários

0

Curtir

3

×