0
JavaでSpringを使用してRESTアプリケーションを実装しました。 GETおよびDELETEリクエストの例は、次のとおりです。Grailsを使用したJavaコントローラクラスのリライトREST
@RequestMapping(method = RequestMethod.GET)
public
@ResponseBody
List<Configuration> getAllConfigurationsInJSON() {
return new ArrayList<Configuration>(configurationMap.values());
}
@RequestMapping(value = "{systemId}", method = RequestMethod.DELETE)
public void deleteConfiguration(HttpServletResponse response, @PathVariable long systemId) throws IOException {
if (configurationMap.containsKey(systemId)) {
configurationMap.remove(systemId);
response.setStatus(HttpServletResponse.SC_OK);
} else {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
}
Grailsを検索していて、コントローラをGrailsで書き直したいとします。私はいくつかの記事を読んで、その注釈をGrailsに書く必要はないことを示しています。私はちょうど私のclousersを定義し、私の春のapplicaitonのようにJSONオブジェクトへの私の応答を表示します。どのようにクロージャでそれらを実装できますか? (私はIntelliJ IDEA 10.3を使用します)