Created
July 25, 2013 13:10
-
-
Save skrauchenia/6079458 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// your version | |
@RequestMapping(value="/addNewTag", method=RequestMethod.POST, produces = "application/json") | |
@ResponseBody | |
public Map<String, Integer> addNewTag(@RequestBody Map<String, String> requestMap, HttpServletResponse response) throws IOException { | |
if (addTagOnRuntime(requestMap.get("tagName"))) { | |
return Collections.singletonMap("statusCode", HttpServletResponse.SC_OK); | |
} else { | |
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); | |
return null; | |
} | |
} | |
private boolean addTagOnRuntime(String tagName) { | |
tagsAddedOnRuntime.add(tagName); | |
return true; | |
} | |
// my version | |
@RequestMapping(value="/addNewTag", method=RequestMethod.POST, produces = "application/json") | |
@ResponseBody | |
public void addNewTag(@RequestBody String newTag) throws IOException { | |
tagsAddedOnRuntime.add(newTag); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment