Java Code Examples for org.springframework.util.MimeTypeUtils#APPLICATION_JSON_VALUE

The following examples show how to use org.springframework.util.MimeTypeUtils#APPLICATION_JSON_VALUE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompatibilityController.java    From servicecomb-toolkit with Apache License 2.0 5 votes vote down vote up
@PostMapping(consumes = MimeTypeUtils.TEXT_PLAIN_VALUE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@ResponseStatus(value = HttpStatus.OK)
public Map<String, Object> validateOpenAPI(@RequestBody String yaml) {
  
  Map<String, Object> json = new HashMap<>();
  
  json.put("acknowleged", true);
  json.put("data", doValidate(yaml));
  
  return json;
}
 
Example 2
Source File: StyleController.java    From servicecomb-toolkit with Apache License 2.0 5 votes vote down vote up
@PostMapping(consumes = MimeTypeUtils.TEXT_PLAIN_VALUE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@ResponseStatus(value = HttpStatus.OK)
public Map<String, Object> validateOpenAPI(@RequestBody String yaml) {

  ImportError importError = doValidate(yaml);
  Map<String, Object> json = new HashMap<>();
  
  json.put("acknowleged", true);
  json.put("data", importError);
  
  return json;
}
 
Example 3
Source File: RootController.java    From data-highway with Apache License 2.0 4 votes vote down vote up
@GetMapping(path = "/", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public Map<String, KafkaRoad> get() throws JsonProcessingException {
  return store;
}
 
Example 4
Source File: RootController.java    From data-highway with Apache License 2.0 4 votes vote down vote up
@GetMapping(path = "/", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public String get() throws JsonProcessingException {
  return "{}";
}
 
Example 5
Source File: NotificationFilterController.java    From Moss with Apache License 2.0 4 votes vote down vote up
@GetMapping(path = "/notifications/filters", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public Collection<NotificationFilter> getFilters() {
    return filteringNotifier.getNotificationFilters().values();
}
 
Example 6
Source File: UserExtraController.java    From alibaba-rsocket-broker with Apache License 2.0 4 votes vote down vote up
@GetMapping(value = "/{id}", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public Mono<ByteBuffer> user(@PathVariable Integer id) {
    return userServiceExtra.findById(id);
}
 
Example 7
Source File: FooController.java    From spring-mvc-error-handling-example with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/return-json-1", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@ResponseBody
public String returnJson1() throws SomeException {
  throw new SomeException();
}
 
Example 8
Source File: FooRestController.java    From spring-mvc-error-handling-example with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/return-json-2", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@ResponseBody
public FooRestController returnJson2() throws SomeException {
  throw new SomeException();
}
 
Example 9
Source File: BarController.java    From spring-mvc-error-handling-example with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/json-a", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@ResponseBody
public String getJsonA() throws SomeException {
  throw new SomeException();
}
 
Example 10
Source File: BarController.java    From spring-mvc-error-handling-example with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/json-b", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@ResponseBody
public String getJsonB() throws AnotherException {
  throw new AnotherException();
}
 
Example 11
Source File: ConfigurationApi.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Secured(Authorities.ADMIN_ROLE)
@RequestMapping(path = "config", method = RequestMethod.POST, consumes = MimeTypeUtils.APPLICATION_JSON_VALUE)
public void setConfig(InputStream is) throws IOException {
    appConfigService.read(MimeTypeUtils.APPLICATION_JSON_VALUE, is);
}
 
Example 12
Source File: NotificationFilterController.java    From spring-boot-admin with Apache License 2.0 4 votes vote down vote up
@GetMapping(path = "/notifications/filters", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public Collection<NotificationFilter> getFilters() {
	return filteringNotifier.getNotificationFilters().values();
}