BVB Source Codes

spring-mvc-showcase Show ConvertController.java Source code

Return Download spring-mvc-showcase: download ConvertController.java Source code - Download spring-mvc-showcase Source code - Type:.java
  1. package org.springframework.samples.mvc.convert;
  2.  
  3. import java.util.Collection;
  4. import java.util.Date;
  5.  
  6. import org.springframework.format.annotation.DateTimeFormat;
  7. import org.springframework.format.annotation.DateTimeFormat.ISO;
  8. import org.springframework.stereotype.Controller;
  9. import org.springframework.web.bind.annotation.PathVariable;
  10. import org.springframework.web.bind.annotation.RequestMapping;
  11. import org.springframework.web.bind.annotation.RequestParam;
  12. import org.springframework.web.bind.annotation.ResponseBody;
  13.  
  14. @Controller
  15. @RequestMapping("/convert")
  16. public class ConvertController {
  17.  
  18.         @RequestMapping("primitive")
  19.         public @ResponseBody String primitive(@RequestParam Integer value) {
  20.                 return "Converted primitive " + value;
  21.         }
  22.  
  23.         // requires Joda-Time on the classpath
  24.         @RequestMapping("date/{value}")
  25.         public @ResponseBody String date(@PathVariable @DateTimeFormat(iso=ISO.DATE) Date value) {
  26.                 return "Converted date " + value;
  27.         }
  28.  
  29.         @RequestMapping("collection")
  30.         public @ResponseBody String collection(@RequestParam Collection<Integer> values) {
  31.                 return "Converted collection " + values;
  32.         }
  33.  
  34.         @RequestMapping("formattedCollection")
  35.         public @ResponseBody String formattedCollection(@RequestParam @DateTimeFormat(iso=ISO.DATE) Collection<Date> values) {
  36.                 return "Converted formatted collection " + values;
  37.         }
  38.  
  39.         @RequestMapping("bean")
  40.         public @ResponseBody String bean(JavaBean bean) {
  41.                 return "Converted " + bean;
  42.         }
  43.  
  44.         @RequestMapping("value")
  45.         public @ResponseBody String valueObject(@RequestParam SocialSecurityNumber value) {
  46.                 return "Converted value object " + value;
  47.         }
  48.  
  49.         @RequestMapping("custom")
  50.         public @ResponseBody String customConverter(@RequestParam @MaskFormat("###-##-####") String value) {
  51.                 return "Converted '" + value + "' with a custom converter";
  52.         }
  53.  
  54. }
  55.  
downloadConvertController.java Source code - Download spring-mvc-showcase Source code
Related Source Codes/Software:
tushare - TuShare is a utility for crawling historical data ... 2017-01-12
raml-spec - RAML Specification http://raml.... 2017-01-12
android-stackblur - Android StackBlur is a library that can perform a ... 2017-01-12
sound-redux - A Soundcloud client built with React / Redux ... 2017-01-12
httpstat - curl statistics made simple 2017-01-12
discover-flask - Full Stack Web Development with Flask. ... 2017-01-12
micro - Async HTTP microservices made easy ... 2017-01-12
gobot - Golang framework for robotics, drones, and the Int... 2017-01-11
mas - 2017-01-13
Zappa - Serverless Python Web Services ... 2017-01-12
YouTubeCenter - YouTube Center is a userscript designed to expand ... 2017-01-14
node-osmosis - Web scraper for NodeJS 2017-01-13
liquidfun - 2D physics engine for games htt... 2017-01-13
locutus - All your standard libraries will be assimilated in... 2017-01-13
VBFPopFlatButton - Flat button with 9 different states using POP 2017-01-13
hubpress.io - A web application to build your blog on GitHu 2017-01-13
sunspot - Solr-powered search for Ruby objects ... 2017-01-13
thrust - Chromium-based cross-platform / cross-language app... 2017-01-13
rubinius - The Rubinius Language Platform ... 2017-01-13
rework - Plugin framework for CSS preprocessing in Node.j 2017-01-13

 Back to top