List of usage examples for org.springframework.http ResponseEntity ResponseEntity
public ResponseEntity(HttpStatus status)
From source file:com.basicservice.controller.ApiController.java
@ExceptionHandler(Exception.class) public ResponseEntity handleGenericException(Exception error) { try {/*from w w w .j a v a 2 s. com*/ new AppSensorException("ACE1", "Invalid request", "Generic exception occured"); } catch (Exception e) { // AppSensor might throw an exception, but we want to catch it here and stop propagation } return new ResponseEntity<String>(HttpStatus.SERVICE_UNAVAILABLE); }
From source file:com.agroservices.restcontrollers.DespachoRest.java
@RequestMapping(value = "/{id}/seEntrego", method = RequestMethod.POST) public ResponseEntity<?> modificarEstadoEntrega(@PathVariable int id, @RequestBody Despacho des) { boolean ans = df.setEstadoEntrega(id, des.isSeEntrego()); if (ans) {/*from w ww .j ava 2 s . c o m*/ return new ResponseEntity<>(HttpStatus.CREATED); } return new ResponseEntity<>(HttpStatus.CONFLICT); }
From source file:edu.eci.arsw.kalendan.controllers.TeamResourceController.java
@RequestMapping(path = "/equipos/{idT}/{permiso}", method = RequestMethod.POST) public ResponseEntity<?> teamAddMember(@PathVariable("idT") Integer teamid, @PathVariable String permiso, @RequestBody User u) {/*from w ww. j a va 2 s. com*/ try { List<Project> con = ps.getProyectos(); ts.setProyectos(con); ts.agregaProject(); System.out.println("lalalalala"); ts.agregarMiembro(u, teamid, permiso); return new ResponseEntity<>(HttpStatus.CREATED); } catch (Exception e) { Logger.getLogger(TeamResourceController.class.getName()).log(Level.SEVERE, null, e); return new ResponseEntity<>("Equipo no creado!", HttpStatus.FORBIDDEN); } }
From source file:com.abdin.noorsingles.web.AdminController.java
@RequestMapping(value = "/logout", method = RequestMethod.GET) public ResponseEntity loginPage(HttpSession session) { adminService.logout(session);//from ww w. j a va 2 s.c om return new ResponseEntity(HttpStatus.OK); }
From source file:edu.eci.cosw.restcontrollers.RestControladorCalificarEstablecimiento.java
@RequestMapping(value = "/estCalif", method = RequestMethod.POST) public ResponseEntity<?> registrarCalificacionCliente(@RequestBody Calificacion calificacion) { logica.calificarCliente(calificacion.getEnsayo().getIdEnsayo(), calificacion.getCalificacionBanda(), calificacion.getDescripcion()); return new ResponseEntity<>(HttpStatus.CREATED); }
From source file:com.sms.server.controller.JobController.java
@RequestMapping(value = "/{username}/{limit}", method = RequestMethod.GET) public ResponseEntity<List<Job>> getJobsByUsername(@PathVariable("username") String username, @PathVariable("limit") Integer limit) { List<Job> jobs = jobDao.getJobsByUsername(username, limit); if (jobs == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); }/*w w w . j a va2 s .c om*/ return new ResponseEntity<>(jobs, HttpStatus.OK); }
From source file:minium.developer.web.rest.js.SelectorGadgetResource.java
@RequestMapping(value = "/activate", method = { POST, GET }) public ResponseEntity<Void> activate() throws Exception { if (activated) { try {//from ww w . j a v a 2 s. c o m deactivate(); } catch (Exception e) { log.warn("Could not deactivate selector gadget"); } } SelectorGadgetWebElements elems = getSelectorGadgetWebElements(); if (elems == null) { return new ResponseEntity<Void>(HttpStatus.NOT_FOUND); } elems.activateSelectorGadget(); activated = true; return new ResponseEntity<Void>(HttpStatus.OK); }
From source file:com.bodybuilding.argos.controller.TurbineStreamController.java
@RequestMapping("/turbine-stream/{cluster}") public ResponseEntity<SseEmitter> streamHystrix(@PathVariable("cluster") String cluster) { Optional<HystrixClusterMonitor> clusterMonitor = clusterRegistry.getCluster(cluster); if (!clusterMonitor.isPresent()) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); }//from w ww .j a v a 2 s .c o m final SseEmitter emitter = new SseEmitter(TimeUnit.DAYS.toMillis(45)); SseEmitterUtil.bindObservable(emitter, clusterMonitor.get().observeJson().takeUntil(shutdown).subscribeOn(Schedulers.io())); return ResponseEntity.ok(emitter); }
From source file:com.agroservices.restcontrollers.CampesinoRest.java
@RequestMapping(value = "/{id}/productosEnVenta", method = RequestMethod.POST) public ResponseEntity<?> guardarProductoEnVenta(@PathVariable int id, @RequestBody ProductoEnVenta pv) { System.out.println("Post a campesinos productosEnVenta " + id); System.out.println(pv);/*from w w w . j a v a 2 s .c o m*/ try { cf.guardarProductoEnVentaParaCampesino(id, pv); return new ResponseEntity<>(HttpStatus.CREATED); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } }
From source file:net.eusashead.hateoas.conditional.interceptor.SyncTestController.java
@RequestMapping(method = RequestMethod.POST) public ResponseEntity<Void> post() { return new ResponseEntity<Void>(HttpStatus.CREATED); }