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:com.ar.dev.tierra.api.controller.TransferenciaController.java
@RequestMapping(value = "/id", method = RequestMethod.GET) public ResponseEntity<?> getById(@RequestParam("idTransferencia") int idTransferencia) { Transferencia trans = facadeService.getTransferenciaDAO().getById(idTransferencia); if (trans != null) { return new ResponseEntity<>(trans, HttpStatus.OK); } else {//from ww w . j a va2s .co m return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
From source file:net.jkratz.igdb.controller.GenreController.java
/** * Returns a single genre object if exists, otherwise returns HTTP status code 404 * * @param id ID of the Genre//from ww w .j a v a2 s . co m * @return Genre when found * @see Genre */ @RequestMapping(value = "/{id}", method = RequestMethod.GET) public ResponseEntity<?> getGenre(@PathVariable("id") Long id) { logger.debug("Attempting to fetch genre with ID: {}", id); Genre genre = genreRepository.findOne(id); if (genre == null) { return new ResponseEntity<>("Genre not found", HttpStatus.NOT_FOUND); } else { return new ResponseEntity<>(genre, HttpStatus.OK); } }
From source file:org.cloudfoundry.test.ServiceController.java
@RequestMapping(value = "/mysql", method = RequestMethod.GET) public ResponseEntity<String> getMySQLDataSourceDBUrl() { if (serviceHolder.getMySqlDataSource() == null) { return new ResponseEntity<String>(HttpStatus.NOT_FOUND); }/* www .j a v a2 s. c om*/ return new ResponseEntity<String>(serviceHolder.getMySqlDataSource().getUrl(), HttpStatus.OK); }
From source file:com.mycompany.springrest.controllers.RoleController.java
@RequestMapping(value = "/role/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Role> getRole(@PathVariable("id") int id) { Role role = roleService.getRoleById(id); logger.info("Fetching Role with id " + id); if (role == null) { logger.info("Role with id " + id + " not found"); return new ResponseEntity<Role>(HttpStatus.NOT_FOUND); }/* w w w . java2s . c o m*/ return new ResponseEntity<Role>(role, HttpStatus.OK); }
From source file:de.escalon.hypermedia.sample.event.ReviewController.java
@RequestMapping(value = "/events/{eventId}", method = RequestMethod.GET) @ResponseBody//from w w w. j a va 2 s. c o m public ResponseEntity<Resources<Review>> getReviews(@PathVariable int eventId) { List<Review> reviews = eventBackend.getReviews().get(eventId); ResponseEntity<Resources<Review>> ret; if (reviews != null) { final Resources<Review> reviewResources = new Resources<Review>(reviews); reviewResources.add( AffordanceBuilder.linkTo(AffordanceBuilder.methodOn(EventController.class).getEvent(eventId)) // passing null requires that method takes Integer, not int .withRel("hydra:search")); reviewResources.add(AffordanceBuilder .linkTo(AffordanceBuilder.methodOn(this.getClass()).addReview(eventId, null)).withSelfRel()); ret = new ResponseEntity<Resources<Review>>(reviewResources, HttpStatus.OK); } else { ret = new ResponseEntity<Resources<Review>>(HttpStatus.NOT_FOUND); } return ret; }
From source file:ca.qhrtech.controllers.TableController.java
@RequestMapping("/table/user/{id}") public ResponseEntity<List<BGLTable>> getUserTables(@PathVariable("id") long id) { if (userService.findUserById(id) == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); }//from ww w . ja v a 2 s .c o m return new ResponseEntity<>(tableService.getUserTables(id), HttpStatus.OK); }
From source file:org.kuali.mobility.configparams.controllers.ConfigParamController.java
@RequestMapping(value = "/{configParamId}", method = RequestMethod.GET, headers = "Accept=application/json") @ResponseBody//from ww w . j a va 2 s . c o m public Object get(@PathVariable("configParamId") Long configParamId) { ConfigParam param = configParamService.findConfigParamById(configParamId); if (param == null) { return new ResponseEntity<String>(HttpStatus.NOT_FOUND); } return param.toJson(); }
From source file:com.opensearchserver.hadse.index.IndexController.java
@RequestMapping(method = RequestMethod.DELETE, value = "/{index_name}") @ResponseBody/*from w ww . j a v a 2s . co m*/ public HttpEntity<?> deleteIndex(@PathVariable String index_name) { if (!IndexCatalog.exists(index_name)) return new ResponseEntity<String>("Index not found: " + index_name, HttpStatus.NOT_FOUND); try { return IndexCatalog.delete(index_name); } catch (IOException e) { return new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } }
From source file:io.onedecision.engine.OneDecisionExceptionHandler.java
@ResponseStatus(HttpStatus.NOT_FOUND) @ExceptionHandler(DecisionNotFoundException.class) public void handleNotFound(Exception e) { LOGGER.error(e.getMessage(), e); }
From source file:com.sms.server.controller.JobController.java
@RequestMapping(value = "/{id}/end", method = RequestMethod.GET) public ResponseEntity<String> endJob(@PathVariable("id") Long id) { Job job = jobDao.getJobByID(id);/* w w w . j av a2s. c o m*/ if (job == null) { return new ResponseEntity<>("Unable to retrieve job with ID: " + id, HttpStatus.NOT_FOUND); } if (job.getType() == Job.JobType.ADAPTIVE_STREAM) { adaptiveStreamingService.endProcess(job.getID()); } jobDao.updateEndTime(job.getID()); return new ResponseEntity<>("Ended job with ID: " + id, HttpStatus.OK); }