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:eu.freme.broker.eservices.UserController.java
@RequestMapping(value = "/user/{username}", method = RequestMethod.DELETE) @Secured({ "ROLE_USER", "ROLE_ADMIN" }) public ResponseEntity<String> deleteUser(@PathVariable("username") String username) { User user = userDAO.getRepository().findOneByName(username); if (user == null) { throw new BadRequestException("User not found"); }//from w w w .j av a 2s. c om Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); decisionManager.decide(authentication, user, accessLevelHelper.writeAccess()); userDAO.delete(user); return new ResponseEntity<String>(HttpStatus.NO_CONTENT); }
From source file:com.marklogic.samplestack.web.QnADocumentController.java
/** * Deletes a QnADocument by id//from w w w. j a v a 2 s . com * @param id the id of the QnADocument to delete. * @return An empty response, 204 HTTP status. */ @RequestMapping(value = "questions/{id}", method = RequestMethod.DELETE) public @ResponseBody @PreAuthorize("hasRole('ROLE_ADMINS')") ResponseEntity<?> delete( @PathVariable(value = "id") String id) { qnaService.delete("/questions/" + id); return new ResponseEntity<Void>(HttpStatus.NO_CONTENT); }
From source file:com._8x8.presentation.restController.UserRestController.java
@RequestMapping(value = "/users/", method = RequestMethod.DELETE) public ResponseEntity<User> deleteAllUsers() { // System.out.println("Deleting All Users"); // // w w w .j a v a2 s . c om // userService.deleteAllUsers(); return new ResponseEntity<User>(HttpStatus.NO_CONTENT); }
From source file:com._8x8.presentation.restfulController.UserRestController.java
@RequestMapping(value = "/user/", method = RequestMethod.DELETE) public ResponseEntity<User> deleteAllUsers() { // System.out.println("Deleting All Users"); // /*from w w w . ja v a2s . c om*/ // userService.deleteAllUsers(); return new ResponseEntity<User>(HttpStatus.NO_CONTENT); }
From source file:com.logsniffer.event.publisher.http.HttpPublisherTest.java
@Test public void testPost() throws PublishException { stubFor(post(urlEqualTo("/eventId/12345")).withRequestBody(equalTo("eventbody")) .willReturn(aResponse().withStatus(HttpStatus.NO_CONTENT.value()) .withHeader("Content-Type", "text/xml").withBody("<response>Some content</response>"))); publisher.setMethod(HttpMethod.POST); publisher.setUrl("http://localhost:" + port + "/eventId/12345"); publisher.setBody("eventbody"); Event event = new Event(); event.setId("123"); publisher.publish(event);/*from w w w. java 2 s . c o m*/ }
From source file:org.cloudfoundry.tools.timeout.ReplayingTimeoutProtectionStrategy.java
public void handlePoll(TimeoutProtectionHttpRequest request, HttpServletResponse response) throws IOException { String uid = request.getUid(); long startTime = System.currentTimeMillis(); do {//from w w w.j a v a2 s.c o m MonitorFactory completedRequest; synchronized (this.completedRequests) { if (!this.completedRequests.containsKey(uid)) { try { this.completedRequests.wait(this.completedRequestsWaitTime); } catch (InterruptedException e) { } } completedRequest = this.completedRequests.remove(uid); } if (completedRequest != null) { completedRequest.replay(response); return; } } while (System.currentTimeMillis() - startTime < this.longPollTime); response.setHeader(TimeoutProtectionHttpHeader.POLL, uid); response.setStatus(HttpStatus.NO_CONTENT.value()); }
From source file:com.wisemapping.rest.AccountController.java
@ApiIgnore @RequestMapping(method = RequestMethod.POST, value = "/logger/editor", consumes = { "application/xml", "application/json" }, produces = { "application/json", "text/html", "application/xml" }) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void logError(@RequestBody RestLogItem item, @NotNull HttpServletRequest request) { final Mindmap mindmap = mindmapService.findMindmapById(item.getMapId()); final User user = Utils.getUser(); logger.error("Unexpected editor error - " + item.getJsErrorMsg()); notificationService.reportJavascriptException(mindmap, user, item.getJsErrorMsg() + "\n" + item.getJsStack(), request); }
From source file:web.EventLogRESTController.java
/** * Deletes an event from the Event Log through the REST API * @param id/* ww w .jav a 2 s . co m*/ * @return */ @RequestMapping(value = "/api/eventlog/{id}", method = RequestMethod.DELETE) public ResponseEntity<EventLog> deleteEvent(@PathVariable("id") int id) { EventLog el = null; //gets Event info. Returns NOT_FOUND error if no Event exists try { el = dao.getEventsById(id); } catch (EmptyResultDataAccessException ex) { return new ResponseEntity<EventLog>(HttpStatus.NOT_FOUND); } //otherwise returns NO_CONTENT status after deletion dao.deleteEvent(id); return new ResponseEntity<EventLog>(HttpStatus.NO_CONTENT); }
From source file:io.syndesis.runtime.BaseITCase.java
protected <T> ResponseEntity<T> delete(String url) { return delete(url, null, tokenRule.validToken(), HttpStatus.NO_CONTENT); }
From source file:rest.DependenciaRestController.java
@RequestMapping(value = "/dependencias/", method = RequestMethod.DELETE) public ResponseEntity<DependenciaBean> deleteAllDependencias() { System.out.println("Eliminando Todas las Dependencias"); dependenciaService.deleteAll();/*from w ww . ja va 2s .c o m*/ return new ResponseEntity<DependenciaBean>(HttpStatus.NO_CONTENT); }