Multi Client Development with SpringJosh LongSpring Developer AdvocateSpringSource, a Division of VMwarehttp://www.joshlon...
About SpringSource is the organization that develops the Spring framework, the leading enterprise Java framework SpringS...
About Josh LongSpring Developer Advocatetwitter: @starbuxmanjosh.long@springsource.com                             3
About Josh LongSpring Developer Advocatetwitter: @starbuxmanjosh.long@springsource.comContributor To:•Spring Integration•S...
multi client development with SpringSpring Primer                                       5
The Spring ApplicationContext Spring Beans are Managed by An ApplicationContext • whether you’re in an application server...
I want Database Access ... with Hibernate 4 Support @Service public class CustomerService {     public Customer createCust...
I want Database Access ... with Hibernate 4 Support @Service public class CustomerService {     @Inject     private Sessio...
I want Database Access ... with Hibernate 4 Support @Service public class CustomerService {     @Inject     private Sessio...
I want Declarative Cache Management... @Service public class CustomerService {     @Inject     private SessionFactory sess...
I want a RESTful Endpoint... package org.springsource.examples.spring31.web; .. @Controller public class CustomerControlle...
DEMO• the 80% case!                  Not confidential. Tell everyone.
multi client development with SpringSpring Web Support                                       13
Setting up Spring on the Web is Easy  <servlet>      <servlet-name>Spring Dispatcher Servlet</servlet-name>      <servlet-...
New in 3.1: XML-free web applications In a servlet 3 container, you can also use Java configuration, negating the need fo...
Thin, Thick, Web, Mobile and Rich Clients: Web Core Spring Dispatcher Servlet • Objects don’t have to be web-specific. • ...
Thin, Thick, Web, Mobile and Rich Clients: Web Core Spring provides the easiest way to integrate with your web framework ...
Thin, Thick, Web, Mobile and Rich Clients: Spring MVC                                                        18
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { }  ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config@Controllerpublic class CustomerController {    @R...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
DEMO Demos • Simple Spring MVC based Application                             Not confidential. Tell everyone.
multi client development with Springthe new hotness                                       30
dumb terminals ruled the earth....                                     31
then something magical happened: the web                                           32
but the web didn’t know how to do UI state... so we hacked...                                                             ...
....then the web stopped sucking                                   34
multi client development with SpringREST                                       35
Thin, Thick, Web, Mobile and Rich Clients: REST Origin • The term Representational State Transfer was introduced and defi...
REST on the Server Spring MVC is basis for REST support • Spring’s server side REST support is based on the standard cont...
REST on the Client RestTemplate • provides dead simple, idiomatic RESTful services consumption • can use Spring OXM, too....
Building clients for your RESTful services: RestTemplate Google search exampleRestTemplate restTemplate = new RestTemplat...
Thin, Thick, Web, Mobile and Rich Clients: RestTemplate RestTemplate class is the heart the client-side story • Entry poi...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController {    ...
DEMO Demos:• Spring REST service• Spring REST client                        Not confidential. Tell everyone.
DEMO Demos:• Using REST from Ajax                         Not confidential. Tell everyone.
multi client development with SpringSpring Mobile                                       46
Thin, Thick, Web, Mobile and Rich Clients: Mobile Best strategy? Develop Native • Fallback to client-optimized web applic...
DEMO Demos:• Mobile clients using client specific rendering                                  Not confidential. Tell every...
multi client development with SpringSpring Android                                       49
Thin, Thick, Web, Mobile and Rich Clients: Mobile               Spring REST is ideal for mobile devices               Sp...
OK, so.....              51
Thin, Thick, Web, Mobile and Rich Clients: Mobile     CustomerServiceClient - client!    private <T> T extractResponse( Re...
Thin, Thick, Web, Mobile and Rich Clients: Mobile Demos:• consuming the Spring REST service from Android
One Other approach                      HTML5 all the way!                      • HTML5 on the desktop browser interface ...
springsource.org | cloudfoundry.org            Questions?                 Say hi!@starbuxman | josh.long@springsource.com
Upcoming SlideShare
Loading in...5
×

Multi Client Development with Spring

3,484

Published on

spring, multi client, Android, REST, mobile, RIA, html5,

Published in: Technology, Business
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,484
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
154
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • \n
  • \n\n
  • Hello, thank you or having me. Im pleased to have the opportunity to introduce you today to Spring and the SpringSource Tool Suite \n\nMy anem is Josh Long. I serve as the developer advocate for the Spring framework. I&amp;#x2019;ve used it in earnest and advocated it for many years now. i&amp;#x2019;m an author on 3 books on the technology, as well as a comitter to many of the Spring projects. Additionally, I take community activism very seriously and do my best to participate in the community. Sometimes this means answering question on Twitter, or in the forums, or helping contribute to the InfoQ.com and Artima.com communities\n
  • Hello, thank you or having me. Im pleased to have the opportunity to introduce you today to Spring and the SpringSource Tool Suite \n\nMy anem is Josh Long. I serve as the developer advocate for the Spring framework. I&amp;#x2019;ve used it in earnest and advocated it for many years now. i&amp;#x2019;m an author on 3 books on the technology, as well as a comitter to many of the Spring projects. Additionally, I take community activism very seriously and do my best to participate in the community. Sometimes this means answering question on Twitter, or in the forums, or helping contribute to the InfoQ.com and Artima.com communities\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • \n
  • \n
  • \n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • Familiar to somebody who&amp;#x2019;s used Struts:\n Models (like Struts ActionForms)\n Views (like Struts views: tiles, .jsp(x)s, velocity, PDF, Excel, etc.) \n Controllers (like Struts Actions)\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pieces are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pieces are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • \n
  • \n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • \n
  • \n
  • \n
  • \n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • \n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • \n
  • talk about how convenient the messaging support is, then roll back and start looking at how u might do the same thing manually. Explain that many of the pices are already there, and then seguqe into a discussion about the core Spring APIs. Lets imagine we&amp;#x2019;re going to build ourselves a file system poller to notify us of when something&amp;#x2019;s happened on the file system\n\n
  • another example of the fact that often the client side model won&amp;#x2019;t represent the server side model \n\n
  • \n
  • Transcript of "Multi Client Development with Spring"

    1. 1. Multi Client Development with SpringJosh LongSpring Developer AdvocateSpringSource, a Division of VMwarehttp://www.joshlong.com || @starbuxman || josh.long@springsource.com © 2009 VMware Inc. All rights reserved
    2. 2. About SpringSource is the organization that develops the Spring framework, the leading enterprise Java framework SpringSource was acquired by VMware in 2009 VMware and SpringSource bring you to the cloud and deliver on the mission of “build, run, manage” • established partnerships with the major players in the business, including Adobe, SalesForce, and Google to help deliver the best experience for Spring users across multiple platforms Leading contributor to projects like Apache HTTPD and Apache Tomcat 2
    3. 3. About Josh LongSpring Developer Advocatetwitter: @starbuxmanjosh.long@springsource.com 3
    4. 4. About Josh LongSpring Developer Advocatetwitter: @starbuxmanjosh.long@springsource.comContributor To:•Spring Integration•Spring Batch•Spring Hadoop•Activiti Workflow Engine•Akka Actor engine 4
    5. 5. multi client development with SpringSpring Primer 5
    6. 6. The Spring ApplicationContext Spring Beans are Managed by An ApplicationContext • whether you’re in an application server, a web server, in regular Java SE application, in the cloud, Spring is initialized through an ApplicationContext • In a Java SE application: ApplicationContext ctx = new GenericAnnotationApplicationContext( “com.foo.bar.my.package”); • In a web application, you will configure an application context in your web.xml <servlet> <servlet-name>Spring Dispatcher Servlet</servlet-name> <servlet- class>org.springframework.web.servlet.DispatcherServlet</servlet- class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/myAppContext*.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> 6
    7. 7. I want Database Access ... with Hibernate 4 Support @Service public class CustomerService { public Customer createCustomer(String firstName, String lastName, Date signupDate) { ... } } CONFIDENTIAL 7
    8. 8. I want Database Access ... with Hibernate 4 Support @Service public class CustomerService { @Inject private SessionFactory sessionFactory; public Customer createCustomer(String firstName, String lastName, Date signupDate) { Customer customer = new Customer(); customer.setFirstName(firstName); customer.setLastName(lastName); customer.setSignupDate(signupDate); sessionFactory.getCurrentSession().save(customer); return customer; } } CONFIDENTIAL 8
    9. 9. I want Database Access ... with Hibernate 4 Support @Service public class CustomerService { @Inject private SessionFactory sessionFactory; @Transactional public Customer createCustomer(String firstName, String lastName, Date signupDate) { Customer customer = new Customer(); customer.setFirstName(firstName); customer.setLastName(lastName); customer.setSignupDate(signupDate); sessionFactory.getCurrentSession().save(customer); return customer; } } CONFIDENTIAL 9
    10. 10. I want Declarative Cache Management... @Service public class CustomerService { @Inject private SessionFactory sessionFactory; @Transactional @Cacheable(“customers”) public Customer createCustomer(String firstName, String lastName, Date signupDate) { Customer customer = new Customer(); customer.setFirstName(firstName); customer.setLastName(lastName); customer.setSignupDate(signupDate); sessionFactory.getCurrentSession().save(customer); return customer; } } CONFIDENTIAL 10
    11. 11. I want a RESTful Endpoint... package org.springsource.examples.spring31.web; .. @Controller public class CustomerController { @Inject private CustomerService customerService; @RequestMapping(value = "/customer/{id}", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody Customer customerById(@PathVariable("id") Integer id) { return customerService.getCustomerById(id); } ... } CONFIDENTIAL 11
    12. 12. DEMO• the 80% case! Not confidential. Tell everyone.
    13. 13. multi client development with SpringSpring Web Support 13
    14. 14. Setting up Spring on the Web is Easy <servlet> <servlet-name>Spring Dispatcher Servlet</servlet-name> <servlet- class>org.springframework.web.servlet.DispatcherServlet</servlet- class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/myAppContext*.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> 14
    15. 15. New in 3.1: XML-free web applications In a servlet 3 container, you can also use Java configuration, negating the need for web.xml: public class SampleWebApplicationInitializer implements WebApplicationInitializer { public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext ac = new AnnotationConfigWebApplicationContext(); ac.setServletContext(sc); ac.scan( “a.package.full.of.services”, “a.package.full.of.controllers” ); sc.addServlet("spring", new DispatcherServlet(webContext)); } } 15
    16. 16. Thin, Thick, Web, Mobile and Rich Clients: Web Core Spring Dispatcher Servlet • Objects don’t have to be web-specific. • Spring web supports lower-level web machinery: ‘ • HttpRequestHandler (supports remoting: Caucho, Resin, JAX RPC) • DelegatingFilterProxy. • HandlerInterceptor wraps requests to HttpRequestHandlers • ServletWrappingController lets you force requests to a servlet through the Spring Handler chain • OncePerRequestFilter ensures that an action only occurs once, no matter how many filters are applied. Provides a nice way to avoid duplicate filters • Spring provides access to the Spring application context using WebApplicationContextUtils, which has a static method to look up the context, even in environments where Spring isn’t managing the web components
    17. 17. Thin, Thick, Web, Mobile and Rich Clients: Web Core Spring provides the easiest way to integrate with your web framework of choice • Spring Faces for JSF 1 and 2 • Struts support for Struts 1 • Tapestry, Struts 2, Stripes, Wicket, Vaadin, Play framework, etc. • GWT, Flex
    18. 18. Thin, Thick, Web, Mobile and Rich Clients: Spring MVC 18
    19. 19. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { } 19
    20. 20. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config@Controllerpublic class CustomerController { @RequestMapping(value=”/url/of/my/resource”) public String processTheRequest() { // ... return “home”; }}GET http://127.0.0.1:8080/url/of/my/resource 20
    21. 21. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/resource”, method = RequestMethod.GET) public String processTheRequest() { // ... return “home”; } }GET http://127.0.0.1:8080/url/of/my/resource 21
    22. 22. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/resource”, method = RequestMethod.GET) public String processTheRequest( HttpServletRequest request) { String contextPath = request.getContextPath(); // ... return “home”; } }GET http://127.0.0.1:8080/url/of/my/resource 22
    23. 23. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/resource”, method = RequestMethod.GET) public String processTheRequest( @RequestParam(“search”) String searchQuery ) { // ... return “home”; } }GET http://127.0.0.1:8080/url/of/my/resource?search=Spring 23
    24. 24. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/{id}”, method = RequestMethod.GET) public String processTheRequest( @PathVariable(“id”) Long id) { // ... return “home”; } }GET http://127.0.0.1:8080/url/of/my/2322 24
    25. 25. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/{id}” ) public String processTheRequest( @PathVariable(“id”) Long customerId, Model model ) { model.addAttribute(“customer”, service.getCustomerById( customerId ) ); return “home”; } @Autowired CustomerService service; }GET http://127.0.0.1:8080/url/of/my/232 25
    26. 26. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/resource”, method = RequestMethod.GET) public String processTheRequest( HttpServletRequest request, Model model) { return “home”; } } 26
    27. 27. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/resource”, method = RequestMethod.GET) public View processTheRequest( HttpServletRequest request, Model model) { return new XsltView(...); } } 27
    28. 28. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/resource”, method = RequestMethod.GET) public InputStream processTheRequest( HttpServletRequest request, Model model) { return new FileInputStream( ...) ; } } 28
    29. 29. DEMO Demos • Simple Spring MVC based Application Not confidential. Tell everyone.
    30. 30. multi client development with Springthe new hotness 30
    31. 31. dumb terminals ruled the earth.... 31
    32. 32. then something magical happened: the web 32
    33. 33. but the web didn’t know how to do UI state... so we hacked... 33
    34. 34. ....then the web stopped sucking 34
    35. 35. multi client development with SpringREST 35
    36. 36. Thin, Thick, Web, Mobile and Rich Clients: REST Origin • The term Representational State Transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation. His paper suggests these four design principles: • Use HTTP methods explicitly. • POST, GET, PUT, DELETE • CRUD operations can be mapped to these existing methods • Be stateless. • State dependencies limit or restrict scalability • Expose directory structure-like URIs. • URI’s should be easily understood • Transfer XML, JavaScript Object Notation (JSON), or both. • Use XML or JSON to represent data objects or attributes CONFIDENTIAL 36
    37. 37. REST on the Server Spring MVC is basis for REST support • Spring’s server side REST support is based on the standard controller model JavaScript and HTML5 can consume JSON-data payloads
    38. 38. REST on the Client RestTemplate • provides dead simple, idiomatic RESTful services consumption • can use Spring OXM, too. • Spring Integration and Spring Social both build on the RestTemplate where possible. Spring supports numerous converters out of the box • JAXB • JSON (Jackson)
    39. 39. Building clients for your RESTful services: RestTemplate Google search exampleRestTemplate restTemplate = new RestTemplate();String url = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={query}";String result = restTemplate.getForObject(url, String.class, "SpringSource"); Multiple parametersRestTemplate restTemplate = new RestTemplate();String url = "http://example.com/hotels/{hotel}/bookings/{booking}";String result = restTemplate.getForObject(url, String.class, "42", “21”); CONFIDENTIAL 39
    40. 40. Thin, Thick, Web, Mobile and Rich Clients: RestTemplate RestTemplate class is the heart the client-side story • Entry points for the six main HTTP methods • DELETE - delete(...) • GET - getForObject(...) • HEAD - headForHeaders(...) • OPTIONS - optionsForAllow(...) • POST - postForLocation(...) • PUT - put(...) • any HTTP operation - exchange(...) and execute(...) CONFIDENTIAL 40
    41. 41. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/resource”, method = RequestMethod.GET) public @ResponseBody Customer processTheRequest( ... ) { Customer c = service.getCustomerById( id) ; return c; } @Autowired CustomerService service; } 41
    42. 42. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/someurl”, method = RequestMethod.POST) public String processTheRequest( @RequestBody Customer postedCustomerObject) { // ... return “home”; } }POST http://127.0.0.1:8080/url/of/my/someurl 42
    43. 43. The Anatomy of a Spring MVC @ControllerSpring MVC configuration - config @Controller public class CustomerController { @RequestMapping(value=”/url/of/my/{id}”, method = RequestMethod.POST) public String processTheRequest( @PathVariable(“id”) Long customerId, @RequestBody Customer postedCustomerObject) { // ... return “home”; } }POST http://127.0.0.1:8080/url/of/my/someurl 43
    44. 44. DEMO Demos:• Spring REST service• Spring REST client Not confidential. Tell everyone.
    45. 45. DEMO Demos:• Using REST from Ajax Not confidential. Tell everyone.
    46. 46. multi client development with SpringSpring Mobile 46
    47. 47. Thin, Thick, Web, Mobile and Rich Clients: Mobile Best strategy? Develop Native • Fallback to client-optimized web applications Spring MVC 3.1 mobile client-specific content negotiation and rendering • for other devices • (there are other devices besides Android??) 47
    48. 48. DEMO Demos:• Mobile clients using client specific rendering Not confidential. Tell everyone.
    49. 49. multi client development with SpringSpring Android 49
    50. 50. Thin, Thick, Web, Mobile and Rich Clients: Mobile  Spring REST is ideal for mobile devices  Spring MVC 3.1 mobile client-specific content negotiation and rendering • for other devices  Spring Android • RestTemplate 50
    51. 51. OK, so..... 51
    52. 52. Thin, Thick, Web, Mobile and Rich Clients: Mobile CustomerServiceClient - client! private <T> T extractResponse( ResponseEntity<T> response) {! ! if (response != null && response().value() == 200) {! ! ! return response.getBody();! ! }! ! throw new RuntimeException("couldnt extract response.");! }! @Override! public Customer updateCustomer(long id, String fn, String ln) {! ! String urlForPath = urlForPath("customer/{customerId}");!!! ! return extractResponse(this.restTemplate.postForEntity( urlForPath, new Customer(id, fn, ln), Customer.class, id));! } 52
    53. 53. Thin, Thick, Web, Mobile and Rich Clients: Mobile Demos:• consuming the Spring REST service from Android
    54. 54. One Other approach  HTML5 all the way! • HTML5 on the desktop browser interface • HTML5 + PhoneGap on the client • RESTful services on the server side to connect it all
    55. 55. springsource.org | cloudfoundry.org Questions? Say hi!@starbuxman | josh.long@springsource.com
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×