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:eu.modaclouds.sla.service.rest.MetricsReceiverRest.java
@GET public Response getRoot() { return buildResponse(HttpStatus.NOT_FOUND, "Valid method is POST /{agreementId}"); }
From source file:com.ar.dev.tierra.api.controller.TransferenciaController.java
@RequestMapping(value = "/all", method = RequestMethod.GET) public ResponseEntity<?> getAll() { List<Transferencia> list = facadeService.getTransferenciaDAO().getAll(); if (!list.isEmpty()) { return new ResponseEntity<>(list, HttpStatus.OK); } else {/*from ww w . j a v a 2 s .co m*/ return new ResponseEntity<>(HttpStatus.NOT_FOUND); } }
From source file:com.sms.server.controller.MediaController.java
@RequestMapping(value = "/folder/{id}", method = RequestMethod.GET) public ResponseEntity<MediaFolder> getMediaFolder(@PathVariable("id") Long id) { MediaFolder mediaFolder = settingsDao.getMediaFolderByID(id); if (mediaFolder == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); }//from w w w .j ava 2 s . com return new ResponseEntity<>(mediaFolder, HttpStatus.OK); }
From source file:org.nekorp.workflow.backend.controller.imp.ReporteClienteControllerImp.java
/**{@inheritDoc}*/ @Override//from w w w . j a va 2 s . c om @RequestMapping(value = "/{idServicio}", method = RequestMethod.GET) @ResponseBody public ReporteCliente getDatosReporte(@PathVariable Long idCliente, @PathVariable Long idServicio, HttpServletResponse response) { Servicio servicio = servicioDao.consultar(idServicio); if (servicio == null) { response.setStatus(HttpStatus.NOT_FOUND.value()); return null; } if (servicio.getIdCliente().longValue() != idCliente.longValue()) { response.setStatus(HttpStatus.NOT_FOUND.value()); return null; } response.setHeader("Content-Type", "application/json;charset=UTF-8"); return dataFactory.getData(servicio); }
From source file:reconf.server.services.property.ReadAllRestrictedPropertiesService.java
@RequestMapping(value = "/product/{prod}/component/{comp}/property/{prop}/rule", method = RequestMethod.GET) @Transactional(readOnly = true)// w w w.jav a 2s . com public ResponseEntity<AllRestrictedPropertiesResult> restricted(@PathVariable("prod") String product, @PathVariable("comp") String component, @PathVariable("prop") String property, HttpServletRequest request, Authentication auth) { PropertyKey key = new PropertyKey(product, component, property); if (!products.exists(key.getProduct())) { return new ResponseEntity<AllRestrictedPropertiesResult>( new AllRestrictedPropertiesResult(key, Product.NOT_FOUND), HttpStatus.NOT_FOUND); } if (!components.exists(new ComponentKey(key.getProduct(), key.getComponent()))) { return new ResponseEntity<AllRestrictedPropertiesResult>( new AllRestrictedPropertiesResult(key, Component.NOT_FOUND), HttpStatus.NOT_FOUND); } List<Property> dbProperties = properties .findByKeyProductAndKeyComponentAndKeyNameOrderByRulePriorityDescKeyRuleNameAsc(key.getProduct(), key.getComponent(), key.getName()); if (CollectionUtils.isEmpty(dbProperties)) { return new ResponseEntity<AllRestrictedPropertiesResult>( new AllRestrictedPropertiesResult(key, Property.NOT_FOUND), HttpStatus.NOT_FOUND); } List<Rule> rules = new ArrayList<>(); for (int i = 0; i < dbProperties.size() - 1; i++) { rules.add(new Rule(dbProperties.get(i))); } return new ResponseEntity<AllRestrictedPropertiesResult>( new AllRestrictedPropertiesResult(key, rules, CrudServiceUtils.getBaseUrl(request)), HttpStatus.OK); }
From source file:de.thm.arsnova.controller.SecurityExceptionControllerAdvice.java
@ResponseStatus(HttpStatus.NOT_FOUND) @ExceptionHandler(NotFoundException.class) public void handleNotFoundException(final Exception e, final HttpServletRequest request) { }
From source file:reconf.server.services.property.DeletePropertyService.java
@RequestMapping(value = "/product/{prod}/component/{comp}/property/{prop}", method = RequestMethod.DELETE) @Transactional// www .j a v a 2 s. c o m public ResponseEntity<PropertyResult> global(@PathVariable("prod") String product, @PathVariable("comp") String component, @PathVariable("prop") String property, Authentication auth) { PropertyKey key = new PropertyKey(product, component, property); Property reqProperty = new Property(key, null); List<String> errors = DomainValidator.checkForErrors(key); if (!errors.isEmpty()) { return new ResponseEntity<PropertyResult>(new PropertyResult(reqProperty, errors), HttpStatus.BAD_REQUEST); } if (!properties.exists(key)) { return new ResponseEntity<PropertyResult>(new PropertyResult(reqProperty, Property.NOT_FOUND), HttpStatus.NOT_FOUND); } properties.delete(key); return new ResponseEntity<PropertyResult>(HttpStatus.OK); }
From source file:alfio.controller.api.admin.LocationApiController.java
@ExceptionHandler(LocationNotFound.class) @ResponseStatus(HttpStatus.NOT_FOUND) public String locationException(Exception e) { return e.getMessage(); }
From source file:au.id.hazelwood.sos.web.controller.framework.GlobalExceptionHandlerUnitTest.java
@Test public void testHandleNotFound() throws Exception { WebRequest webRequest = mock(WebRequest.class); ResponseEntity<Object> responseEntity = handler .handleNotFound(new NoSuchMethodException("Entity not found"), webRequest); assertResponseEntity(responseEntity, HttpStatus.NOT_FOUND, "Entity not found"); verifyZeroInteractions(webRequest);// www. jav a 2s .c om }
From source file:demo.service.RemoteVehicleDetailsService.java
@Override public VehicleDetails getVehicleDetails(VehicleIdentificationNumber vin) throws VehicleIdentificationNumberNotFoundException { Assert.notNull(vin, "VIN must not be null"); String url = this.properties.getRootUrl() + "vehicle/{vin}/details"; logger.debug("Retrieving vehicle data for: " + vin + " from: " + url); try {//from w w w .j a v a 2s .c o m return this.restTemplate.getForObject(url, VehicleDetails.class, vin); } catch (HttpStatusCodeException ex) { if (HttpStatus.NOT_FOUND.equals(ex.getStatusCode())) { throw new VehicleIdentificationNumberNotFoundException(vin, ex); } throw ex; } }