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:org.lecture.controller.TestCaseController.java

@RequestMapping(value = "/{id}", method = RequestMethod.PATCH, consumes = "application/json;charset=UTF-8")
public ResponseEntity<?> update(@PathVariable String id, @RequestBody List<FilePatch> patches) {

    CompilationReport report = compilerService.patchAndCompileTestSource(id, patches);
    if (report == null) {
        return ResponseEntity.noContent().build();
    }/* w  w  w  .  j  a v  a 2s.  c  o  m*/
    return ResponseEntity.ok().body(report);
}

From source file:com.greglturnquist.springagram.fileservice.mongodb.ApplicationController.java

@RequestMapping(method = RequestMethod.DELETE, value = "/files/{filename}")
public ResponseEntity<?> deleteFile(@PathVariable String filename) {

    this.fileService.deleteOne(filename);

    return ResponseEntity.noContent().build();
}

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

/**
 * Patches the content of one tutorial with a diff-match-patch patch.
 * @param id the id of the tutorial.// w  w w.j  a v a2s  .  co m
 * @param patch the patch to submit.
 * @return a response.
 */
@RequestMapping(value = "/{id}", method = RequestMethod.PATCH, consumes = "text/plain;charset=UTF-8")
public ResponseEntity<?> update(@PathVariable String id, @RequestBody String patch) {

    PatchService patchService = new DmpPatchService();
    Tutorial tutorial = tutorialRepository.findOne(id);
    tutorial.setContent(patchService.applyPatch(tutorial.getContent(), patch));
    tutorialRepository.save(tutorial);
    return ResponseEntity.noContent().build();
}

From source file:com.fns.grivet.controller.NamedQueryController.java

@PreAuthorize("hasAuthority('delete:query')")
@DeleteMapping(value = "/api/v1/query/{name}")
public ResponseEntity<?> deleteNamedQuery(@PathVariable("name") String name) {
    namedQueryService.delete(name);//from   w w  w  . j a  v a  2s . c  o  m
    log.info("Query with name [{}] successfully deleted!", name);
    return ResponseEntity.noContent().build();
}

From source file:com.orange.clara.pivotaltrackermirror.controllers.MirrorReferenceController.java

@ApiOperation("Delete a specific mirror referenced by its id")
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:[0-9]*}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> delete(@PathVariable Integer id) throws SchedulerException {
    MirrorReference mirrorReference = this.mirrorReferenceRepo.findOne(id);
    if (mirrorReference == null) {
        return ResponseEntity.notFound().build();
    }/*from   w w  w . j  a v a  2s.c  om*/
    scheduler.deleteJob(new JobKey(MirrorJob.JOB_KEY_NAME + mirrorReference.getId(), MirrorJob.JOB_KEY_GROUP));
    this.mirrorReferenceRepo.delete(mirrorReference);
    return ResponseEntity.noContent().build();
}

From source file:com.onyxscheduler.web.JobController.java

@RequestMapping(value = "/groups/{group}/jobs/{name}", method = RequestMethod.DELETE)
public ResponseEntity<Void> deleteJob(@PathVariable String group, @PathVariable String name) {
    if (!scheduler.deleteJob(new JobKey(group, name))) {
        return ResponseEntity.notFound().build();
    }/*  w w w. j a  va  2  s  . c  o  m*/
    return ResponseEntity.noContent().build();
}

From source file:com.github.lynxdb.server.api.http.handlers.EpVhost.java

@RequestMapping(value = "/{vhostUUID}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity deleteVhost(Authentication _authentication, @PathVariable("vhostUUID") UUID vhostId) {

    Vhost vhost = vhosts.byId(vhostId);/*from  ww w.  j  av  a2  s  .c  om*/

    if (vhost == null) {
        return new ErrorResponse(mapper, HttpStatus.BAD_REQUEST, "Vhost does not exist.", null).response();
    }

    vhosts.delete(vhost);

    return ResponseEntity.noContent().build();
}

From source file:org.createnet.raptor.auth.service.controller.AuthenticationController.java

@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "${jwt.route.authentication.path}", method = RequestMethod.DELETE)
@ApiOperation(value = "Logout an user invalidating login the token", notes = "", nickname = "logout")
public ResponseEntity<?> logout(HttpServletRequest request, Principal principal) {

    String reqToken = request.getHeader(tokenHeader).replace("Bearer ", "");
    Token token = tokenService.read(reqToken);

    if (token == null) {
        return ResponseEntity.noContent().build();
    }//from  w w  w .  j  a  v a2 s  .c  om

    if (token.getType() != Token.Type.LOGIN) {
        return ResponseEntity.badRequest().body(null);
    }

    tokenService.delete(token);

    return ResponseEntity.ok(null);

}

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

@Transactional
@RequestMapping(method = PATCH, value = "/{id}", consumes = APPLICATION_JSON_VALUE)
public ResponseEntity update(@PathVariable Long id, @Valid @RequestBody ScheduleUpdateInput input) {
    Schedule schedule = this.scheduleRepository.getOne(id);

    if (input.getExpression() != null) {
        schedule.setExpression(input.getExpression());
    }//from w ww.  j  av a2  s. c  o  m

    if (input.getName() != null) {
        schedule.setName(input.getName());
    }

    this.scheduleRepository.save(schedule);
    this.applicationEventPublisher.publishEvent(new ScheduleUpdatedEvent(this, schedule));

    return ResponseEntity.noContent().build();
}

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

@Transactional
@RequestMapping(method = PATCH, value = "/{id}", consumes = APPLICATION_JSON_VALUE)
public ResponseEntity update(@PathVariable Long id, @Valid @RequestBody ChaosUpdateInput input) {
    Chaos chaos = this.chaosRepository.getOne(id);

    Optional.ofNullable(input.getProbability()).ifPresent(chaos::setProbability);

    this.chaosRepository.save(chaos);
    return ResponseEntity.noContent().build();
}