List of usage examples for org.springframework.http HttpStatus NO_CONTENT
HttpStatus NO_CONTENT
To view the source code for org.springframework.http HttpStatus NO_CONTENT.
Click Source Link
From source file:de.sainth.recipe.backend.rest.controller.CookbookController.java
@Secured({ "ROLE_USER", "ROLE_ADMIN" }) @RequestMapping("{id}") HttpEntity<Cookbook> get(@PathVariable("id") Long id) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication instanceof RecipeManagerAuthenticationToken) { RecipeManagerAuthenticationToken token = (RecipeManagerAuthenticationToken) authentication; Cookbook cookbook = repository.findOne(id); if (cookbook == null) { return new ResponseEntity<>(HttpStatus.NO_CONTENT); }//from ww w . ja v a 2 s .c om if (ROLE_ADMIN.name().equals(token.getRole()) || token.getPrincipal().equals(cookbook.getAuthor().getId())) { return new ResponseEntity<>(cookbook, HttpStatus.OK); } } return new ResponseEntity<>(HttpStatus.FORBIDDEN); }
From source file:com.expedia.seiso.web.controller.v1.NodeIpAddressControllerV1.java
@RequestMapping(value = NODE_IP_ADDRESS_URI_TEMPLATE, method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void delete(@PathVariable String nodeName, @PathVariable String ipAddress) { val itemKey = new NodeIpAddressKey(nodeName, ipAddress); basicItemDelegate.delete(itemKey);/* w w w.ja v a 2 s .c o m*/ }
From source file:com.swcguild.bluraymvc.controller.DisplayController.java
@RequestMapping(value = "/movie/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.NO_CONTENT) public void putMovie(@PathVariable("id") int id, @RequestBody Movie movie) { movie.setMovieId(id);//from w w w .j a v a 2 s .co m dao.updateMovie(movie); }
From source file:fi.helsinki.opintoni.web.rest.privateapi.portfolio.jobSearch.PrivateJobSearchResource.java
@RequestMapping(method = RequestMethod.DELETE, value = "/{jobSearchId}") public ResponseEntity<Void> insert(@UserId Long userId, @PathVariable Long jobSearchId) { permissionChecker.verifyPermission(userId, jobSearchId, JobSearch.class); jobSearchService.delete(jobSearchId); return new ResponseEntity<>(HttpStatus.NO_CONTENT); }
From source file:com.sms.server.controller.MediaController.java
@RequestMapping(value = "/folder/{id}/contents", method = RequestMethod.GET) public ResponseEntity<List<MediaElement>> getMediaElementsByMediaFolderID(@PathVariable("id") Long id) { MediaFolder mediaFolder = settingsDao.getMediaFolderByID(id); if (mediaFolder == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); }/*from w ww . j a va 2 s .com*/ List<MediaElement> mediaElements = mediaDao.getAlphabeticalMediaElementsByParentPath(mediaFolder.getPath()); if (mediaElements == null) { return new ResponseEntity<>(HttpStatus.NO_CONTENT); } return new ResponseEntity<>(mediaElements, HttpStatus.OK); }
From source file:nl.surfnet.coin.api.ConfigurableApiController.java
@RequestMapping(value = { "/sleep/{millSeconds}" }, method = RequestMethod.POST) @ResponseStatus(HttpStatus.NO_CONTENT) public void sleep(@PathVariable("millSeconds") long millSeconds) { LOG.info("Request to configure Mock External Group Provider for a sleep {} time", millSeconds); configurableGroupProvider.sleep(millSeconds); }
From source file:com.example.todo.api.todo.TodoRestController.java
@RequestMapping(value = "{todoId}", method = RequestMethod.DELETE) // (1) @ResponseStatus(HttpStatus.NO_CONTENT) // (2) public void deleteTodo(@PathVariable("todoId") String todoId) { // (3) todoService.delete(todoId); // (4) }
From source file:ca.intelliware.ihtsdo.mlds.web.rest.MemberResource.java
private ResponseEntity<?> downloadFile(HttpServletRequest request, File file) throws SQLException, IOException { if (file == null) { return new ResponseEntity<>(HttpStatus.NO_CONTENT); } else if (file.getLastUpdated() != null) { long ifModifiedSince = request.getDateHeader("If-Modified-Since"); long lastUpdatedSecondsFloor = file.getLastUpdated().getMillis() / 1000 * 1000; if (ifModifiedSince != -1 && lastUpdatedSecondsFloor <= ifModifiedSince) { return new ResponseEntity<>(HttpStatus.NOT_MODIFIED); }//from w ww . j ava 2s . c om } HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.valueOf(file.getMimetype())); httpHeaders.setContentLength(file.getContent().length()); httpHeaders.setContentDispositionFormData("file", file.getFilename()); if (file.getLastUpdated() != null) { httpHeaders.setLastModified(file.getLastUpdated().getMillis()); } byte[] byteArray = IOUtils.toByteArray(file.getContent().getBinaryStream()); org.springframework.core.io.Resource contents = new ByteArrayResource(byteArray); return new ResponseEntity<org.springframework.core.io.Resource>(contents, httpHeaders, HttpStatus.OK); }
From source file:am.ik.categolj2.api.link.LinkRestController.java
@RequestMapping(value = "**", method = RequestMethod.DELETE, headers = Categolj2Headers.X_ADMIN) public ResponseEntity<Void> deleteLinks(HttpServletRequest request) { String url = getUrl(request); linkService.delete(url);/*from w w w.ja va 2 s .c o m*/ return new ResponseEntity<>(HttpStatus.NO_CONTENT); }
From source file:org.zols.links.web.LinkController.java
@RequestMapping(value = "/{name}/link_url", method = PATCH) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void linkUrl(@PathVariable(value = "name") String name, @RequestBody String url) throws DataStoreException { linkService.linkUrl(name, url);/* www. ja va 2s . c o m*/ }