Example usage for org.springframework.http MediaType APPLICATION_JSON_VALUE

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

Introduction

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

Prototype

String APPLICATION_JSON_VALUE

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

Click Source Link

Document

A String equivalent of MediaType#APPLICATION_JSON .

Usage

From source file:com.jci.po.apis.FlatFileClient.java

/**
 * Process error supp flat files./*from w w  w. java2 s . com*/
 *
 * @param req the req
 * @return the response entity
 */
@RequestMapping(value = "/processErrorSuppFlatFiles", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = {
        MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<ProcessErrorRes> processErrorSuppFlatFiles(@RequestBody ProcessErrorReq req);

From source file:com.ar.dev.tierra.api.controller.MarcasController.java

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Marcas> marcas = facadeService.getMarcasDAO().getAll();
    if (!marcas.isEmpty()) {
        return new ResponseEntity<>(marcas, HttpStatus.OK);
    } else {//from   w ww.  j a v a2 s.c o  m
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:monkeys.web.BananasController.java

@RequestMapping(method = RequestMethod.GET, value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Banana> getBanana(@PathVariable Long id) {
    Banana banana = bananaRepository.findOne(id);
    HttpHeaders headers = new HttpHeaders();
    return new ResponseEntity<>(banana, headers, HttpStatus.OK);
}

From source file:com.ar.dev.tierra.api.controller.PlanPagoController.java

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<PlanPago> list = facadeService.getPlanPagoDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {/*from w w  w.j a v  a2  s  . c  o m*/
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:com.ar.dev.tierra.api.controller.TarjetaController.java

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Tarjeta> categorias = facadeService.getTarjetaDAO().getAll();
    if (!categorias.isEmpty()) {
        return new ResponseEntity<>(categorias, HttpStatus.OK);
    } else {//from   w  w w  . j a v  a  2 s  . co m
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}

From source file:com.sastix.cms.common.services.web.ApiVersionController.java

@RequestMapping(value = Constants.GET_API_VERSION, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public VersionDTO getApiVersion() {
    VersionDTO versionDTO = apiVersionService.getApiVersion();
    LOG.trace("REST: Called {}, will return {}", Constants.GET_API_VERSION, versionDTO);
    return versionDTO;
}

From source file:com.jci.job.apis.ApiClient.java

/**
 * Gets the po details.//  w  w w. j  a  v  a  2 s .c o m
 *
 * @param apikey the apikey
 * @param plant the plant
 * @param erp the erp
 * @param region the region
 * @return the po details
 */
@RequestMapping(value = "/purchaseorders", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE, produces = {
        MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<PoDetailsRes> getPoDetails(@RequestParam("apikey") String apikey,
        @RequestParam("plant") String plant, @RequestParam("erp") String erp,
        @RequestParam("region") String region);

From source file:com.orange.cepheus.mockorion.AdminController.java

@RequestMapping(value = "/query", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity query(@Valid @RequestBody final Query query)
        throws ExecutionException, InterruptedException {

    QueryContext queryContext = new QueryContext(
            Collections.singletonList(new EntityId(query.getName(), query.getType(), query.getIsPattern())));
    QueryContextResponse queryContextResponse = ngsiClient.queryContext(cepheusBroker, null, queryContext)
            .get();/*from   www  .ja  v  a 2  s .  c  om*/
    logger.info("=> QueryContextResponse received from {}: {}", cepheusBroker, queryContextResponse.toString());
    if (queryContextResponse.getErrorCode() == null) {
        queryContextResponse.getContextElementResponses().forEach(contextElementResponse -> {
            logger.info("EntityId : {}", contextElementResponse.getContextElement().getEntityId().toString());
            contextElementResponse.getContextElement().getContextAttributeList().forEach(contextAttribute -> {
                logger.info("Attribute : {}", contextAttribute.toString());
            });
        });
    }

    return new ResponseEntity<>(HttpStatus.OK);
}

From source file:com.springboot.demo.web.rest.CityController.java

@RequestMapping(value = "/search/{keyword}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody// w w  w .  j  av a  2 s  .c  om
@Transactional(readOnly = true)
public Page<City> search(@PathVariable("keyword") String keyword) {
    CitySearchCriteria criteria = new CitySearchCriteria(keyword);
    PageRequest pageRequest = new PageRequest(0, 4);
    Page<City> result = this.cityService.findCities(criteria, pageRequest);
    if (result == null || result.getTotalElements() == 0) {
        throw new CityNotFoundException();
    }
    return result;
}

From source file:com.ar.dev.tierra.api.controller.ClienteController.java

@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<Cliente> list = facadeService.getClienteDAO().getAll();
    if (!list.isEmpty()) {
        return new ResponseEntity<>(list, HttpStatus.OK);
    } else {//  www. j ava  2  s  .  com
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}