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 the payload of {@link #getJson()} wrapped into another element to simulate a change in the representation. * //from w ww. j av a 2 s . c o m * @return */ @GetMapping(path = "/changed", produces = MediaType.APPLICATION_JSON_VALUE) Map<String, Object> getChangedJson() { return Collections.singletonMap("user", getJson()); }
From source file:org.oncoblocks.centromere.web.controller.ReadOnlyApiController.java
/** * {@code POST /}/*from w w w . j ava 2 s . c o m*/ * Attempts to create a new record using the submitted entity. Throws an exception if the * entity already exists. * * @return updated representation of the submitted entity */ @RequestMapping(value = "", method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, ApiMediaTypes.APPLICATION_HAL_JSON_VALUE, ApiMediaTypes.APPLICATION_HAL_XML_VALUE, MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_PLAIN_VALUE }) public HttpEntity<?> create(@RequestBody T entity, HttpServletRequest request) { throw new MethodNotAllowedException(); }
From source file:com.github.lynxdb.server.api.http.handlers.EpStats.java
@RequestMapping(path = "/region_clients", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity regionClients() { return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build(); }
From source file:org.craftercms.commons.jackson.mvc.GDataPropertyFilterTest.java
@Test public void testNoSelector() throws Exception { this.mockMvc.perform(get(FilterTestController.SELECTOR) //Url .contentType(MediaType.APPLICATION_JSON)) // .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON_VALUE)) // Check that is JSON .andExpect(jsonPath("$.name").exists()).andExpect(jsonPath("$.birthday").exists()) .andExpect(jsonPath("$" + ".id").exists()); }
From source file:org.messic.server.facade.controllers.rest.SearchController.java
@ApiMethod(path = "/services/search?content=xxxx", verb = ApiVerb.GET, description = "Search at messic by everything", produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE }) @ApiErrors(apierrors = { @ApiError(code = UnknownMessicRESTException.VALUE, description = "Unknown error"), @ApiError(code = NotAuthorizedMessicRESTException.VALUE, description = "Forbidden access") }) @RequestMapping(value = "", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK)//from w w w .ja v a 2s.c o m @ResponseBody @ApiResponseObject public RandomList find( @ApiParam(name = "content", description = "content to search. This content will be used to compare with a lot of things. The content will be separated by spaces, allowing multiple searches. If some words are quoted, then the search will be the whole quoted phrase.", paramType = ApiParamType.QUERY, required = true) @RequestParam(value = "content", required = true) String content) throws NotAuthorizedMessicRESTException, UnknownMessicRESTException { User user = SecurityUtil.getCurrentUser(); try { RandomList list = searchAPI.search(user.getLogin(), content); return list; } catch (Exception e) { throw new UnknownMessicRESTException(e); } }
From source file:com.springboot.demo.web.rest.HotelController.java
@RequestMapping(value = "/city/{city}/country/{country}/hotel/{hotel}/review", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody/*from ww w . j a va 2 s .co m*/ @Transactional(readOnly = true) public Page<Review> getHotelReview(@PathVariable("city") String city, @PathVariable("country") String country, @PathVariable("hotel") String hotel) { final City citi = cityService.getCity(city, country); PageRequest pageRequest = new PageRequest(0, 4); log.info("Cache time config value " + cacheTime); return this.hotelService.getReviews(this.hotelService.getHotel(citi, hotel), pageRequest); }
From source file:br.upe.community.ui.ControllerCategoria.java
@RequestMapping(value = "/atualizar", headers = "Accept=*/*", produces = MediaType.APPLICATION_JSON_VALUE) public @ResponseBody ResponseEntity<?> atualizarCategoria(String nomeAtual, String nomeAtualizar) { Categoria categoria;//w ww . jav a 2 s . co m try { categoria = fachada.consultarPorNomeCategoria(nomeAtual); categoria.setNome(nomeAtualizar); fachada.atualizar(nomeAtual, nomeAtualizar); return new ResponseEntity<String>(HttpStatus.OK); } catch (CategoriaInexistenteException ex) { return new ResponseEntity<CategoriaInexistenteException>(ex, HttpStatus.BAD_REQUEST); } }
From source file:com.todo.backend.web.rest.TodoApi.java
@RequestMapping(value = "/todo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed// w w w .j a va 2 s . c o m @Transactional public ResponseEntity<CreateTodoResponse> createTodo(@Valid @RequestBody CreateTodoRequest request) throws URISyntaxException { log.debug("POST /todo {}", request); final Todo todo = convertToTodo(request); final Todo result = todoRepository.save(todo); return ResponseEntity.created(new URI("/todo/" + result.getId())).body(convertToCreateTodoResponse(result)); }
From source file:com._8x8.presentation.restfulController.ZPayRestfulController.java
@RequestMapping(value = "/getVendorInfoByQRCode/{qrCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<User> listVendorUsers(@PathVariable("qrCode") String qrCode) { try {/*w ww .j a v a2 s . c o m*/ String code = _encryptorService.decryptCode(qrCode); int id = Integer.parseInt(code); User user = _userService.GetUserById(id); if (user == null) { System.out.println("User with id " + id + " not found"); return new ResponseEntity<User>(HttpStatus.NOT_FOUND); } return new ResponseEntity<User>(user, HttpStatus.OK); } catch (Exception ex) { Logger.getLogger(ZPayRestfulController.class.getName()).log(Level.SEVERE, null, ex); return new ResponseEntity<User>(HttpStatus.NOT_FOUND); } }
From source file:com.esri.geoportal.harvester.rest.TriggerController.java
/** * Lists all triggers.// w ww .j a v a2 s.com * @return array of trigger templates */ @RequestMapping(value = "/rest/harvester/triggers/types", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public UITemplate[] listTriggerTypes() { LOG.debug(String.format("GET /rest/harvester/triggers/types")); return engine.getTemplatesService().getTriggersTemplates(LocaleContextHolder.getLocale()) .toArray(new UITemplate[0]); }