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.RestVNFFG.java

/**
 * Adds a new VNF software VNFFG to the vnfForwardingGraphDescriptor repository
 *
 * @param vnfForwardingGraphDescriptor : VNFFG to add
 * @return vnfForwardingGraphDescriptor: The vnfForwardingGraphDescriptor filled with values from
 * the core/*from w  ww .jav a  2  s . c o  m*/
 */
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public VNFForwardingGraphDescriptor create(
        @RequestBody @Valid VNFForwardingGraphDescriptor vnfForwardingGraphDescriptor) {
    return vnffgManagement.add(vnfForwardingGraphDescriptor);
}

From source file:bg.vitkinov.edu.services.ImageService.java

@RequestMapping(method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE })
public Service getClichedMessage() {
    return new Service(this.getClass().getSimpleName(), "ready");
}

From source file:com.seb.aws.demo.tomcat.web.SampleController.java

@RequestMapping(value = "/flood/{flood}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody//  www . ja v a 2s.co m
public ResponseEntity<String> flood(@PathVariable(value = "flood") int flood) {
    LOG.info("Flood {}", flood);
    Map<Integer, Integer[]> squares = new HashMap<Integer, Integer[]>();
    for (int i = 0; i < flood; ++i) {
        squares.put(i, new Integer[] { i ^ 2, i ^ 3 });
    }
    return new ResponseEntity<String>("Ca Flood x2/x3..." + squares.size(), HttpStatus.OK);
}

From source file:com.boxedfolder.carrot.web.client.CrudResource.java

@JsonView(View.Client.class)
@ResponseStatus(HttpStatus.CREATED)//from   w w  w.j  av a2s .  c o m
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public S create(@RequestBody @Valid S object) {
    return service.save(object);
}

From source file:demo.web.UserVehicleController.java

@GetMapping(path = "/{username}/vehicle", produces = MediaType.APPLICATION_JSON_VALUE)
public VehicleDetails VehicleDetailsJson(@PathVariable String username) {
    return this.userVehicleService.getVehicleDetails(username);
}

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

@GetMapping(value = "/segment-items/{key}", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody/*from  w  w  w  .j av a2 s.  c o m*/
public ResponseEntity<SegmentItemInformation> getSegmentInformation(@PathVariable String key) {
    SegmentItemInformation segmentItemInformation = segmentService.findSegmentItemInformation(key)
            .orElseThrow(() -> new NotFoundException("Failed to find segment for %s", key));

    return ResponseEntity.ok(segmentItemInformation);
}

From source file:de.dominikschadow.configclient.secret.SecretController.java

/**
 * Write the given secret into vault using the base bath and the user id as path.
 *
 * @param secret The secret to store// w w  w  .j  a va2 s  . com
 * @return The stored secret
 */
@PostMapping(value = "/secrets", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Writes the given secret into the vault", notes = "Writes the given secret content into the vault using the given user id as path.", response = VaultResponse.class)
public ResponseEntity<VaultResponse> writeSecret(@RequestBody Secret secret) {
    Map<String, String> data = new HashMap<>();
    data.put("secret", secret.getData());

    VaultResponse vaultResponse = vaultTemplate.write(SECRET_BASE_PATH + secret.getUserId(), data);

    return ResponseEntity.ok(vaultResponse);
}

From source file:org.openbaton.nfvo.api.RestVirtualNetworkFunctionDescriptor.java

/**
 * Adds a new VNF software Image to the image repository
 *
 * @param virtualNetworkFunctionDescriptor : VirtualNetworkFunctionDescriptor to add
 * @return VirtualNetworkFunctionDescriptor: The VirtualNetworkFunctionDescriptor filled with
 * values from the core//from   w  w w  .  ja  v a 2 s. c om
 */
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public VirtualNetworkFunctionDescriptor create(
        @RequestBody @Valid VirtualNetworkFunctionDescriptor virtualNetworkFunctionDescriptor,
        @RequestHeader(value = "project-id") String projectId) {
    return vnfdManagement.add(virtualNetworkFunctionDescriptor, projectId);
}

From source file:software.uncharted.rest.ClusterResource.java

@RequestMapping(value = "/cluster/{cluster}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ClusterResponse getCluster(@PathVariable("cluster") final String lshCluster) {
    Cluster cluster = clusterService.getCluster(lshCluster);
    return new ClusterResponse().setHasMore(false).setClusters(Sets.newHashSet(cluster));
}

From source file:com.github.lynxdb.server.api.http.handlers.EpConfig.java

@RequestMapping(path = "/", method = { RequestMethod.GET,
        RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity root() {
    return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
}