Example usage for org.springframework.http ResponseEntity noContent

List of usage examples for org.springframework.http ResponseEntity noContent

Introduction

In this page you can find the example usage for org.springframework.http ResponseEntity noContent.

Prototype

public static HeadersBuilder<?> noContent() 

Source Link

Document

Create a builder with a HttpStatus#NO_CONTENT NO_CONTENT status.

Usage

From source file:com.escarabajo.controllers.CardapioController.java

@RequestMapping(method = RequestMethod.DELETE)
public ResponseEntity deletecardapio(@PathVariable Long id) {
    service.delete(id);
    return ResponseEntity.noContent().build();
}

From source file:io.pivotal.strepsirrhini.chaosloris.web.EventController.java

@Transactional
@RequestMapping(method = DELETE, value = "/{id}")
public ResponseEntity delete(@PathVariable Long id) {
    this.eventRepository.delete(id);
    return ResponseEntity.noContent().build();
}

From source file:org.kelvmiao.sevenwonders.web.controller.UserController.java

@RequestMapping(method = RequestMethod.GET, value = "/logout")
ResponseEntity logout() {//from w w  w .j  a v a 2s .c om
    if (httpSession.getAttribute("uid") != null) {
        httpSession.invalidate();
        return ResponseEntity.noContent().build();
    }
    return ResponseEntity.badRequest().build();
}

From source file:com.eretailservice.security.BookingRestController.java

@RequestMapping(method = RequestMethod.POST)
ResponseEntity<?> add(Principal principal, @RequestBody Booking input) {
    this.validateUser(principal);

    return accountRepository.findByUsername(principal.getName()).map(account -> {
        Booking booking = bookingRepository.save(new Booking(account, input.uri, input.description));

        Link forOneBooking = new BookingResource(booking).getLink(Link.REL_SELF);

        return ResponseEntity.created(URI.create(forOneBooking.getHref())).build();
    }).orElse(ResponseEntity.noContent().build());
}

From source file:org.lecture.controller.UserController.java

/**
 * Creates a new User//from   w  w w  .ja  va  2  s.  c om
 * @param entity the user from the post-request. This user is deserialized by
 *              jackson.
 * @return A respoonse containing a link to the new resource.
 */
@RequestMapping(method = RequestMethod.POST, consumes = "application/json;charset=UTF-8")
public ResponseEntity<?> create(@RequestBody User entity) {
    User user = this.userRepository.findByUsername(entity.getUsername());
    if (user == null) {
        this.userRepository.save(entity);
        nats.publish("authentication-service.user-created", entity.getId());
        return ResponseEntity.noContent().build();
    }
    return ResponseEntity.status(HttpStatus.CONFLICT).build();
}

From source file:org.kelvmiao.sevenwonders.web.controller.UserController.java

@RequestMapping(method = RequestMethod.GET, value = "/checkExist")
ResponseEntity checkExist(@RequestParam("name") String name) {
    if (userService.checkExist(name))
        return ResponseEntity.ok().build();
    return ResponseEntity.noContent().build();
}

From source file:io.pivotal.strepsirrhini.chaosloris.web.ApplicationController.java

@Transactional
@RequestMapping(method = DELETE, value = "/{id}")
public ResponseEntity delete(@PathVariable Long id) {
    this.applicationRepository.delete(id);
    return ResponseEntity.noContent().build();
}

From source file:org.lecture.controller.AuthorityController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public ResponseEntity<?> delete(@PathVariable String id) {
    authorityRepository.delete(id);/*from w w w.  ja v a  2  s. c  om*/
    return ResponseEntity.noContent().build();
}

From source file:com.saasovation.identityaccess.resource.UserResource.java

@GetMapping(value = "{username}/inRole/{role}", produces = OvationsMediaType.ID_OVATION_TYPE)
public ResponseEntity<String> getUserInRole(@PathVariable("tenantId") String aTenantId,
        @PathVariable("username") String aUsername, @PathVariable("role") String aRoleName) {

    ResponseEntity<String> response;

    User user = null;// w  w  w. j a  v a2  s .c  o  m

    try {
        user = this.accessApplicationService().userInRole(aTenantId, aUsername, aRoleName);
    } catch (Exception e) {
        // fall through
    }

    if (user != null) {
        response = this.userInRoleResponse(user, aRoleName);
    } else {
        response = ResponseEntity.noContent().build();
    }

    return response;
}

From source file:org.lecture.controller.AuthorityController.java

@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public ResponseEntity<?> update(@PathVariable String id, @RequestBody Authority newValues) {
    newValues.setId(id);/*from  w  ww .  j  ava  2 s . co m*/
    authorityRepository.save(newValues);
    return ResponseEntity.noContent().build();
}