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:com.swcguild.addressbookmvc.controller.HomeController.java

@RequestMapping(value = "/contact/{id}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void putContact(@PathVariable("id") int id, @RequestBody Contact contact) {
    contact.setContactId(id);//from   www  . j a v a2  s. c  om
    dao.updateContact(contact);
}

From source file:nc.noumea.mairie.appock.ws.RadiWSConsumer.java

private LightUserDto convertResponseAsLightUserDto(ClientResponse response, String url) throws Exception {

    if (response.getStatus() == HttpStatus.NO_CONTENT.value()) {
        return null;
    }//from ww  w .  j  a v  a  2 s.  c om

    if (response.getStatus() != HttpStatus.OK.value()) {
        throw new Exception(String.format("An error occured when querying '%s'. Return code is : %s", url,
                response.getStatus()));
    }

    String output = response.getEntity(String.class);

    HashMap<String, Object> map = (HashMap<String, Object>) new JSONDeserializer().deserialize(output);

    LightUserDto lightUserDto = new LightUserDto();
    lightUserDto.setMail((String) map.get("mail"));
    lightUserDto.setGivenName((String) map.get("givenName"));
    lightUserDto.setsAMAccountName((String) map.get("sAMAccountName"));
    lightUserDto.setSn((String) map.get("sn"));
    lightUserDto.setTelephoneNumber((String) map.get("telephoneNumber"));

    return lightUserDto;
}

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

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

    final ResponseEntity<Void> got = put("/api/v1/connections/" + id, connection, Void.class,
            tokenRule.validToken(), HttpStatus.NO_CONTENT);

    assertThat(got.getBody()).isNull();//from  ww  w . j  ava 2s  . c o m
}

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

@PostConstruct()
public void resetDB() {
    get("/api/v1/test-support/reset-db", null, tokenRule.validToken(), HttpStatus.NO_CONTENT);
}

From source file:ca.qhrtech.controllers.CategoryController.java

@ApiMethod(description = "Deletes the Category at the specified location")
@RequestMapping(value = "/category/{id}", method = RequestMethod.DELETE)
public ResponseEntity<Category> deleteCategory(@PathVariable("id") long id) {
    if (categoryService.findCategoryById(id) == null) {
        return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }//  w w w  .j  a v a 2  s.co  m
    categoryService.deleteCategory(id);
    return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

From source file:org.branch.annotation.audio.web.controller.AnnotationController.java

@RequestMapping(value = "save")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@Transactional/*from  w  w  w  .jav  a  2 s.  c  o  m*/
public void save(@RequestParam(required = false) String id, @RequestParam(required = false) String index,
        @RequestParam String text, @RequestParam int startX, @RequestParam int endX) {
    final Annotation annotation;
    if (!StringUtils.isEmpty(id)) {
        logger.info("**** updating existing annotation for id=" + id + " with region(" + startX + "," + endX
                + ") with text=" + text);

        annotation = annotationRepository.findOne(id);
    } else if (!StringUtils.isEmpty(index)) {
        annotation = new Annotation();

        final Summary summary = summaryRepository.findOne(index);

        annotation.setCreateDate(new Date());
        annotation.setSummary(summary);
    } else {
        throw new UncheckedException(
                "Must supply parameter of either 'indexId' or 'id' to modify/add an annotation");
    }

    annotation.setText(text);
    annotation.setStartPos(startX);
    annotation.setEndPos(endX);
    annotation.setLastModified(new Date());

    annotationRepository.save(annotation);
}

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

@RequestMapping(method = RequestMethod.PUT, value = "account/lastname", consumes = { "text/plain" })
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void changeLastName(@RequestBody String lastname) {
    if (lastname == null) {
        throw new IllegalArgumentException("lastname can not be null");

    }//from ww w.  j av a  2  s  .c  om
    final User user = Utils.getUser(true);
    user.setLastname(lastname);
    userService.updateUser(user);
}

From source file:$.TaskRestController.java

@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaTypes.JSON)
    // Restful204??, . ?200??.
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void update(@RequestBody Task task) {
        // JSR303 Bean Validator, RestExceptionHandler?.
        BeanValidators.validateWithException(validator, task);

        // ?//  w  w  w. ja  va 2s  .  c o m
        taskService.saveTask(task);
    }

From source file:io.github.howiefh.jeews.modules.sys.controller.RoleController.java

@RequiresPermissions("role:delete")
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") Long id) {
    roleService.delete(id);//from www  .j  a v a2  s.com
}

From source file:de.thm.arsnova.controller.SecurityExceptionControllerAdvice.java

@ResponseStatus(HttpStatus.NO_CONTENT)
@ExceptionHandler(NoContentException.class)
public void handleNoContentException(final Exception e, final HttpServletRequest request) {
}