Add endpoint for testing

This commit is contained in:
Ivan Paolillo 2016-09-21 16:52:26 +02:00
parent 1c02296a0f
commit 7546794253
1 changed files with 20 additions and 14 deletions

View File

@ -14,20 +14,26 @@ import com.fasterxml.jackson.annotation.JsonView;
@RestController
public class ItemController {
@JsonView(Views.Public.class)
@RequestMapping("/items/{id}")
public Item getItemPublic(@PathVariable final int id) {
return ItemManager.getById(id);
}
@JsonView(Views.Public.class)
@RequestMapping("/items/{id}")
public Item getItemPublic(@PathVariable final int id) {
return ItemManager.getById(id);
}
@JsonView(Views.Internal.class)
@RequestMapping("/items/internal/{id}")
public Item getItemInternal(@PathVariable final int id) {
return ItemManager.getById(id);
}
@JsonView(Views.Internal.class)
@RequestMapping("/items/internal/{id}")
public Item getItemInternal(@PathVariable final int id) {
return ItemManager.getById(id);
}
@RequestMapping("/date")
public Date getCurrentDate() {
return new Date();
}
@RequestMapping("/date")
public Date getCurrentDate() throws Exception {
return new Date();
}
@RequestMapping("/delay/{seconds}")
public void getCurrentTime(@PathVariable final int seconds) throws Exception {
Thread.sleep(seconds * 1000);
}
}