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:org.openbaton.nfvo.api.RestProject.java

/**
 * Adds a new Project to the Projects repository
 *
 * @param project// w ww. j av  a2s  .  c  om
 * @return project
 */
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public Project create(@RequestBody @Valid Project project) {
    log.info("Adding Project: " + project.getName());
    return projectManagement.add(project);
}

From source file:com.orange.cloud.servicebroker.filter.core.service.ServiceInstanceBindingServiceClient.java

@RequestMapping(value = "/v2/service_instances/{instanceId}/service_bindings/{bindingId}", method = RequestMethod.PUT, produces = {
        MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<CreateServiceInstanceAppBindingResponse> createServiceInstanceBinding(
        @PathVariable("instanceId") String serviceInstanceId, @PathVariable("bindingId") String bindingId,
        @Valid @RequestBody CreateServiceInstanceBindingRequest request);

From source file:tds.assessment.web.endpoints.ItemController.java

@GetMapping(value = "assessments/item/metadata", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody/*from  www.  j a  va  2s.  c om*/
ResponseEntity<ItemFileMetadata> findItemFileMetadata(@RequestParam final String clientName,
        @RequestParam final long bankKey, @RequestParam(required = false) final Long stimulusKey,
        @RequestParam(required = false) final Long itemKey) {
    if (stimulusKey == null && itemKey == null) {
        throw new IllegalArgumentException("Item lookup requires stimulus key or item key");
    }

    Optional<ItemFileMetadata> maybeItemFile;

    if (stimulusKey != null) {
        maybeItemFile = itemService.findItemFileMetadataByStimulusKey(clientName, bankKey, stimulusKey);
    } else {
        maybeItemFile = itemService.findItemFileMetadataByItemKey(clientName, bankKey, itemKey);
    }

    if (!maybeItemFile.isPresent()) {
        throw new NotFoundException("Could not find item file metadata");
    }

    return ResponseEntity.ok(maybeItemFile.get());
}

From source file:io.fourfinanceit.homework.controller.ClientController.java

@RequestMapping(value = "/client/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Client> getClient(@PathVariable("id") Long id) {

    Client client = clientRepository.findOne(id);

    if (client == null) {
        return new ResponseEntity<Client>(HttpStatus.NOT_FOUND);
    }//from  ww  w.  ja v  a2 s  . c o m

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

From source file:com.billkoch.examples.people.controllers.PeopleController.java

@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<Person> getAll() {
    return Sets.newHashSet(peopleRepository.findAll());
}

From source file:com.esri.geoportal.harvester.rest.ProcessorController.java

/**
 * Lists all processors.//from  ww w .ja  va2 s .c om
 * @return array of processors templates
 */
@RequestMapping(value = "/rest/harvester/processors/types", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public UITemplate[] listProcessorTypes() {
    LOG.debug(String.format("GET /rest/harvester/processors/types"));
    return engine.getTemplatesService().getProcessorsTemplates(LocaleContextHolder.getLocale())
            .toArray(new UITemplate[0]);
}

From source file:com.esri.geoportal.harvester.rest.TransformerController.java

/**
 * Lists all transformers./*from   ww w  . ja va2 s . c  o  m*/
 * @return array of transformer templates
 */
@RequestMapping(value = "/rest/harvester/transformers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public UITemplate[] list() {
    LOG.debug(String.format("GET /rest/harvester/transformers"));
    return engine.getTemplatesService().getTransformerTemplates(LocaleContextHolder.getLocale())
            .toArray(new UITemplate[0]);
}

From source file:cz.muni.fi.pa165.rest.controllers.RoomController.java

/**
 *
 * Get Product by identifier id curl -i -X GET
 * http://localhost:8080/pa165/rest/room/{id}
 *
 * @param id identifier for a product/*from  w  w  w  .  j  ava  2  s.  co m*/
 * @return RoomtDTO
 * @throws ResourceNotFoundException
 */
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public final RoomDto getRoom(@PathVariable("id") long id) throws Exception {
    RoomDto roomDto;
    try {
        roomDto = roomFacade.getRoomById(id);
    } catch (Exception ex) {
        throw new ResourceNotFoundException();
    }
    if (roomDto != null) {
        return roomDto;
    } else {
        throw new ResourceNotFoundException();
    }
}

From source file:br.upe.community.ui.ControllerCategoria.java

@RequestMapping(value = "/cadastrar", headers = "Accept=*/*", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseEntity<?> adicionarCategoria(Categoria categoria) {
    try {/*from   w  w w .  j  a  va2  s  . c o  m*/
        fachada.cadastrar(categoria);
        return new ResponseEntity<String>(HttpStatus.OK);
    } catch (CategoriaExistenteException e) {
        return new ResponseEntity<CategoriaExistenteException>(e, HttpStatus.BAD_REQUEST);
    }
}

From source file:com.objectpartners.plummer.graylog.config.SwaggerConfiguration.java

private Set<String> apiContentTypes() {
    return Sets.newHashSet(MediaType.APPLICATION_JSON_VALUE);
}