Example usage for org.springframework.web.bind.annotation RequestMethod DELETE

List of usage examples for org.springframework.web.bind.annotation RequestMethod DELETE

Introduction

In this page you can find the example usage for org.springframework.web.bind.annotation RequestMethod DELETE.

Prototype

RequestMethod DELETE

To view the source code for org.springframework.web.bind.annotation RequestMethod DELETE.

Click Source Link

Usage

From source file:nz.net.orcon.kanban.controllers.TemplateController.java

@RequestMapping(value = "/{templateId}", method = RequestMethod.DELETE)
public @ResponseBody void deleteTemplate(@PathVariable String boardId, @PathVariable String templateId)
        throws Exception {
    ObjectContentManager ocm = ocmFactory.getOcm();
    try {//  ww  w  . j a v  a  2 s  . c o  m
        Node node = ocm.getSession().getNode(String.format(URI.TEMPLATE_URI, boardId, templateId));
        if (node == null) {
            ocm.logout();
            throw new ResourceNotFoundException();
        }

        node.remove();
        ocm.save();
        this.cacheInvalidationManager.invalidate(TEMPLATE, templateCache.getCacheId(boardId, templateId));
    } finally {
        ocm.logout();
    }
}

From source file:fi.helsinki.opintoni.web.rest.privateapi.portfolio.workExperience.PrivateWorkExperienceResource.java

@RequestMapping(method = RequestMethod.DELETE, value = "/{workExperienceId}")
@Timed/*from   www. ja  v  a2 s . co m*/
public ResponseEntity<List<WorkExperienceDto>> delete(@UserId Long userId, @PathVariable Long portfolioId,
        @PathVariable Long workExperienceId) {
    permissionChecker.verifyPermission(userId, workExperienceId, WorkExperience.class);
    return response(workExperienceService.delete(workExperienceId, portfolioId));
}

From source file:de.sainth.recipe.backend.rest.controller.UserController.java

@Secured({ "ROLE_USER", "ROLE_ADMIN" })
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)//  w ww  .j a v  a2 s .com
void delete(@PathVariable("id") Long id) {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    RecipeManagerAuthenticationToken token = (RecipeManagerAuthenticationToken) authentication;
    if (ROLE_ADMIN.name().equals(token.getRole())
            || (ROLE_USER.name().equals(token.getRole()) && token.getPrincipal().equals(id))) {
        repository.delete(id);
    }
}

From source file:br.com.delivery.management.configuration.SwaggerConfiguration.java

@Bean
public Docket docket() {
    String title = "";
    String description = "";
    String version = "";
    String termsOfServiceUrl = null;
    String contact = null;/*  w w  w .  j av a 2  s  . c o  m*/
    String license = null;
    String licenseUrl = null;

    ApiInfo apiInfo = new ApiInfo(title, description, version, termsOfServiceUrl, contact, license, licenseUrl);

    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).select()
            .apis(RequestHandlerSelectors.basePackage("br.com.delivery.management")).paths(PathSelectors.any())
            .build().pathMapping("/").genericModelSubstitutes(ResponseEntity.class)
            .alternateTypeRules(newRule(
                    typeResolver.resolve(DeferredResult.class,
                            typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
                    typeResolver.resolve(WildcardType.class)))
            .useDefaultResponseMessages(false)
            .globalResponseMessage(RequestMethod.GET, getDefaultResponseMessage())
            .globalResponseMessage(RequestMethod.POST, getDefaultResponseMessage())
            .globalResponseMessage(RequestMethod.PUT, getDefaultResponseMessage())
            .globalResponseMessage(RequestMethod.DELETE, getDefaultResponseMessage()).enableUrlTemplating(true);

}

From source file:com.seabee.snapdragon.controller.BlogController.java

@RequestMapping(value = "/{entryId}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)/*w  w  w  . j a v a  2 s.c o m*/
public void deleteBlogEntry(@PathVariable("entryId") int id) {
    dao.removeBlogEntry(id);
}

From source file:com.oneops.cms.ws.rest.NsRestController.java

@RequestMapping(method = RequestMethod.DELETE, value = "/ns/namespaces/{nsId}")
@ResponseBody/*from w w  w.  jav  a2  s .  c o  m*/
public Map<String, String> deleteNs(@PathVariable long nsId) {
    nsManager.deleteNsById(nsId);
    Map<String, String> result = new HashMap<String, String>();
    result.put("result", "OK");
    return result;
}

From source file:com.pos.web.ArInvController.java

@RequestMapping(value = "/ar-inv/{id}", method = RequestMethod.DELETE)
public void delete(@PathVariable String id, HttpServletResponse response) {
    dao.delete(id);
}

From source file:com.codemacro.jcm.http.ClusterController.java

@RequestMapping(value = "/{name}", method = RequestMethod.DELETE)
public @ResponseBody Result delete(@PathVariable String name) {
    logger.debug("delete cluster {}", name);
    if (!clusterManager.exists(name)) {
        return Result.NOT_FOUND;
    }/*from ww w. ja va  2 s .c om*/
    boolean ret = clusterStorage.removeCluster(name);
    return ret ? Result.OK : Result.FAILED;
}

From source file:com.nebhale.cyclinglibrary.web.TypeController.java

@RequestMapping(method = RequestMethod.DELETE, value = "/{typeId}")
@ResponseBody
void delete(@PathVariable Long typeId) {
    this.typeRepository.delete(typeId);
}

From source file:com.nebhale.devoxx2013.web.GameController.java

@RequestMapping(method = RequestMethod.DELETE, value = "/{game}")
@ResponseStatus(HttpStatus.OK)/*from w w  w  . j av  a 2  s. c o m*/
@Transactional
void delete(@PathVariable Game game) {
    Assert.notNull(game);
    this.gameService.delete(game);
}