List of usage examples for org.springframework.http MediaType APPLICATION_JSON_VALUE
String APPLICATION_JSON_VALUE
To view the source code for org.springframework.http MediaType APPLICATION_JSON_VALUE.
Click Source Link
From source file:example.users.UserController.java
/** * Returns a simple JSON payload./*from w w w .ja v a 2 s. c o m*/ * * @return */ @GetMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE) Map<String, Object> getJson() { Map<String, Object> result = new HashMap<>(); result.put("firstname", "Dave"); result.put("lastname", "Matthews"); return result; }
From source file:com.expedia.seiso.web.controller.v1.NodeIpAddressControllerV1.java
@RequestMapping(value = NODE_IP_ADDRESS_URI_TEMPLATE, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Resource get(@PathVariable String nodeName, @PathVariable String ipAddress) { val itemKey = new NodeIpAddressKey(nodeName, ipAddress); return basicItemDelegate.getOne(ApiVersion.V1, itemKey); }
From source file:org.sharetask.controller.WorkspaceController.java
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody//from w w w. j a v a 2 s . c o m public WorkspaceDTO create(@RequestBody final WorkspaceDTO workspace) { return workspaceService.create(workspace); }
From source file:br.com.fatecpg.web.controllers.AccountController.java
@RequestMapping(value = "/login", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody/*ww w . jav a 2 s .co m*/ public LoginResultModel login(String enrollment) { if (!enrollment.toLowerCase().contains("f")) enrollment = "f" + enrollment; LoginResultModel response = new LoginResultModel(); Student student = studentRepository.get(enrollment); if (student == null) { response.setSuccess(false); response.setMessage( String.format("Nenhum aluno encontrado para o nmero de matrcula \"%s\" :-(", enrollment)); } else { response.setSuccess(true); response.setStudent(student); this.session.setAttribute("student", student); } return response; }
From source file:org.openbaton.autoscaling.api.RestElasticityManagementInterface.java
/** * Activates autoscaling for the passed NSR * * @param msg : NSR in payload to add for autoscaling *///from ww w . j ava 2 s .c o m @RequestMapping(value = "INSTANTIATE_FINISH", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public void activate(@RequestBody String msg) throws NotFoundException, VimException { log.trace("msg=" + msg); JsonParser jsonParser = new JsonParser(); JsonObject json = jsonParser.parse(msg).getAsJsonObject(); Gson mapper = new GsonBuilder().create(); Action action = mapper.fromJson(json.get("action"), Action.class); log.trace("ACTION=" + action); NetworkServiceRecord nsr = mapper.fromJson(json.get("payload"), NetworkServiceRecord.class); log.trace("NSR=" + nsr); elasticityManagement.activate(nsr.getProjectId(), nsr.getId()); }
From source file:io.fourfinanceit.homework.controller.LoanControler.java
@RequestMapping(value = "/loan/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<LoanApplication> getLoanApplication(@PathVariable("id") Long id) { LoanApplication loanApplication = loanApplicationRepository.findOne(id); if (loanApplication == null) { return new ResponseEntity<LoanApplication>(HttpStatus.NOT_FOUND); }// w w w . j a v a 2 s .c o m return new ResponseEntity<LoanApplication>(loanApplication, HttpStatus.OK); }
From source file:com.github.lynxdb.server.api.http.handlers.EpConfig.java
@RequestMapping(path = "/filters", method = { RequestMethod.GET, RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity filters() { return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build(); }
From source file:feign.form.feign.spring.IMultipartSupportService.java
@RequestMapping(value = "/multipart/upload3/{folder}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody//from ww w . j a v a 2 s .co m String upload3(@RequestBody MultipartFile file, @PathVariable("folder") String folder, @RequestParam(value = "message", required = false) String message);
From source file:io.pivotal.strepsirrhini.chaoslemur.task.TaskManager.java
@RequestMapping(method = RequestMethod.GET, value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<?> read(@PathVariable Long id) { Task task = this.tasks.get(id); if (task == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); }//from w ww .j a v a 2 s . c om return new ResponseEntity<>(this.resourceAssembler.toResource(task), HttpStatus.OK); }
From source file:com.springboot.demo.web.rest.CityController.java
@RequestMapping(value = "/{city}/country/{country}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody// w w w.j a va 2s. c o m @Transactional(readOnly = true) public City getCity(@PathVariable("city") String city, @PathVariable("country") String country) { City result = this.cityService.getCity(city, country); if (result == null) { throw new CityNotFoundException(); } return result; }