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.snv.bank.account.AccountController.java

/**
 * {@inheritDoc}/*  ww  w  .ja va 2s. c  om*/
 */
@RequestMapping(method = RequestMethod.POST, path = "/create", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Override
public Account post(@RequestBody(required = true) final Account account) {
    return accountService.create(account);
}

From source file:com.snv.calendar.CalendarController.java

/**
 * {@inheritDoc}// w w w . j  a v  a  2s .  c om
 */
@Override
@RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Calendar post(@Valid @RequestBody final Calendar calendar) {
    return calendarService.create(calendar);
}

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

/**
 * {@inheritDoc}/*from   w ww  . j  a  v a 2  s . c  om*/
 */
@Override
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<Todo> getAll() {
    return todoService.getAll();
}

From source file:su90.mybatisdemo.web.endpoints.EmployeesEndpoints.java

@RequestMapping(value = "/getall", method = RequestMethod.GET, produces = {
        MediaType.APPLICATION_JSON_UTF8_VALUE })
public ResponseEntity<List<EmployeeOut>> getAll() {
    List<EmployeeOut> result = employeesService.getWebBeans();
    if (result.isEmpty()) {
        return new ResponseEntity<>(result, HttpStatus.NO_CONTENT);
    }// w  ww  .ja v a  2s .  co m
    return new ResponseEntity<>(result, HttpStatus.OK);
}

From source file:com.snv.calendar.CalendarController.java

/**
 * {@inheritDoc}//  w  ww  . j a  v  a  2s  .  com
 */
@Override
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<Calendar> getAll() {
    return calendarService.getAll();
}

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

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

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

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

From source file:com.snv.bank.account.AccountController.java

/**
 * {@inheritDoc}//  w ww .ja  v  a  2  s . co m
 */
@RequestMapping(method = RequestMethod.GET, path = "/{accountId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Override
public Account get(@PathVariable(value = "accountId", required = true) final Long accountId) {
    return accountService.get(accountId);
}

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

@Test
public void get3() throws Exception {

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

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

/**
 * {@inheritDoc}//from w ww.j a v a  2  s .c  om
 */
@RequestMapping(method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Override
public Todo put(@Valid @RequestBody final Todo todo) {
    return todoService.put(todo);
}