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.triptech.metahive.web.CommentController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@PreAuthorize("hasRole('ROLE_ADMIN')")
public String delete(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {

    Comment comment = Comment.findComment(id);

    String redirect = "redirect:/";

    if (comment.getDefinition() != null) {
        redirect = "redirect:/definitions/"
                + encodeUrlPathSegment(comment.getDefinition().getId().toString(), request);
    }/*from  ww  w  .  j  av a  2 s  .  co  m*/
    if (comment.getRecord() != null) {
        redirect = "redirect:/records/" + encodeUrlPathSegment(comment.getRecord().getId().toString(), request);
    }

    comment.remove();
    uiModel.asMap().clear();

    FlashScope.appendMessage(getMessage("metahive_delete_complete", Comment.class), request);

    return redirect;
}

From source file:com.groupon.odo.controllers.ProfileController.java

/**
 * Delete a profile//from   ww w .  j a  v a2  s  .  co m
 *
 * @param model
 * @param id
 * @return
 * @throws Exception
 */
@RequestMapping(value = "/api/profile", method = RequestMethod.DELETE)
public @ResponseBody HashMap<String, Object> deleteProfile(Model model, int id) throws Exception {
    profileService.remove(id);
    return Utils.getJQGridJSON(profileService.findAllProfiles(), "profiles");
}

From source file:com.mycompany.flooringmvc.controllers.AdminController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseBody/*from w  w w . ja  v a2s  .  co m*/
public void deleteP(@PathVariable("id") int type) {
    Product product = pdao.get(type);
    pdao.delete(product);

    //        return "redirect:/";
}

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

/**
 * //from   w  w w. jav a2  s  . c  om
 * 
 * @param projectId
 * @param storyId
 * @param nodeId
 * @return
 */
@RequestMapping(value = "/project/{projectId}/story/{storyId}/node/{nodeId}", method = RequestMethod.DELETE)
@ResponseBody
public ResponseEntity<Long> deleteNode(@PathVariable long projectId, @PathVariable long storyId,
        @PathVariable long nodeId) {
    doLog(projectId);
    String editUser = getNowEditUser(projectId, storyId, getUser());
    if (editUser != null) {
        return new ResponseEntity<Long>(0L, HttpStatus.OK);
    }
    nodeService.deleteNode(nodeId);
    return new ResponseEntity<Long>(nodeId, HttpStatus.OK);
}

From source file:com.example.notes.NotesController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
void delete(@PathVariable("id") long id) {
    this.noteRepository.delete(id);
}

From source file:com.navercorp.arcus.controller.ArcusController.java

/**
 * Removes an Arcus cluster. The cluster should be empty.
 *
 * @param hostport/*from w ww .  ja  va  2 s .  c om*/
 * @param clusterName
 * @return
 */
@RequestMapping(method = RequestMethod.DELETE, value = "/{hostport:.+}/clusters/{clusterName:.+}")
@ResponseBody
public RestMessage removeEmptyCluster(@PathVariable String hostport, @PathVariable String clusterName) {
    return arcusService.removeEmptyCluster(hostport, clusterName, useTx);
}

From source file:io.fourfinanceit.homework.controller.ClientController.java

@RequestMapping(value = "/client/{id}", method = RequestMethod.DELETE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Client> deleteGreeting(@PathVariable("id") Long id, @RequestBody Client client) {

    if (clientRepository.findOne(id) != null) {

        clientRepository.delete(id);/*w ww .  j  av  a  2s  .c  o  m*/
        return new ResponseEntity<Client>(HttpStatus.INTERNAL_SERVER_ERROR);
    } else {
        return new ResponseEntity<Client>(HttpStatus.NO_CONTENT);
    }

}

From source file:io.fourfinanceit.homework.controller.LoanControler.java

@RequestMapping(value = "/loan/{id}", method = RequestMethod.DELETE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<LoanApplication> deleteGreeting(@PathVariable("id") Long id,
        @RequestBody LoanApplication loanApplication) {

    if (loanApplicationRepository.findOne(id) != null) {

        loanApplicationRepository.delete(id);
        return new ResponseEntity<LoanApplication>(HttpStatus.INTERNAL_SERVER_ERROR);
    } else {//from www. ja v a  2s.c o  m
        return new ResponseEntity<LoanApplication>(HttpStatus.NO_CONTENT);
    }

}

From source file:com.groupon.odo.controllers.ScriptController.java

/**
 * Delete a script//w w w  .j  a  va 2  s . c o m
 *
 * @param model
 * @param scriptIdentifier
 * @return
 * @throws Exception
 */
@RequestMapping(value = "/api/scripts/{scriptIdentifier}", method = RequestMethod.DELETE)
public @ResponseBody HashMap<String, Object> deleteScript(Model model, @PathVariable String scriptIdentifier)
        throws Exception {
    int scriptId = Integer.parseInt(scriptIdentifier);

    ScriptService.getInstance().removeScript(scriptId);
    return this.getScripts(model, null);
}

From source file:es.fdi.reservas.reserva.web.EdificioRestController.java

@RequestMapping(value = "/admin/administrar/edificio/{numPag}/restaurar/{idEdificio}", method = RequestMethod.DELETE)
public String restaurarEdificio(@PathVariable("numPag") Long numPag,
        @PathVariable("idEdificio") Long idEdificio) {
    edificio_service.restaurarEdificio(idEdificio);
    return "redirect:/administrar/edificio/{numPag}/restaurar";
}