This commit is contained in:
lukasgol committed 2014-04-02 01:31:17 +02:00
commit b4cae7aee1
3 files changed
+73

No files matched your search

+30
View File
@@ -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;
}
}
+15
View File
@@ -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);
}
}
+28
View File
@@ -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;
}
}