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:cn.designthoughts.sample.axon.sfav.customer.controller.CustomerController.java

@RequestMapping(value = "/rest/customers/{customerId}/activation", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void createTask(@PathVariable String customerId) {
    commandGateway.send(new ActivateCustomerCommand(new CustomerId(customerId)));
}

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

@RequestMapping(value = "/{clientId}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable String clientId) {
    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 ww  w. j  a  va  2  s  .c om

    log.debug("Deleting client {}", clientId);
    service.delete(client);
}

From source file:nl.surfnet.mujina.controllers.IdentityProviderAPI.java

@RequestMapping(value = { "/acsendpoint" }, method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ResponseBody/*  w w w  .  ja  v  a 2  s .  c  o m*/
public void setAcsEndpoint(@RequestBody AcsEndpoint acsEndpoint) {
    log.debug("Request to set Assertion Consumer Service Endpoint to {}", acsEndpoint.getUrl());
    configuration.setAcsEndpoint(acsEndpoint);
}

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

@RequestMapping(method = RequestMethod.DELETE, value = "account")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void deleteUser() throws WiseMappingException

{
    final User user = Utils.getUser(true);
    final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
    for (Collaboration collaboration : collaborations) {
        final Mindmap mindmap = collaboration.getMindMap();
        mindmapService.removeMindmap(mindmap, user);
    }/*from   w w w .  ja  v  a2s . com*/
    userService.removeUser(user);
}

From source file:com.thesoftwareguild.capstoneblog.controller.HomeController.java

@RequestMapping(value = "/approve-post/{id}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void approvePost(@PathVariable("id") int id) {

    Post p = dao.getPostById(id);/*from ww  w  .  j  a v  a  2  s  .c o m*/

    // set post status to 'PUBLISHED' and date posted to current time
    p.setStatus(PostStatus.PUBLISHED);
    p.setDatePosted(LocalDate.now());

    dao.updatePost(p);
}

From source file:com.github.cherimojava.orchidae.controller.LayoutController.java

private ResponseEntity registerUser(HttpServletRequest request) {
    // TODO send messages out if something isn't right
    if (StringUtils.isEmpty(request.getParameter("username"))) {
        return new ResponseEntity(HttpStatus.BAD_REQUEST);
    }//  www.  j ava  2 s  .  c  om
    if (factory.load(User.class, request.getParameter("username")) != null) {
        return new ResponseEntity(HttpStatus.BAD_REQUEST);
    }
    String pwd = request.getParameter("password");
    if (StringUtils.isNotEmpty(pwd) && pwd.equals(request.getParameter("password2"))) {
        User newUser = factory.create(User.class);
        newUser.setMemberSince(DateTime.now());
        newUser.setUsername(request.getParameter("username"));
        newUser.setPassword(pwEncoder.encode(pwd));
        newUser.save();
    }
    return new ResponseEntity(HttpStatus.NO_CONTENT);
}

From source file:io.syndesis.runtime.ConnectionsITCase.java

@Test
public void shouldDetermineValidityForValidConnections() {
    final Connection connection = new Connection.Builder().name("Test connection").build();

    final ResponseEntity<List<Violation>> got = post("/api/v1/connections/validation", connection,
            RESPONSE_TYPE, tokenRule.validToken(), HttpStatus.NO_CONTENT);

    assertThat(got.getBody()).isNull();//from  w  ww.ja  va  2  s .  co m
}

From source file:com.gazbert.bxbot.rest.api.StrategyConfigController.java

/**
 * Updates a given Strategy configuration.
 *
 * @param user the authenticated user./* ww  w. jav a  2 s . co m*/
 * @param strategyId id of the Strategy config to update.
 * @param config the updated Strategy config.
 * @return 204 'No Content' HTTP status code if update successful, 404 'Not Found' HTTP status code if Strategy config not found.
 */
@RequestMapping(value = "/strategy/{strategyId}", method = RequestMethod.PUT)
ResponseEntity<?> updateStrategy(@AuthenticationPrincipal User user, @PathVariable String strategyId,
        @RequestBody StrategyConfig config) {

    if (config == null || config.getId() == null || !strategyId.equals(config.getId())) {
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }

    final StrategyConfig updatedConfig = strategyConfigService.updateStrategy(config);
    return updatedConfig.getId() != null ? new ResponseEntity<>(HttpStatus.NO_CONTENT)
            : new ResponseEntity<>(HttpStatus.NOT_FOUND);
}

From source file:org.exoplatform.acceptance.rest.administration.CRUDController.java

/**
 * Delete an existing object/*from ww  w  .  j a v a  2  s  .  co  m*/
 *
 * @param id the id of the object to delete
 */
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteObject(@PathVariable(value = "id") String id) {
    getCRUDService().delete(id);
}