Package com.foundationdb.rest

Examples of com.foundationdb.rest.RestResponseBuilder.status()


    @Produces(MEDIATYPE_JSON_JAVASCRIPT)
    public Response addUser(@Context HttpServletRequest request,
                            byte[] userBytes) throws Exception {
        RestResponseBuilder response = RestResponseBuilder.forRequest(request);
        if (!request.isUserInRole(SecurityService.ADMIN_ROLE)) {
            return response.status(Response.Status.FORBIDDEN).build();
        }
        JsonNode node = readTree(userBytes);
        JsonNode userNode = node.get("user");
        JsonNode passwordNode = node.get("password");
        JsonNode rolesNode = node.get("roles");
View Full Code Here


    @Produces(MEDIATYPE_JSON_JAVASCRIPT)
    public Response deleteUser(@Context HttpServletRequest request,
                               @PathParam("user") final String user) {
        RestResponseBuilder response = RestResponseBuilder.forRequest(request);
        if (!request.isUserInRole(SecurityService.ADMIN_ROLE)) {
            return response.status(Response.Status.FORBIDDEN).build();
        }
        response.body(new RestResponseBuilder.BodyGenerator() {
            @Override
            public void write(PrintWriter writer) throws Exception {
                try (Session session = reqs.sessionService.createSession()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.