Example usage for org.springframework.http HttpStatus NO_CONTENT

List of usage examples for org.springframework.http HttpStatus NO_CONTENT

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus NO_CONTENT.

Prototype

HttpStatus NO_CONTENT

To view the source code for org.springframework.http HttpStatus NO_CONTENT.

Click Source Link

Document

204 No Content .

Usage

From source file:it.polimi.diceH2020.launcher.controller.rest.DownloadsController.java

@RequestMapping(value = "/solution/json/{id}", method = RequestMethod.GET)
public ResponseEntity<String> downloadSolutionJson(@PathVariable Long id) {
    ResponseEntity<String> output = new ResponseEntity<>(HttpStatus.NOT_FOUND);

    SimulationsManager manager = simulationsManagerRepository.findById(id);
    if (manager != null) {
        for (InteractiveExperiment experiment : manager.getExperimentsList()) {
            // TODO there is always only one InteractiveExperiment, all the monster should be treated accordingly
            if (experiment.isDone()) {
                try {
                    String solution = Compressor.decompress(experiment.getFinalSolution());
                    output = new ResponseEntity<>(solution, HttpStatus.OK);
                } catch (IOException e) {
                    String message = String.format("Could not decompress solutions JSON for experiment %d", id);
                    logger.error(message, e);
                    output = new ResponseEntity<>(message, HttpStatus.INTERNAL_SERVER_ERROR);
                }/*  ww  w.  j a v  a2 s .co m*/
            } else {
                output = new ResponseEntity<>(HttpStatus.NO_CONTENT);
            }
        }
    }

    return output;
}

From source file:com.sms.server.controller.AdminController.java

@RequestMapping(value = "/media/folder/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteMediaFolder(@PathVariable("id") Long id) {
    LogService.getInstance().addLogEntry(Level.INFO, CLASS_NAME,
            "Removed media folder with ID '" + id.toString() + "'.", null);
    settingsDao.removeMediaFolder(id);/*from w w  w  .j a  v a  2  s.  co  m*/
}

From source file:com.boundlessgeo.geoserver.api.controllers.IconController.java

@RequestMapping(value = "/{wsName}/{icon:.+}", method = RequestMethod.DELETE)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void delete(@PathVariable String wsName, @PathVariable String icon) throws IOException {

    WorkspaceInfo ws;/*  w  w w.  j  a v  a 2s . c o  m*/
    Resource resource;

    if (wsName == null) {
        ws = null;
        resource = dataDir().getRoot("styles", icon);
    } else {
        ws = findWorkspace(wsName, catalog());
        resource = dataDir().get(ws, "styles", icon);
    }

    if (resource.getType() != Type.RESOURCE) {
        throw new NotFoundException("Icon " + icon + " not found");
    }
    String ext = fileExt(icon);
    if (!ICON_FORMATS.containsKey(ext)) {
        throw new NotFoundException("Icon " + icon + " format unsupported");
    }
    if (!resource.delete()) {
        throw new RuntimeException("Failed to delete icon " + icon);
    }
}

From source file:net.eusashead.hateoas.conditional.interceptor.AsyncTestControllerITCase.java

@Test
public void testDeletePreconditionOK() throws Exception {

    // Expected result
    ResponseEntity<String> expectedResult = new ResponseEntity<String>(HttpStatus.NO_CONTENT);

    // 204 should be returned
    MvcResult mvcResult = this.mockMvc
            .perform(delete("http://localhost/async/123").contentType(MediaType.APPLICATION_JSON)
                    .accept(MediaType.APPLICATION_JSON).header("If-Match", "\"123456\""))
            .andExpect(request().asyncStarted()).andExpect(request().asyncResult(expectedResult)).andReturn();

    // Perform asynchronous dispatch
    this.mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isNoContent())
            .andExpect(content().string(""));

}

From source file:com.netflix.genie.web.controllers.CommandRestController.java

/**
 * Delete all applications from database.
 *
 * @throws GenieException For any error//  ww  w  . ja v  a  2 s .co m
 */
@DeleteMapping
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteAllCommands() throws GenieException {
    log.debug("called to delete all commands.");
    this.commandService.deleteAllCommands();
}

From source file:com.netflix.genie.web.controllers.ClusterRestController.java

/**
 * Delete a cluster configuration./*  w  w w.  j av a  2 s . c o  m*/
 *
 * @param id unique id for cluster to delete
 * @throws GenieException For any error
 */
@DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteCluster(@PathVariable("id") final String id) throws GenieException {
    log.debug("Delete called for id: {}", id);
    this.clusterService.deleteCluster(id);
}

From source file:com.netflix.genie.web.controllers.ApplicationRestController.java

/**
 * Delete an application configuration from database.
 *
 * @param id unique id of configuration to delete
 * @throws GenieException For any error/*w  w w.j  a v  a2  s  .  com*/
 */
@DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteApplication(@PathVariable("id") final String id) throws GenieException {
    log.debug("Delete an application with id {}", id);
    this.applicationService.deleteApplication(id);
}

From source file:org.openlmis.fulfillment.web.shipmentdraft.ShipmentDraftController.java

/**
 * Delete chosen shipment draft.//  w w w.j  av  a  2s  . c  o m
 *
 * @param id UUID of shipment draft item which we want to delete.
 */
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteShipmentDraft(@PathVariable UUID id) {
    XLOGGER.entry(id);
    Profiler profiler = new Profiler("DELETE_SHIPMENT_DRAFT");
    profiler.setLogger(XLOGGER);

    ShipmentDraft shipment = findShipmentDraft(id, profiler);

    profiler.start(CHECK_RIGHTS);
    permissionService.canEditShipmentDraft(shipment);

    profiler.start("DELETE");
    repository.delete(id);

    Order order = orderRepository.findOne(shipment.getOrder().getId());

    profiler.start("UPDATE_ORDER");
    updateOrderStatus(order, OrderStatus.ORDERED);
    orderRepository.save(order);

    profiler.stop().log();
    XLOGGER.exit();
}

From source file:com.netflix.genie.web.controllers.CommandRestController.java

/**
 * Delete a command./* w  ww  . java 2s  .c o  m*/
 *
 * @param id unique id for configuration to delete
 * @throws GenieException For any error
 */
@DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteCommand(@PathVariable("id") final String id) throws GenieException {
    log.debug("Called to delete command with id {}", id);
    this.commandService.deleteCommand(id);
}

From source file:com.wisemapping.rest.AdminController.java

@ApiOperation("Note: Administration permissions required.")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@RequestMapping(method = RequestMethod.GET, value = "admin/database/purge/history")
public void purgeHistory(@RequestParam(required = true) Integer mapId)
        throws WiseMappingException, IOException {

    mindmapService.purgeHistory(mapId);// www . j a  v  a2s  .c  o m
}