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:test.phoenixnap.oss.plugin.naming.testclasses.UriPrefixIgnoredController.java
@RequestMapping(value = METHOD_PART + "/base/endpoint", method = { RequestMethod.POST }, produces = { MediaType.APPLICATION_JSON_VALUE }) public String secondEndpoint() { return null;/*from w w w . ja v a 2s. c om*/ }
From source file:de.document.controller.UmlsController.java
@RequestMapping(value = "/query", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Collection<Umls> readAll() { //List<Umls> list = new ArrayList<>(); //List<Umls> list = service.readAll(); UmlsList u = new UmlsList(umlsterm); System.out.println("hello get"); return u.list(umlsterm); }
From source file:com.springboot.demo.web.rest.HotelController.java
@RequestMapping(value = "/city/{city}/country/{country}/hotel/{hotel}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody//w ww .ja va2s . c o m @Transactional(readOnly = true) public Hotel getHotel(@PathVariable("city") String city, @PathVariable("country") String country, @PathVariable("hotel") String hotel) { final City citi = cityService.getCity(city, country); return this.hotelService.getHotel(citi, hotel); }
From source file:com.tess4j.rest.Tess4jV1.java
@RequestMapping(value = "ocr/v0.9/upload", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public Status doOcrFile(@RequestBody final Image image) throws Exception { File tmpFile = File.createTempFile("ocr_image", image.getExtension()); try {//from ww w . j a v a 2 s . c om FileUtils.writeByteArrayToFile(tmpFile, Base64.decodeBase64(image.getImage())); Tesseract tesseract = Tesseract.getInstance(); // JNA Interface Mapping String imageText = tesseract.doOCR(tmpFile); LOGGER.info("OCR Image Text = " + imageText); } catch (Exception e) { LOGGER.error("Exception while converting/uploading image: ", e); throw new TesseractException(); } finally { tmpFile.delete(); } return new Status("success"); }
From source file:com._8x8.presentation.restController.UserRestController.java
@RequestMapping(value = "/user/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<User> getUser(@PathVariable("id") int id) { System.out.println("Fetching User with id " + id); User user = _userService.GetUserById(id); if (user == null) { System.out.println("User with id " + id + " not found"); return new ResponseEntity<User>(HttpStatus.NOT_FOUND); }/* w w w . j a v a 2 s .com*/ return new ResponseEntity<User>(user, HttpStatus.OK); }
From source file:org.messic.server.facade.controllers.rest.JSONDocController.java
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody JSONDoc getApi() { ArrayList<String> packagesList = new ArrayList<String>(); packagesList.add(SecurityLoginSuccessHandler.class.getPackage().getName()); packagesList.add(this.getClass().getPackage().getName()); packagesList.add(Album.class.getPackage().getName()); return JSONDocUtils.getApiDoc(version, basePath, packagesList); }
From source file:com.github.lynxdb.server.api.http.handlers.EpStats.java
@RequestMapping(path = "/jvm", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity jvm() { return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build(); }
From source file:be.ehb.restservermetdatabase.webservice.GameController.java
@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ArrayList<Game> list() { ArrayList<Game> games = GameDao.getGames(); for (Game g : games) { g.setIcon(getImg(g.getIcon()));/*from w w w. j a v a 2 s . c om*/ } return games; }
From source file:com.indeed.imhotep.web.TokenizeController.java
@RequestMapping("/tokenize") @ResponseBody/*from w w w . j av a 2s .co m*/ protected void handleTokenize(@RequestParam("q") String query, HttpServletResponse resp) throws IOException { resp.setHeader("Access-Control-Allow-Origin", "*"); try { final List<Token> tokens = TerminalParser.LEXER.parse(query); final ServletOutputStream outputStream = resp.getOutputStream(); resp.setContentType(MediaType.APPLICATION_JSON_VALUE); final ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); final ObjectNode jsonRoot = mapper.createObjectNode(); final ArrayNode tokenArrayNode = jsonRoot.arrayNode(); jsonRoot.put("tokens", tokenArrayNode); for (Token token : tokens) { final ObjectNode tokenNode = tokenArrayNode.objectNode(); final String text = token.value() instanceof Tokens.Fragment ? ((Tokens.Fragment) token.value()).text() : (String) token.value(); final String tag = token.value() instanceof Tokens.Fragment ? ((Tokens.Fragment) token.value()).tag().toString() : "STRING"; tokenNode.put("text", text); tokenNode.put("index", token.index()); tokenNode.put("length", token.length()); tokenNode.put("tag", tag); tokenArrayNode.add(tokenNode); } mapper.writeValue(outputStream, jsonRoot); outputStream.close(); } catch (Throwable e) { QueryServlet.handleError(resp, true, e, false, false); } }
From source file:com.ns.retailmgr.controller.ShopController.java
@ApiOperation(consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE, httpMethod = "POST", value = "", response = String.class, notes = "Save the shop details") @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Object> saveShop(@RequestBody ShopDetails shopDetails) { LOGGER.info("Started endpoint method {}, params - {}", "saveShop"); try {//from w w w .j a v a 2s . c om ShopDetails newShopDetails = shopService.addShop(shopDetails); if (newShopDetails == null) { return new ResponseEntity<Object>( "Unable to find latitude and logitude for shop details provided, please check and resubmit again", HttpStatus.BAD_REQUEST); } if (newShopDetails.getStatus() != null) return new ResponseEntity<Object>(HttpStatus.CREATED); else return new ResponseEntity<Object>(newShopDetails, HttpStatus.OK); } catch (Exception e) { LOGGER.error("Exception {}", e); return new ResponseEntity(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } }