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:net.seedboxer.web.controller.rs.admin.RssFeedsAPI.java

@RequestMapping(value = "delete", method = RequestMethod.DELETE)
public @ResponseBody APIResponse deleteRssFeed(@RequestBody RssFeedInfo feed) {
    try {//from  ww w . java 2 s . com
        adminService.deleteRssFeed(feed);
        return APIResponse.createSuccessfulResponse();
    } catch (Exception e) {
        LOGGER.error("Can not delete rss feed", e);
        return APIResponse.createErrorResponse("Can not delete rss feed");
    }
}

From source file:org.mitre.openid.connect.web.ApprovedSiteAPI.java

/**
 * Delete an approved site//from  www  .j  a v a  2 s  . c o  m
 * 
 */
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public String deleteApprovedSite(@PathVariable("id") Long id, ModelMap m, Principal p) {
    ApprovedSite approvedSite = approvedSiteService.getById(id);

    if (approvedSite == null) {
        logger.error("deleteApprovedSite failed; no approved site found for id: " + id);
        m.put(HttpCodeView.CODE, HttpStatus.NOT_FOUND);
        m.put(JsonErrorView.ERROR_MESSAGE,
                "Could not delete approved site. The requested approved site with id: " + id
                        + " could not be found.");
        return JsonErrorView.VIEWNAME;
    } else if (!approvedSite.getUserId().equals(p.getName())) {
        logger.error(
                "deleteApprovedSite failed; principal " + p.getName() + " does not own approved site" + id);
        m.put(HttpCodeView.CODE, HttpStatus.FORBIDDEN);
        m.put(JsonErrorView.ERROR_MESSAGE,
                "You do not have permission to delete this approved site. The approved site decision will not be deleted.");
        return JsonErrorView.VIEWNAME;
    } else {
        m.put(HttpCodeView.CODE, HttpStatus.OK);
        approvedSiteService.remove(approvedSite);
    }

    return HttpCodeView.VIEWNAME;
}

From source file:be.solidx.hot.shows.AbstractRest.java

@Override
public RestAuthHeaders<CLOSURE> delete(List<String> paths) {
    return new RestAuthHeadersImpl(buildRequestMapping(paths, RequestMethod.DELETE));
}

From source file:de.codecentric.boot.admin.notify.filter.web.NotificationFilterController.java

@RequestMapping(path = "/api/notifications/filters/{id}", method = { RequestMethod.DELETE })
public ResponseEntity<?> deleteFilter(@PathVariable("id") String id) {
    NotificationFilter deleted = filteringNotifier.removeFilter(id);
    if (deleted != null) {
        return ResponseEntity.ok(deleted);
    } else {// w w  w .  ja  v  a2  s .co  m
        return ResponseEntity.notFound().build();
    }
}

From source file:cz.swi2.mendeluis.rest.controllers.UserPortletsController.java

/**
 * curl -i -X DELETE http://localhost:8080/mendelis/rest/userportlets/{username}/{id}
 *///from w  ww .j a v a2  s. c o  m
@RequestMapping(value = "/{username}/{id}", method = RequestMethod.DELETE)
public @ResponseBody void deleteUserPortlet(@PathVariable String username, @PathVariable int id)
        throws Exception {
    UserPortletDTO t = userPortletFacade.getUserPortletWithId(id);
    if (t == null) {
        throw new ResourceNotFoundException();
    }
    try {
        userPortletFacade.deleteUserPortlet(id);
    } catch (Exception e) {
        throw new ResourceNotModifiedException();
    }
}

From source file:pl.edu.agh.iosr.lsf.RootController.java

@RequestMapping(value = "keyword", method = RequestMethod.DELETE)
public String deleteKeyword(@RequestParam(value = "name") String key) {
    try {//from   w ww  . jav a2 s. co m
        dh.deleteKeyword(key);
        return "OK";
    } catch (SQLException e) {
        return e.getMessage();
    }
}

From source file:com.asual.summer.sample.web.TechnologyController.java

@RequestMapping(value = "/{value}", method = RequestMethod.DELETE)
public ModelAndView remove(@PathVariable("value") String value) {
    Technology technology = Technology.find(value);
    if (technology != null) {
        technology.remove();/*from   www .  j ava2s. c  om*/
    }
    return new ModelAndView(new RedirectView("/technology", true));
}

From source file:com.azeredudu.api.endpoint.cart.CartEndpoint.java

@Override
@RequestMapping(value = "items/{itemId}", method = RequestMethod.DELETE)
public OrderWrapper removeItemFromOrder(HttpServletRequest request, @PathVariable("itemId") Long itemId,
        @RequestParam(value = "priceOrder", defaultValue = "true") boolean priceOrder) {
    return super.removeItemFromOrder(request, itemId, priceOrder);
}

From source file:com.baidu.stqa.signet.web.action.RemarkAction.java

/**
 * /*from w  w w  .  j a va2s . c  o  m*/
 * 
 * @param projectId
 * @param storyId
 * @param nodeId
 * @param remarkId
 * @return
 */
@RequestMapping(value = "/project/{projectId}/story/{storyId}/node/{nodeId}/remark/{remarkId}", method = RequestMethod.DELETE)
@ResponseBody
public ResponseEntity<Boolean> removeRemark(@PathVariable long projectId, @PathVariable long storyId,
        @PathVariable long nodeId, @PathVariable long remarkId) {

    doLog(projectId);
    remarkService.removeRemark(nodeId, remarkId);
    return new ResponseEntity<Boolean>(true, HttpStatus.OK);
}

From source file:apiserver.services.pdf.controllers.PagesController.java

/**
 * Delete one or more pages from a pdf//from  w  w  w  .jav a2  s  .  c om
 * @param file
 * @return
 * @throws InterruptedException
 * @throws java.util.concurrent.ExecutionException
 * @throws java.util.concurrent.TimeoutException
 * @throws java.io.IOException
 * @throws Exception
 */
@ApiOperation(value = "Delete one or more pages from a pdf")
@RequestMapping(value = "/modify/pages", method = RequestMethod.DELETE, produces = "application/pdf")
public ResponseEntity<byte[]> deletePagesFromPdf(
        @ApiParam(name = "file", required = true) @RequestPart("file") MultipartFile file,
        @ApiParam(name = "pages", required = true) @RequestPart("pages") String pages)
        throws InterruptedException, ExecutionException, TimeoutException, IOException, Exception {
    DeletePdfPagesJob job = new DeletePdfPagesJob();
    //file
    job.setFile(new Document(file));
    job.setPages(pages);

    Future<Map> future = gateway.deletePages(job);
    BinaryJob payload = (BinaryJob) future.get(defaultTimeout, TimeUnit.MILLISECONDS);

    byte[] fileBytes = payload.getPdfBytes();
    String contentType = "application/pdf";
    ResponseEntity<byte[]> result = ResponseEntityHelper.processFile(fileBytes, contentType, false);
    return result;
}