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
Haxl - A Haskell library that simplifies access to remote... 2017-02-21
duktape - Duktape - embeddable Javascript engine with a focu... 2017-02-21
scala-best-practices - A collection of Scala best practice 2017-02-21
hammerspoon - Staggeringly powerful OS X desktop automation with... 2017-02-21
DGElasticPullToRefresh - Elastic pull to refresh for iOS developed in Swift 2017-02-21
evercookie - evercookie is a javascript API that produces extre... 2017-02-21
Waves - Click effect inspired by Google's Material Design ... 2017-02-21
PlainTasks - An opinionated todo-list plugin for Sublime Text e... 2017-02-21
Torque3D - MIT Licensed Open Source version of Torque 3D from... 2017-02-21
should.js - BDD style assertions for node.js -- test framework... 2017-02-21

 Back to top