Search in sources :

Example 1 with HttpStatus

use of org.apache.tapestry5.services.HttpStatus in project tapestry-5 by apache.

the class Index method onHttpPut.

@RestInfo(consumes = "application/json")
public Object onHttpPut(@RequestBody User user) throws UnsupportedEncodingException {
    HttpStatus status;
    if (!USERS.contains(user)) {
        USERS.add(user);
        status = HttpStatus.created();
    } else {
        status = HttpStatus.ok();
    }
    return status.withContentLocation(pageRenderLinkSource.createPageRenderLinkWithContext(Index.class, user.getEmail()));
}
Also used : HttpStatus(org.apache.tapestry5.services.HttpStatus) RestInfo(org.apache.tapestry5.annotations.RestInfo)

Aggregations

RestInfo (org.apache.tapestry5.annotations.RestInfo)1 HttpStatus (org.apache.tapestry5.services.HttpStatus)1