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:org.openbaton.nfvo.api.RestNetworkServiceDescriptor.java

@RequestMapping(value = "{idNsd}/vnfdescriptors/{idVfn}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteVirtualNetworkFunctionDescriptor(@PathVariable("idNsd") String idNsd,
        @PathVariable("idVfn") String idVfn, @RequestHeader(value = "project-id") String projectId)
        throws NotFoundException {
    networkServiceDescriptorManagement.deleteVnfDescriptor(idNsd, idVfn, projectId);
}

From source file:com.largecode.interview.rustem.controller.UsersController.java

@PreAuthorize("@userRightResolverServiceImpl.canAccessToUser(principal, #id)")
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiOperation(value = "Delete User by ID.", notes = "Returns NO_CONTENT if deletion was successful.")
@ApiResponses(value = { @ApiResponse(code = 401, message = "Only authenticated access allowed."),
        @ApiResponse(code = 403, message = "Only user of ADMIN role or User has authenticated with this Id can have access."),
        @ApiResponse(code = 404, message = "User with such Id not found."), })
public void deleteUser(@PathVariable Long id) {
    LOGGER.debug("Delete user by id={}", id);
    try {//from w w w .  ja  va 2s.  co  m
        usersService.deleteUser(id);
    } catch (NoSuchElementException exception) {
        throw new ExceptionUserNotFound(exception.getMessage());
    }
}

From source file:com.kixeye.chassis.support.test.eureka.MockEurekaController.java

@RequestMapping(value = "/apps/DEFAULT-SERVICE", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
public ResponseEntity<String> mockRegisterDefaultService() {
    return new ResponseEntity<String>(HttpStatus.NO_CONTENT);
}

From source file:com.expedia.seiso.web.controller.v2.ItemControllerV2.java

/**
 * Deletes the specified item./*from www  . j  a v a2s .  com*/
 * 
 * @param repoKey
 *            repository key
 * @param itemKey
 *            item key
 */
@RequestMapping(value = "/{repoKey}/{itemKey}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@SuppressWarnings("rawtypes")
public void delete(@PathVariable String repoKey, @PathVariable String itemKey) {
    val itemClass = itemMetaLookup.getItemClass(repoKey);
    delegate.delete(new SimpleItemKey(itemClass, itemKey));
}

From source file:org.apigw.authserver.web.admin.v1.controller.CertifiedClientRestController.java

@RequestMapping(value = "/{clientId}/permissions/{permissionId}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deletePermission(@PathVariable String clientId, @PathVariable Long permissionId) {
    //TODO: Make sure that it's not possible to delete permission if it has grants.
    CertifiedClient client = service.findClientByClientId(clientId);
    if (client == null) {
        log.debug("Client with clientId {} not found", clientId);
        throw new ResourceNotFoundException("Client with clientId " + clientId + " not found");
    }/*from w  ww  .j  av  a2  s.  c  o  m*/

    for (Iterator<CertifiedClientPermission> permissionIterator = client.getCertifiedClientPermissions()
            .iterator(); permissionIterator.hasNext();) {
        CertifiedClientPermission permission = permissionIterator.next();
        if (permission.getPermission().getId().equals(permissionId)) {
            log.debug("Removing permission {} for client {}", permission.getPermission().getName(),
                    client.getClientId());
            service.deletePermission(permission);
            return;
        }
    }
    log.debug("Permission {} for Client {} not found", permissionId, clientId);
    throw new ResourceNotFoundException(
            "Permission " + permissionId + " for Client " + clientId + " not found");

}

From source file:am.ik.categolj2.api.entry.EntryRestController.java

@RequestMapping(value = "entries/{entryId}", method = RequestMethod.DELETE, headers = Categolj2Headers.X_ADMIN)
public ResponseEntity<Void> deleteEntryInAdmin(@PathVariable("entryId") Integer entryId) {
    entryService.delete(entryId);//w  w w. j ava2s  . co  m
    return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

From source file:net.eusashead.hateoas.response.argumentresolver.AsyncEntityControllerITCase.java

@Test
public void testDelete() throws Exception {

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

    // Execute asynchronously
    MvcResult mvcResult = this.mockMvc
            .perform(delete("http://localhost/async/foo").contentType(MediaType.APPLICATION_JSON)
                    .characterEncoding(Charset.forName("UTF-8").toString()).accept(MediaType.APPLICATION_JSON))
            .andExpect(request().asyncStarted()).andExpect(request().asyncResult(expectedResult)).andReturn();

    // Perform asynchronous dispatch
    this.mockMvc.perform(asyncDispatch(mvcResult)).andDo(print()).andExpect(status().isNoContent());

}

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

/**
 * Update application./* w  ww  . j a v  a  2s . com*/
 *
 * @param id        unique id for configuration to update
 * @param updateApp contains the application information to update
 * @throws GenieException For any error
 */
@PutMapping(value = "/{id}", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void updateApplication(@PathVariable("id") final String id, @RequestBody final Application updateApp)
        throws GenieException {
    log.debug("called to update application {} with info {}", id, updateApp);
    this.applicationService.updateApplication(id, updateApp);
}

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

/**
 * Update a cluster configuration.//from   ww  w.  j  a va2 s .  c  om
 *
 * @param id            unique if for cluster to update
 * @param updateCluster contains the cluster information to update
 * @throws GenieException For any error
 */
@PutMapping(value = "/{id}", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void updateCluster(@PathVariable("id") final String id, @RequestBody final Cluster updateCluster)
        throws GenieException {
    log.debug("Called to update cluster with id {} update fields {}", id, updateCluster);
    this.clusterService.updateCluster(id, updateCluster);
}

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

/**
 * Update command configuration./*from w w  w.  java 2s .  co m*/
 *
 * @param id            unique id for the configuration to update.
 * @param updateCommand the information to update the command with
 * @throws GenieException For any error
 */
@PutMapping(value = "/{id}", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void updateCommand(@PathVariable("id") final String id, @RequestBody final Command updateCommand)
        throws GenieException {
    log.debug("Called to update command {}", updateCommand);
    this.commandService.updateCommand(id, updateCommand);
}