commit b4cae7aee123897858c7054853651bbbb8f19457 Author: lukasgol Date: Wed Apr 2 01:31:17 2014 +0200 initial diff --git a/src/main/java/Action.java b/src/main/java/Action.java new file mode 100644 index 0000000..438d215 --- /dev/null +++ b/src/main/java/Action.java @@ -0,0 +1,30 @@ +/** + * Created by lukasgol on 02.04.14. + */ + +public class Action { + String name; + String param; + + public Action(String name, String param) { + this.name = name; + this.param = param; + } + + public void setName(String name) { + this.name = name; + } + + public void setParam(String param) { + this.param = param; + } + + public String getName() { + + return name; + } + + public String getParam() { + return param; + } +} diff --git a/src/main/java/Config.java b/src/main/java/Config.java new file mode 100644 index 0000000..bfb20fd --- /dev/null +++ b/src/main/java/Config.java @@ -0,0 +1,15 @@ +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; + + +/** + * Created by lukasgol on 01.04.14. + */ +@ComponentScan +@EnableAutoConfiguration +public class Config { + public static void main(String[] args){ + SpringApplication.run(Config.class, args); + } +} \ No newline at end of file diff --git a/src/main/java/Controller_test.java b/src/main/java/Controller_test.java new file mode 100644 index 0000000..ee71c24 --- /dev/null +++ b/src/main/java/Controller_test.java @@ -0,0 +1,28 @@ +/** + * Created by lukasgol on 01.04.14. + */ + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class Controller_test { + + @RequestMapping("/action") + public + @ResponseBody + String hello(@RequestParam(value = "name", required = false, defaultValue = "empty") String name, + @RequestParam(value = "param", required = false, defaultValue = "empty") String param) { + Action action=new Action(name,param); + return "Action: " + action.getName() + " with parameter: "+action.getParam()+". :-) "; + } + + @RequestMapping("/str") + @ResponseBody + String hello(@RequestParam(value = "action", required = false, defaultValue = "empty") String action) { + return "Just String: "+action; + } +} +