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

The following examples show how to use org.springframework.util.MimeTypeUtils#TEXT_PLAIN_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: MetricsScrapeController.java    From alibaba-rsocket-broker with Apache License 2.0 5 votes vote down vote up
@GetMapping(value = "/{uuid}", produces = MimeTypeUtils.TEXT_PLAIN_VALUE)
public Mono<String> scrape(@PathVariable(name = "uuid") String uuid) {
    RSocketBrokerResponderHandler rsocket = handlerRegistry.findByUUID(uuid);
    if (rsocket == null) {
        return Mono.error(new Exception(RsocketErrorCode.message("RST-300205", uuid)));
    }
    return rsocket.getPeerRsocket().requestResponse(ByteBufPayload.create(Unpooled.EMPTY_BUFFER, metricsScrapeCompositeByteBuf.retainedDuplicate()))
            .map(Payload::getDataUtf8);
}
 
Example 4
Source File: CustomErrorController.java    From spring-mvc-error-handling-example with Apache License 2.0 5 votes vote down vote up
@RequestMapping(produces = MimeTypeUtils.TEXT_PLAIN_VALUE)
@ResponseBody
public String errorTextPlan(HttpServletRequest request) {

  Map<String, Object> body = getErrorAttributes(request,
      isIncludeStackTrace(request, MediaType.ALL));
  body.put("status", getStatus(request));
  return body.toString();

}
 
Example 5
Source File: FooController.java    From spring-mvc-error-handling-example with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/return-text-plain", produces = MimeTypeUtils.TEXT_PLAIN_VALUE)
@ResponseBody
public String returnPlainText() throws SomeException {
  throw new SomeException();
}
 
Example 6
Source File: BarController.java    From spring-mvc-error-handling-example with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/text-plain-a", produces = MimeTypeUtils.TEXT_PLAIN_VALUE)
@ResponseBody
public String getTextPlainA() throws SomeException {
  throw new SomeException();
}
 
Example 7
Source File: BarController.java    From spring-mvc-error-handling-example with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/text-plain-b", produces = MimeTypeUtils.TEXT_PLAIN_VALUE)
@ResponseBody
public String getTextPlainB() throws AnotherException {
  throw new AnotherException();
}
 
Example 8
Source File: BridgeMessageTextContent.java    From matrix-appservice-email with GNU Affero General Public License v3.0 4 votes vote down vote up
public BridgeMessageTextContent(String content) {
    super(MimeTypeUtils.TEXT_PLAIN_VALUE, content.getBytes());
}
 
Example 9
Source File: BridgeMessageTextContent.java    From matrix-appservice-email with GNU Affero General Public License v3.0 4 votes vote down vote up
public BridgeMessageTextContent(String content, String encoding) {
    super(MimeTypeUtils.TEXT_PLAIN_VALUE, encoding, content.getBytes());
}