List of usage examples for org.springframework.http HttpStatus NOT_FOUND
HttpStatus NOT_FOUND
To view the source code for org.springframework.http HttpStatus NOT_FOUND.
Click Source Link
From source file:net.orpiske.tcs.service.rest.controller.ReferencesCommandsController.java
@RequestMapping(method = RequestMethod.POST) @ResponseBody/*ww w . ja v a 2s. co m*/ public ResponseEntity<String> updateCloud(@RequestBody ReferenceCreateData data) { if (logger.isDebugEnabled()) { logger.debug("References command controller handling a create request for " + data); } ReferenceCreateEvent tagCloudEvent = tagCloudService.createReference(new RequestCreateReference(data)); if (!tagCloudEvent.isEntityFound()) { return new ResponseEntity(HttpStatus.NOT_FOUND); } if (!tagCloudEvent.isUpdated()) { return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity(HttpStatus.OK); }
From source file:com.ar.dev.tierra.api.controller.MetodoPagoFacturaController.java
@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> getAll() { List<MetodoPagoFactura> list = facadeService.getMetodoPagoFacturaDAO().getAll(); if (!list.isEmpty()) { return new ResponseEntity<>(list, HttpStatus.OK); } else {// w w w. j a v a 2 s . com return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
From source file:org.cloudfoundry.maven.Start.java
@Override protected void doExecute() throws MojoExecutionException { try {//from w w w. j a v a2 s . c o m CloudApplication application = getClient().getApplication(getAppname()); if (application.getRunningInstances() > 0) { getLog().info(String.format("Application '%s' is already started", getAppname())); } else { getLog().info(String.format("Starting application '%s'", getAppname())); final StartingInfo startingInfo = getClient().startApplication(getAppname()); showStagingStatus(startingInfo); application = getClient().getApplication(getAppname()); showStartingStatus(application); showStartResults(application, getAllUris()); } } catch (CloudFoundryException e) { if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { throw new MojoExecutionException(String.format("Application '%s' does not exist", getAppname()), e); } } }
From source file:reconf.server.services.property.ReadPropertyService.java
@RequestMapping(value = "/product/{prod}/component/{comp}/property/{prop}", method = RequestMethod.GET) @Transactional(readOnly = true)//from w w w.jav a2 s. c o m public ResponseEntity<PropertyResult> global(@PathVariable("prod") String product, @PathVariable("comp") String component, @PathVariable("prop") String property, HttpServletRequest request, Authentication auth) { PropertyKey key = new PropertyKey(product, component, property); Property reqProperty = new Property(key); if (!products.exists(key.getProduct())) { return new ResponseEntity<PropertyResult>(new PropertyResult(reqProperty, Product.NOT_FOUND), HttpStatus.NOT_FOUND); } if (!components.exists(new ComponentKey(key.getProduct(), key.getComponent()))) { return new ResponseEntity<PropertyResult>(new PropertyResult(reqProperty, Component.NOT_FOUND), HttpStatus.NOT_FOUND); } Property dbProperty = properties.findOne(key); if (dbProperty == null) { return new ResponseEntity<PropertyResult>(new PropertyResult(reqProperty, Property.NOT_FOUND), HttpStatus.NOT_FOUND); } PropertyResult result = new PropertyResult(dbProperty, CrudServiceUtils.getBaseUrl(request)); result.addSelfUri(CrudServiceUtils.getBaseUrl(request)); return new ResponseEntity<PropertyResult>(result, HttpStatus.OK); }
From source file:org.lecture.controller.BaseController.java
@ExceptionHandler(ResourceNotFoundException.class) @ResponseStatus(HttpStatus.NOT_FOUND) public String handleNotFound(ResourceNotFoundException ex) { return ex.toString(); }
From source file:org.openbaton.marketplace.api.exceptions.GlobalExceptionHandler.java
@ExceptionHandler({ NotFoundException.class, ImageRepositoryNotEnabled.class }) @ResponseStatus(value = HttpStatus.NOT_FOUND) protected ResponseEntity<Object> handleNotFoundException(HttpServletRequest req, Exception e) { log.error("Exception with message " + e.getMessage() + " was thrown"); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); Map body = new HashMap<>(); body.put("error", "Not Found"); body.put("exception", e.getClass().toString()); body.put("message", e.getMessage()); body.put("path", req.getRequestURI()); body.put("status", HttpStatus.NOT_FOUND.value()); body.put("timestamp", new Date().getTime()); ResponseEntity responseEntity = new ResponseEntity(body, headers, HttpStatus.NOT_FOUND); return responseEntity; }
From source file:com.ar.dev.tierra.api.controller.DetalleTransferenciaController.java
@RequestMapping(value = "/trans", method = RequestMethod.GET) public ResponseEntity<?> getByTransferencia(@RequestParam("idTransferencia") int idTransferencia) { List<DetalleTransferencia> list = facadeService.getDetalleTransferenciaDAO() .getByTransferencia(idTransferencia); if (!list.isEmpty()) { return new ResponseEntity<>(list, HttpStatus.OK); } else {//from w w w.j a v a 2 s.c o m return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
From source file:cn.edu.zjnu.acm.judge.controller.MailController.java
@GetMapping("/deletemail") public String delete(@RequestParam("mail_id") long mailId, Authentication authentication) { Mail mail = mailMapper.findOne(mailId); if (mail == null) { throw new MessageException("No such mail", HttpStatus.NOT_FOUND); }//w w w . ja v a 2s . c om if (!UserDetailService.isUser(authentication, mail.getTo())) { throw new MessageException("Sorry, invalid access", HttpStatus.FORBIDDEN); } mailMapper.delete(mailId); return "redirect:/mail"; }
From source file:com.budiana.irpan.belajar.controller.PesertaController.java
@RequestMapping(value = "/peserta/{id}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK)//w ww. ja va2 s. c o m public ResponseEntity<Peserta> cariPesertaById(@PathVariable("id") String id) { Peserta hasil = pd.findOne(id); if (hasil == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } return new ResponseEntity<Peserta>(hasil, HttpStatus.OK); }
From source file:net.oneandone.stool.overview.ProcessesController.java
@RequestMapping(value = "{id}", method = RequestMethod.GET) @ResponseBody/*from w ww.ja v a2 s.c o m*/ public ResponseEntity state(@PathVariable(value = "id") String id) throws IOException { Node stat; String stoolProcess; stat = logs.join(id + ".stat"); if (!stat.exists()) { return new ResponseEntity(HttpStatus.NOT_FOUND); } stoolProcess = stat.readString(); return new ResponseEntity(stoolProcess, HttpStatus.OK); }