Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Rest Teoria E Pratica

4,876 views

Published on

Published in: Technology
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ...................................ALL FOR EBOOKS................................................. Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Rest Teoria E Pratica

  1. 1. RESTful Web Services Teoria e Prática Luiz Costa luiz.costa@caelum.com.br Sergio Junior sergio.junior@caelum.com.br
  2. 2. Integração O velho problema
  3. 3. O Banco de Dados Solução Prática #1
  4. 4. Transferência de Arquivos Solução Prática #2
  5. 5. Web Services Solução Prática #3
  6. 6. Como são os Web Services hoje? • Baseados na especificação WS-* • Descritores WSDL • SOAP e XML • Utilizam um estilo RPC(Remote Procedure Call) Focados em Operações
  7. 7. Foco nas operações Serviço Tradicional <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Body> <m:ObterPedidos xmlns:m=“urn:ServicosPedidos"> <id xsi:Type=‘xsd:integer’>12553</id> </m:ObterPedidos> </env:Body> </env:Envelope>
  8. 8. Foco nas operações Serviço Tradicional No matter how hard I try, I still think the WS-* stack is bloated, opaque, and insanely complex. I think it's going to be hard to understand, hard to implement, hard to interoperate, and hard to secure. Tim Bray Director of Web Technologies at Sun Microsystems. Fonte:http://qotd.me/q2004-11-02.html
  9. 9. Precisamos disso tudo? Alguém já não resolveu isso?
  10. 10. Web Como funciona?
  11. 11. Web http://aljazeera.com/
  12. 12. Web http://aljazeera.com/
  13. 13. Web apenas para humanos? “Não existe nenhuma diferença essencial entre a web humana e a web programável” Leonard Richardson e Sam Ruby
  14. 14. Características da Web • Tolerante a falhas • Escalável • Seguro • Baixo acoplamento
  15. 15. Características da Web • Tolerante a falhas • Escalável • Seguro • Baixo acoplamento Isso não se parece com as características que queremos em nossos sistemas hoje?
  16. 16. Architectural Styles and the Design of Network-based Software Architectures Dissertação de Doutorado – Roy Fielding - 2000
  17. 17. REST
  18. 18. REpresentational State Transfer O que é isso?
  19. 19. Recursos É algo interessante para sua aplicação. Fotos, relatorios, arquivos, Lista de buracos da BR 101. Tudo é um recurso.
  20. 20. Identidade de um Recurso Para ser encontrado o recurso precisa ser identificado. Todos os clientes http//exemplo.com/clientes Acessando um cliente http//exemplo.com/clientes/10 Acessando outro cliente http//exemplo.com/clientes/23
  21. 21. Link os Recursos Os dados do pedido junto com o cliente <cliente> <id> 23 </id> <nome>Joana Cardoso</nome> <cpf>12345678900</cpf> <pedidos> <pedido> <id>1234</id> <data> 01/10/2009</data> <valor> 100.00 </valor> <items> <produto>33</produto> <quantidade>1</quantidade> <preco>100.00</preco> </items> </pedido> </pedidos> </cliente>
  22. 22. Link os Recursos Os recursos devem estar ligados entre sí <cliente> <id>23</id> <nome>Joana Cardoso</nome> <cpf>12345678900</cpf> <pedidos> <pedido ref=’http://example.com/pedidos/ 1234’ /> </pedido> </pedidos> </cliente>
  23. 23. Interface Uniforme Mantendo as coisas simples
  24. 24. Interface Uniforme
  25. 25. Interface Uniforme Agora o foco são os Recursos.
  26. 26. Interface Uniforme Recurso /Pedidos/{Identificador} http://exemplo.com/pedidos/10 •GET() - obtém os detalhes de um pedido específico •PUT() - atualiza um pedido •POST() - adiciona um item  em um pedido •DELETE() – cancela um pedido
  27. 27. Interface Uniforme Recurso /Pedidos http://exemplo.com/pedidos •GET() - lista todos os pedidos •PUT() - não é utilizado aqui •POST() - adiciona um novo pedido •DELETE() – não é utilizado aqui
  28. 28. Mas e se alguma coisa der errado? Códigos de status do HTTP •100 – Continue •200 – OK •201 – Created •301 – Moved Permanently •303 – See Other •304 – Not Modified •400 – Bad Request •401 – Unauthorized •403 – Forbidden •404 – Not Found •405 – Method Not Allowed •500 – Internal Server Error
  29. 29. Representações Atom
  30. 30. Escolhendo uma Representação GET /pedidos/2009/11 HTTP 1.1 HOST exemplo.com Accept: application/xml 200 OK <pedido … />
  31. 31. Possíveis representações do recurso: http://exemplo.com/clientes/23 XHTML XML <html> <body> <dt>id</dt> <dd>23</dd> <cliente> <id> 23 </id> <dt>nome</dt> <nome>Joana Cardoso</nome> <dd>Joana Cardoso</dd> <cpf>12345678900</cpf> <dt>cpf</dt> </cliente> <dd>12345678901</dd> </body> </html>
  32. 32. Falta de Estado
  33. 33. Falta de Estado • Basicamente isso se traduz em não utilizar sessões HTTP. • Sem sessões, favorecemos a escalabilidade. • Os clientes precisam aprender a viver sem sessões.
  34. 34. Escalabilidade Falta de estado pode ser bom.
  35. 35. Escalabilidade Falta de estado pode ser bom.
  36. 36. Escalabilidade Falta de estado pode ser bom.
  37. 37. Escalabilidade Falta de estado pode ser bom.
  38. 38. Escalabilidade Falta de estado pode ser bom.
  39. 39. Escalabilidade Falta de estado pode ser bom.
  40. 40. Escalabilidade Falta de estado pode ser bom.
  41. 41. Escalabilidade Falta de estado pode ser bom.
  42. 42. Interface Uniforme(Web Server) Cliente (Web Client) Representação do Recursos Lógicos Recurso (e.g. XML document) Recursos físicos A arquitetura simplicidade
  43. 43. Demonstração show me the code!
  44. 44. Recursos Vamos identificar os recursos
  45. 45. Algumas Desvantagens • Um pouco mais trabalhoso • Sem geração automática de classes, tal como as IDE’s fazem com wsdl • A maioria dos proxies web “barram” requisições PUT. Conclusão Nem tudo são flores
  46. 46. Algumas Desvantagens • Um pouco mais trabalhoso • Sem geração automática de classes, tal como as IDE’s fazem com wsdl • A maioria dos proxies web “barram” requisições PUT. Algumas Vantagens • Para maioria dos servicos web o protocolo HTTP é suficiente • REST fornece múltiplas representações para os recursos. • REST tem altos níveis de interoperabilidade. Conclusão Nem tudo são flores
  47. 47. Algumas Desvantagens • Um pouco mais trabalhoso • Sem geração automática de classes, tal como as IDE’s fazem com wsdl • A maioria dos proxies web “barram” requisições PUT. Algumas Vantagens • Para maioria dos servicos web o protocolo HTTP é suficiente • REST fornece múltiplas representações para os recursos. • REST tem altos níveis de interoperabilidade. “Não é porque a WEB funciona que isso significa que REST é sempre a solução correta.” “REST é modelo viável para Web Services.” Conclusão Nem tudo são flores
  48. 48. Obrigado. Luiz Costa luiz.costa@caelum.com.br Sergio Junior sergio.junior@caelum.com.br FIM

×