SlideShare a Scribd company logo
1 of 22
A RESTy-JSON API
with spray.io and maven
sponsored by special appearance
Ignasi Marimon-Clos i Sunyol
@ignasi35
#scalabcn
Sunday, June 16, 13
thanks!
Sunday, June 16, 13
special thank you’s
JPradel (@agile_jordi): review and organization
JCasadellà (@jcasadella): review
JRudolph for simplifying step 4
https://github.com/jrudolph/scala-meetup-spray/commit/
c4991938ec7b26b183d701aac73949e7822cf45e
Sunday, June 16, 13
about me
n. /iŋ'nazi/
1) problem solver, Garbage Collector, mostly
java, learning scala, some agile
2) kayaker
3) under construction
4) wears glasses
Sunday, June 16, 13
what we saw
• BDD (cucumber)
• TDD (scalatest)
• sbt (inifinite run)
• intelliJ
• JAX-RS
• Jetty
https://github.com/funcio/bdd-jaxrs-hands-on
Sunday, June 16, 13
what we’ll see
• BDD (cucumber)
• TDD (scalatest)
• sbt (inifinite run)
• intelliJ
• JAX-RS
• Jetty
• BDD (jbehave?)
• TDD (scalatest)
• mvn (infinite run)
• eclipse (worksheet)
• spray-can/https/...
• spray-json
https://github.com/ignasi35/scala-meetup-spray
Sunday, June 16, 13
why? (1/2)
• I’m comfy with eclipse
• I’m comfy with maven (I know that’s weird)
• (no more)Typesafe delivers a prepacked env
• still there s/where
• eclipse-maven integration is solid
• I needed infinite-test in maven at work
• I like trolling Jordi and Jose
Sunday, June 16, 13
why? (2/2)
• spray.io has akka
• spray 1.x has akka 2.x
• spray.io is modularized (that’s useful)
• I don’t need java API (@see play)
• spray-json is f*&[ing simple (via shapeless)
http://spray.io/project-info/current-versions/
Sunday, June 16, 13
why? (bonus)
• spray.io beats all other JVM stacks/fw (*)
http://www.techempower.com/benchmarks/
Sunday, June 16, 13
spray
modules
provided
provided
There’s more provided dep’s
than those labelled but we don’t
need that level of detail now.
credit: graphic made using yuml.me
http://yuml.me/diagram/scruffy/class/[A]->[B],[A]->[C],[B]->[C]
Sunday, June 16, 13
spray
• One thing done right
• spray-routing => simple entry point.
• @sirthias (Mathias Doenitz) in Akka 2.2
• magnet pattern
• alternate to method overload
• IOBridge, directives, Marshallers, ...???
Sunday, June 16, 13
Sunday, June 16, 13
step 1
• Given an HTTP server
• When I GET /hello
• Then I obtain “hello”
Sunday, June 16, 13
step 1 (tips)
• Edit a web.xml
• Create a mapping
• Provide a BeanConnectionBeanFactory
• Add a servers.xml
• Invoke the Olds Gods and the New
Sunday, June 16, 13
specially dedicated to @ch4lit
Sunday, June 16, 13
step 2
• Given an HTTP server
• When I GET /hello.json
• Then I obtain “{msg:‘world’}”
Sunday, June 16, 13
directives + complete
• path/pathPrefix/pathTest
• authenticate
• get/post/delete/...
• decodeRequest/encodeResponse/...
• cache/alwaysCache/...
• complete
http://spray.io/documentation/spray-routing/predefined-directives-alphabetically/
Sunday, June 16, 13
step 3
• Given an HTTP server
• When I GET /books.json
• Then I obtain the complete books stock
Sunday, June 16, 13
step 4
• Given an HTTP server
• And I POST a book.txt in /books
• When I GET /books.json
• Then I obtain the updated books stock
MEGA-KUDOS to
https://github.com/jrudolph
Sunday, June 16, 13
step 5
• Given an HTTP server
• And a programmatic HTTP client
• When I GET /hello.json
• Then I obtain “{msg:‘world’}”
Sunday, June 16, 13
conclusions
• scala in maven is tough
• mvn plugin lacks infini-run, infini-install,...
• scala worksheet rocks
• spray allows a quick entry point
• docs and examples still to be improved
• because I’m very dumb
• ...
Sunday, June 16, 13
thanks!
Sunday, June 16, 13

More Related Content

Viewers also liked

Pesticide Training Course UC Davis, Safety. Part 5 of 5
Pesticide Training Course UC Davis, Safety. Part 5 of 5Pesticide Training Course UC Davis, Safety. Part 5 of 5
Pesticide Training Course UC Davis, Safety. Part 5 of 5UC Davis
 
Ppt microencapsulation
Ppt microencapsulationPpt microencapsulation
Ppt microencapsulationSANA TABASSUM
 
SPM Paper 2 Esei: FORCE AND PRESSURE
SPM Paper 2 Esei: FORCE AND PRESSURESPM Paper 2 Esei: FORCE AND PRESSURE
SPM Paper 2 Esei: FORCE AND PRESSURESuriyati Yusoff
 
power-plant-basics
power-plant-basicspower-plant-basics
power-plant-basicskulanji Siva
 
Blood Bank Management System (including UML diagrams)
Blood Bank Management System (including UML diagrams)Blood Bank Management System (including UML diagrams)
Blood Bank Management System (including UML diagrams)Harshil Darji
 
Flowchart Diagram Templates by Creately
Flowchart Diagram Templates by CreatelyFlowchart Diagram Templates by Creately
Flowchart Diagram Templates by CreatelyCreately
 

Viewers also liked (12)

Final Presentation
Final PresentationFinal Presentation
Final Presentation
 
Pesticide Training Course UC Davis, Safety. Part 5 of 5
Pesticide Training Course UC Davis, Safety. Part 5 of 5Pesticide Training Course UC Davis, Safety. Part 5 of 5
Pesticide Training Course UC Davis, Safety. Part 5 of 5
 
Ppt microencapsulation
Ppt microencapsulationPpt microencapsulation
Ppt microencapsulation
 
Tuna
Tuna Tuna
Tuna
 
SPM Paper 2 Esei: FORCE AND PRESSURE
SPM Paper 2 Esei: FORCE AND PRESSURESPM Paper 2 Esei: FORCE AND PRESSURE
SPM Paper 2 Esei: FORCE AND PRESSURE
 
Hptlc (rajat)
Hptlc  (rajat)Hptlc  (rajat)
Hptlc (rajat)
 
Chemical Reactors
Chemical ReactorsChemical Reactors
Chemical Reactors
 
power-plant-basics
power-plant-basicspower-plant-basics
power-plant-basics
 
Blood Bank Management System (including UML diagrams)
Blood Bank Management System (including UML diagrams)Blood Bank Management System (including UML diagrams)
Blood Bank Management System (including UML diagrams)
 
Ceramics
CeramicsCeramics
Ceramics
 
Bank Management System
Bank Management SystemBank Management System
Bank Management System
 
Flowchart Diagram Templates by Creately
Flowchart Diagram Templates by CreatelyFlowchart Diagram Templates by Creately
Flowchart Diagram Templates by Creately
 

Similar to Spray & Maven Intro for Scala Barcelona Developers Meetup

Odnoklassniki.ru Architecture
Odnoklassniki.ru ArchitectureOdnoklassniki.ru Architecture
Odnoklassniki.ru ArchitectureDmitry Buzdin
 
The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9jClarity
 
Ab(Using) the MetaCPAN API for Fun and Profit v2013
Ab(Using) the MetaCPAN API for Fun and Profit v2013Ab(Using) the MetaCPAN API for Fun and Profit v2013
Ab(Using) the MetaCPAN API for Fun and Profit v2013Olaf Alders
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Martijn Verburg
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
Ljc conf open jdk betterrev bof
Ljc conf open jdk betterrev bofLjc conf open jdk betterrev bof
Ljc conf open jdk betterrev bofMani Sarkar
 
萬國之津梁
萬國之津梁萬國之津梁
萬國之津梁charsbar
 
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...PatrickCrompton
 
Java Advanced Features (TCF 2014)
Java Advanced Features (TCF 2014)Java Advanced Features (TCF 2014)
Java Advanced Features (TCF 2014)Michael Redlich
 
Lessons from 4 years of driver develoment
Lessons from 4 years of driver develomentLessons from 4 years of driver develoment
Lessons from 4 years of driver develomentchristkv
 
“Webmapping Solutions: Technology & Tips” -- November 13, 2013
“Webmapping Solutions: Technology & Tips” -- November 13, 2013“Webmapping Solutions: Technology & Tips” -- November 13, 2013
“Webmapping Solutions: Technology & Tips” -- November 13, 2013Aerial Services
 
How Build Infrastructure Powers the Node.js Foundation
How Build Infrastructure Powers the Node.js FoundationHow Build Infrastructure Powers the Node.js Foundation
How Build Infrastructure Powers the Node.js FoundationGibson Fahnestock
 
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013gwhathistory
 
Apcug 2011 07-17-intro_to_drupal_jeff_schuler
Apcug 2011 07-17-intro_to_drupal_jeff_schulerApcug 2011 07-17-intro_to_drupal_jeff_schuler
Apcug 2011 07-17-intro_to_drupal_jeff_schulerhewie
 
Roll your own web crawler. RubyDay 2013
Roll your own web crawler. RubyDay 2013Roll your own web crawler. RubyDay 2013
Roll your own web crawler. RubyDay 2013Francesco Laurita
 
Laug comet intro july 2010
Laug comet intro july 2010Laug comet intro july 2010
Laug comet intro july 2010Skills Matter
 
London Ajax User Group Meetup: Comet Panel
London Ajax User Group Meetup: Comet PanelLondon Ajax User Group Meetup: Comet Panel
London Ajax User Group Meetup: Comet Paneldylanks
 
Open GeoData, Open GeoTools: An Introduction
Open GeoData, Open GeoTools: An IntroductionOpen GeoData, Open GeoTools: An Introduction
Open GeoData, Open GeoTools: An IntroductionRichard Cantwell
 

Similar to Spray & Maven Intro for Scala Barcelona Developers Meetup (20)

Odnoklassniki.ru Architecture
Odnoklassniki.ru ArchitectureOdnoklassniki.ru Architecture
Odnoklassniki.ru Architecture
 
The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9
 
Ab(Using) the MetaCPAN API for Fun and Profit v2013
Ab(Using) the MetaCPAN API for Fun and Profit v2013Ab(Using) the MetaCPAN API for Fun and Profit v2013
Ab(Using) the MetaCPAN API for Fun and Profit v2013
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
 
sbt 1
sbt 1sbt 1
sbt 1
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
Ljc conf open jdk betterrev bof
Ljc conf open jdk betterrev bofLjc conf open jdk betterrev bof
Ljc conf open jdk betterrev bof
 
萬國之津梁
萬國之津梁萬國之津梁
萬國之津梁
 
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
eSynergy Andy Hawkins - Enabling DevOps through next generation configuration...
 
Java Advanced Features (TCF 2014)
Java Advanced Features (TCF 2014)Java Advanced Features (TCF 2014)
Java Advanced Features (TCF 2014)
 
Lessons from 4 years of driver develoment
Lessons from 4 years of driver develomentLessons from 4 years of driver develoment
Lessons from 4 years of driver develoment
 
“Webmapping Solutions: Technology & Tips” -- November 13, 2013
“Webmapping Solutions: Technology & Tips” -- November 13, 2013“Webmapping Solutions: Technology & Tips” -- November 13, 2013
“Webmapping Solutions: Technology & Tips” -- November 13, 2013
 
How Build Infrastructure Powers the Node.js Foundation
How Build Infrastructure Powers the Node.js FoundationHow Build Infrastructure Powers the Node.js Foundation
How Build Infrastructure Powers the Node.js Foundation
 
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
 
Apcug 2011 07-17-intro_to_drupal_jeff_schuler
Apcug 2011 07-17-intro_to_drupal_jeff_schulerApcug 2011 07-17-intro_to_drupal_jeff_schuler
Apcug 2011 07-17-intro_to_drupal_jeff_schuler
 
Roll your own web crawler. RubyDay 2013
Roll your own web crawler. RubyDay 2013Roll your own web crawler. RubyDay 2013
Roll your own web crawler. RubyDay 2013
 
Laug comet intro july 2010
Laug comet intro july 2010Laug comet intro july 2010
Laug comet intro july 2010
 
London Ajax User Group Meetup: Comet Panel
London Ajax User Group Meetup: Comet PanelLondon Ajax User Group Meetup: Comet Panel
London Ajax User Group Meetup: Comet Panel
 
Open GeoData, Open GeoTools: An Introduction
Open GeoData, Open GeoTools: An IntroductionOpen GeoData, Open GeoTools: An Introduction
Open GeoData, Open GeoTools: An Introduction
 
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
Javantura v4 - CroDuke Indy and the Kingdom of Java Skills - Branko Mihaljevi...
 

More from Ignasi Marimon-Clos i Sunyol (9)

The Emperor Has No Docs (Geecon Oct'23)
The Emperor Has No Docs (Geecon Oct'23)The Emperor Has No Docs (Geecon Oct'23)
The Emperor Has No Docs (Geecon Oct'23)
 
Jeroglificos, Minotauros y la factura de la luz
Jeroglificos, Minotauros y la factura de la luzJeroglificos, Minotauros y la factura de la luz
Jeroglificos, Minotauros y la factura de la luz
 
Contributing to Akka (Hacktoberfest 2020)
Contributing to Akka (Hacktoberfest 2020)Contributing to Akka (Hacktoberfest 2020)
Contributing to Akka (Hacktoberfest 2020)
 
Contributing to OSS (Scalator 2020-01-22)
Contributing to OSS (Scalator 2020-01-22)Contributing to OSS (Scalator 2020-01-22)
Contributing to OSS (Scalator 2020-01-22)
 
Reactive Microsystems (Sw Crafters Barcelona 2018)
Reactive Microsystems (Sw Crafters Barcelona 2018)Reactive Microsystems (Sw Crafters Barcelona 2018)
Reactive Microsystems (Sw Crafters Barcelona 2018)
 
Lagom Workshop BarcelonaJUG 2017-06-08
Lagom Workshop  BarcelonaJUG 2017-06-08Lagom Workshop  BarcelonaJUG 2017-06-08
Lagom Workshop BarcelonaJUG 2017-06-08
 
Functional Programming in JAVA 8
Functional Programming in JAVA 8Functional Programming in JAVA 8
Functional Programming in JAVA 8
 
Scala 101-bcndevcon
Scala 101-bcndevconScala 101-bcndevcon
Scala 101-bcndevcon
 
Scala 101
Scala 101Scala 101
Scala 101
 

Recently uploaded

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 

Spray & Maven Intro for Scala Barcelona Developers Meetup

  • 1. A RESTy-JSON API with spray.io and maven sponsored by special appearance Ignasi Marimon-Clos i Sunyol @ignasi35 #scalabcn Sunday, June 16, 13
  • 3. special thank you’s JPradel (@agile_jordi): review and organization JCasadellà (@jcasadella): review JRudolph for simplifying step 4 https://github.com/jrudolph/scala-meetup-spray/commit/ c4991938ec7b26b183d701aac73949e7822cf45e Sunday, June 16, 13
  • 4. about me n. /iŋ'nazi/ 1) problem solver, Garbage Collector, mostly java, learning scala, some agile 2) kayaker 3) under construction 4) wears glasses Sunday, June 16, 13
  • 5. what we saw • BDD (cucumber) • TDD (scalatest) • sbt (inifinite run) • intelliJ • JAX-RS • Jetty https://github.com/funcio/bdd-jaxrs-hands-on Sunday, June 16, 13
  • 6. what we’ll see • BDD (cucumber) • TDD (scalatest) • sbt (inifinite run) • intelliJ • JAX-RS • Jetty • BDD (jbehave?) • TDD (scalatest) • mvn (infinite run) • eclipse (worksheet) • spray-can/https/... • spray-json https://github.com/ignasi35/scala-meetup-spray Sunday, June 16, 13
  • 7. why? (1/2) • I’m comfy with eclipse • I’m comfy with maven (I know that’s weird) • (no more)Typesafe delivers a prepacked env • still there s/where • eclipse-maven integration is solid • I needed infinite-test in maven at work • I like trolling Jordi and Jose Sunday, June 16, 13
  • 8. why? (2/2) • spray.io has akka • spray 1.x has akka 2.x • spray.io is modularized (that’s useful) • I don’t need java API (@see play) • spray-json is f*&[ing simple (via shapeless) http://spray.io/project-info/current-versions/ Sunday, June 16, 13
  • 9. why? (bonus) • spray.io beats all other JVM stacks/fw (*) http://www.techempower.com/benchmarks/ Sunday, June 16, 13
  • 10. spray modules provided provided There’s more provided dep’s than those labelled but we don’t need that level of detail now. credit: graphic made using yuml.me http://yuml.me/diagram/scruffy/class/[A]->[B],[A]->[C],[B]->[C] Sunday, June 16, 13
  • 11. spray • One thing done right • spray-routing => simple entry point. • @sirthias (Mathias Doenitz) in Akka 2.2 • magnet pattern • alternate to method overload • IOBridge, directives, Marshallers, ...??? Sunday, June 16, 13
  • 13. step 1 • Given an HTTP server • When I GET /hello • Then I obtain “hello” Sunday, June 16, 13
  • 14. step 1 (tips) • Edit a web.xml • Create a mapping • Provide a BeanConnectionBeanFactory • Add a servers.xml • Invoke the Olds Gods and the New Sunday, June 16, 13
  • 15. specially dedicated to @ch4lit Sunday, June 16, 13
  • 16. step 2 • Given an HTTP server • When I GET /hello.json • Then I obtain “{msg:‘world’}” Sunday, June 16, 13
  • 17. directives + complete • path/pathPrefix/pathTest • authenticate • get/post/delete/... • decodeRequest/encodeResponse/... • cache/alwaysCache/... • complete http://spray.io/documentation/spray-routing/predefined-directives-alphabetically/ Sunday, June 16, 13
  • 18. step 3 • Given an HTTP server • When I GET /books.json • Then I obtain the complete books stock Sunday, June 16, 13
  • 19. step 4 • Given an HTTP server • And I POST a book.txt in /books • When I GET /books.json • Then I obtain the updated books stock MEGA-KUDOS to https://github.com/jrudolph Sunday, June 16, 13
  • 20. step 5 • Given an HTTP server • And a programmatic HTTP client • When I GET /hello.json • Then I obtain “{msg:‘world’}” Sunday, June 16, 13
  • 21. conclusions • scala in maven is tough • mvn plugin lacks infini-run, infini-install,... • scala worksheet rocks • spray allows a quick entry point • docs and examples still to be improved • because I’m very dumb • ... Sunday, June 16, 13