0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)
50 Ansichten42 Seiten
Play Framework and Modern Java Web App Development Josh Padnick Desert Code Camp 2013. Founder and Chief Innovation Officer at Omedix 10+ years of web app development Special interest in scalable, enterprise, web-based applications using Java and open source.
Play Framework and Modern Java Web App Development Josh Padnick Desert Code Camp 2013. Founder and Chief Innovation Officer at Omedix 10+ years of web app development Special interest in scalable, enterprise, web-based applications using Java and open source.
Play Framework and Modern Java Web App Development Josh Padnick Desert Code Camp 2013. Founder and Chief Innovation Officer at Omedix 10+ years of web app development Special interest in scalable, enterprise, web-based applications using Java and open source.
Special interest in scalable, enterprise, web-based
applications using Java & open source J o s h
P a d n i c k Java Web App Development Today C h a l l e n g e s
o f ^ Lots of Time Waiting for Server Redeploys SOURCE FOR INSIGHT: The Play Framework at LinkedIn: Productivity and Performance at Scale by Yevjeniy Brikman http://www.youtube.com/watch?v=8z3h4Uv9YbE
SOURCE FOR GRAPHIC: http://zeroturnaround.com/rebellabs/java-ee-productivity-report-2011/#redeploy_times Long, Ugly Error Messages SOURCE: FOR INSIGHT: The Play Framework at LinkedIn: Productivity and Performance at Scale by Yevjeniy Brikman http://www.youtube.com/watch?v=8z3h4Uv9YbE
SOURCE FOR GRAPHIC: http://ptrthomas.wordpress.com/2006/06/06/java-call-stack-from-http-upto-jdbc-as-a-picture/
MVC Action AOP TX Proxy Business Logic DAO Spring-Hibernate Hibernate JDBC Spring WebFIow Acegi Spring MVC Tomcat / JBoss <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet> <servlet-name>mvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <!-- we'll use AnnotationConfigWebApplicationContext instead of the default XmlWebApplicationContext... --> <init-param> <param-name>contextClass</param-name> <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value> </init-param>
<!-- ... and tell it which class contains the configuration --> <init-param> <param-name>contextConfigLocation</param-name> <param-value>com.zt.helloWeb.init.WebappConfig</param-value> </init-param>
</web-app> DefaultServletHandler Crazy XML Conguration SOURCE FOR INSIGHT: The Play Framework at LinkedIn: Productivity and Performance at Scale by Yevjeniy Brikman http://www.youtube.com/watch?v=8z3h4Uv9YbE Bean Failures org.omg.CORBA.OBJECT_NOT_EXIST SOURCE FOR GRAPHIC: Beginning Java EE 6 Platform with Glasssh 3 by Antonio Goncalves, Page 5. X Clunky Road to RESTful URLs WEB.XML <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping>
CONTROLLER.JAVA @Controller @RequestMapping("/people") public class PeopleController {
@RequestMapping(entrypoint/{collectionName}, method=RequestMethod.GET) public @ResponseBody String getPeople() { return GsonFactory.getInstance().toJson(LookupDao.getInstance().getPeople()); }
@RequestMapping(value="{id}", method=RequestMethod.GET) public @ResponseBody String getPerson(@PathVariable String id) { return GsonFactory.getInstance().toJson(LookupDao.getInstance().getPerson(id)); } } A Lot of Complexity! I just want to write working software! Is this the architecture we would create today? The root of the problem Impedance Mismatch between HTTP and Java EE! RESTful URLs vs. Java Servlets Spec Impedance Mismatch Stateless HTTP vs. Stateful EJBs SOURCE: http://cscie12.dce.harvard.edu/lecture_notes/2011/20110504/handout.html SOURCE: Beginning Java EE 6 Platform with Glasssh 3 by Antonio Goncalves, Page 206. Impedance Mismatch Impedance Mismatch Code & Refresh vs. WAR Deployment Modern Web App Development Buzzwords! HTML5 & Javascript MVVM Frameworks Mobile NoSQL Real-Time Big Data Asynchronous Immutability Connected Devices Reactive Software http://www.ReactiveManifesto.org/ The Reactive Manifesto Up to now the usual way to describe this type of application has been to use a mix of technical and business buzzwords; asynchronous, non-blocking, real-time, highly-available, loosely coupled, scalable, fault- tolerant, concurrent, reactive, event-driven, push instead of pull, distributed, low latency, high throughput, etc. This does not help communication, quite the contrary, it greatly hinders it. SOURCE: http://typesafe.com/blog/why_do_we_need_a_reactive_manifesto Jonas Bonr Reactive Software SOURCE: http://www.ReactiveManifesto.org/ Meet Play Framework Goal: Performance + Productivity Performance P r o d u c t i v i t y SOURCE: http://typesafe.com/blog/webinar-a-java-developers-primer-to-the-typesafe-platform No More JEE Container SOURCE: Play for Java by Nicolas Leroux and Sietse de Kaper Focused on Developer Productivity
Live code changes when you refresh the browser
More friendly error messages directly in browser
Type safety in the templates
Cool console & build tools
Designed for the Modern Web
RESTful by default
Auto-compile LESS and CoffeeScript les
JSON is a rst-class citizen
Websockets, other HTTP Streaming Support
Stateless and Built for Scale
Forces every aspect of your app to be stateless
Non-Blocking I/O
Well-suited for real-time
What exactly is it, though? SOURCE: Play for Java by Nicolas Leroux and Sietse de Kaper What exactly is it, though? Integrated HTTP Server JBoss Netty (Non-Blocking IO) Concurrent, Distributed, Fault-Tolerant Background Processing Akka Build System & Console SBT Java Virtual Machine Template Engine, HTTP Request/Response Processing, Integrated Cache, RESTful Routing Engine, Asset Compilation, Internationalization, Testing Tools Play Framework eBean / Anorm BoneCP H2 Database Lots of libraries Of course, nothings perfect 1. You can mostly avoid Scala, but not completely (of course, Scala itself is pretty cool) 2. For advanced build logic, SBT has a steep learning curve 3. Template system works well, but sometimes the functional paradigm can feel awkward Lets around! Intro Stuff 1. Download and install 2. Play Console 3. Controllers 4. URL Routing 5. Templates Intro Stuff 1. Download and install 2. Play Console 3. Controllers 4. URL Routing 5. Templates Intro Stuff 1. Download and install 2. Play Console 3. Controllers 4. URL Routing 5. Templates Intro Stuff 1. Download and install 2. Play Console 3. Controllers 4. URL Routing 5. Templates Intro Stuff 1. Download and install 2. Play Console 3. Controllers 4. URL Routing 5. Templates Intro Stuff 1. Download and install 2. Play Console 3. Controllers 4. URL Routing 5. Templates Lets Build Something in the Time Remaining So what did you like best today?
Well take some votes and show the results real-time
Learning Play Framework
I preferred the books to the documentation
For ofcial documentation, best formatting is on
playframework.com. Latest content is on github (https://github.com/playframework/playframework/tree/master/documentation/manual)