Example usage for org.springframework.http MediaType APPLICATION_JSON_UTF8_VALUE

List of usage examples for org.springframework.http MediaType APPLICATION_JSON_UTF8_VALUE

Introduction

In this page you can find the example usage for org.springframework.http MediaType APPLICATION_JSON_UTF8_VALUE.

Prototype

String APPLICATION_JSON_UTF8_VALUE

To view the source code for org.springframework.http MediaType APPLICATION_JSON_UTF8_VALUE.

Click Source Link

Document

A String equivalent of MediaType#APPLICATION_JSON_UTF8 .

Usage

From source file:com.vgorcinschi.bootone.web.JournalController.java

@RequestMapping(value = "/journal", produces = { MediaType.APPLICATION_JSON_UTF8_VALUE })
public @ResponseBody List<Journal> getJournal() {
    System.out.println("method getJournal entered");
    return journalRepository.findAll();
}

From source file:org.leandreck.endpoints.epname.Endpoint.java

@RequestMapping(value = "/int", method = GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public String getInt() {
    return "Some";
}

From source file:com.example.endpoint.ApplicationController.java

@GetMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
ApplicationEntity getApplication(@RequestParam(value = "client_id") final String clientId) {
    return applicationRepository.findApplication(clientId)
            .map(a -> new ApplicationEntity(a.getClientId(), a.getClientSecret(), Scope.allAsString(),
                    a.getUser().getAuthoritiesAsString(), a.getRedirectUri()))
            .orElseThrow(ResourceNotFoundException::new);
}

From source file:com.mycompany.geocoordinate.controller.LineController.java

@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = "/line", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<List<Integer>> line(@RequestBody GeoObject geoObject) {

    boolean check = coordinateMapper.isThereGeoObjectFromLinetype(GeoType.GEOLINE) != null
            & coordinateMapper.selectCoordinateForLineorCircle(geoObject.getCoordinate()) != null;

    coordinateMapper.insertCoordinateForLine(GeoObject.getGEOLINE(), geoObject.getCoordinate());
    List<Integer> responseType = coordinateMapper.selectIdGeo(geoObject.getCoordinate());
    return ResponseEntity.status(HttpStatus.CREATED).body(responseType);

}

From source file:br.com.hyperclass.snackbar.restapi.StockController.java

@RequestMapping(value = "/stock/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<ProductWrapper> addItemStock(@RequestBody final ProductWrapper productWrapper) {
    final Product product = new Product(productWrapper.getName(), productWrapper.getPrice());
    stock.addItemStock(product);//from w  w w.  j  a  v a  2  s  .c  om
    return new ResponseEntity<>(HttpStatus.OK);
}

From source file:com.mycompany.geocoordinate.controller.PolygonController.java

@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = "/polygon", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody ResponseEntity<List<Integer>> polygon(@RequestBody GeoObject geoObject)
        throws IOException, JsonException {

    boolean check = coordinateMapper.isThereGeoObjectFromPolygontype(GeoType.POLYGON) != null
            & coordinateMapper.selectCoordinateForLineorCircle(geoObject.getCoordinate()) != null;

    coordinateMapper.insertCoordinateForLineorCircle(GeoType.POLYGON, geoObject.getCoordinate());

    List<Integer> responseType = coordinateMapper.selectIdGeo(geoObject.getCoordinate());

    return ResponseEntity.created(URI.create("/polygon/id")).body(responseType);

}

From source file:com.snv.todo.TodoController.java

/**
 * {@inheritDoc}/*from   w  w w .  j  a v a2s.  c o  m*/
 */
@Override
@RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Todo post(@Valid @RequestBody final Todo todo) {
    return todoService.create(todo);
}

From source file:br.com.hyperclass.snackbar.restapi.MenuController.java

@RequestMapping(value = "/menu", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<ProductWrapper> registerProduct(@RequestBody final ProductWrapper productWrapper) {
    final Product product = new Product(productWrapper.getName(), productWrapper.getPrice());
    menu.addProductMenu(product);//  ww  w.j a  v  a 2  s . c  o m
    return new ResponseEntity<>(HttpStatus.OK);
}

From source file:com.mycompany.geocoordinate.controller.PointController.java

@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = "/point", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody ResponseEntity<List<Integer>> point(@RequestBody GeoObject geoObject)
        throws IOException, JSONException {

    boolean check = coordinateMapper.isThereGeoObjectFromCircleType(GeoType.GEOPOINT) != null
            & coordinateMapper.selectCoordinateForLineorCircle(geoObject.getCoordinate()) != null;

    coordinateMapper.insertCoordinateForLineorCircle(GeoType.GEOPOINT, geoObject.getCoordinate());

    List<Integer> responseType = coordinateMapper.selectIdGeo(geoObject.getCoordinate());

    return ResponseEntity.created(URI.create("/point/id")).body(responseType);

}

From source file:com.cultureofcode.diceware.NumberControllerTest.java

@Test
public void getDefaultLength() throws Exception {

    mockMvc.perform(get("/diceware/numbers")).andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
            .andExpect(jsonPath("diceware_numbers").isArray())
            .andExpect(jsonPath("diceware_numbers", hasSize(5)));
}