Java Code Examples for org.springframework.http.HttpHeaders#CONTENT_TYPE
The following examples show how to use
org.springframework.http.HttpHeaders#CONTENT_TYPE .
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: XssHttpServletRequestWrapper.java From RuoYi-Vue with MIT License | 5 votes |
/** * 是否是Json请求 * * @param request */ public boolean isJsonRequest() { String header = super.getHeader(HttpHeaders.CONTENT_TYPE); return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header) || MediaType.APPLICATION_JSON_UTF8_VALUE.equalsIgnoreCase(header); }
Example 2
Source File: XssHttpServletRequestWrapper.java From blade-tool with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ServletInputStream getInputStream() throws IOException { if (null == super.getHeader(HttpHeaders.CONTENT_TYPE)) { return super.getInputStream(); } if (super.getHeader(HttpHeaders.CONTENT_TYPE).startsWith(MediaType.MULTIPART_FORM_DATA_VALUE)) { return super.getInputStream(); } final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(inputHandlers(super.getInputStream()).getBytes()); return new ServletInputStream() { @Override public int read() { return byteArrayInputStream.read(); } @Override public boolean isFinished() { return false; } @Override public boolean isReady() { return false; } @Override public void setReadListener(ReadListener readListener) { } }; }
Example 3
Source File: DynamicDestinationSourceApplication.java From spring-cloud-stream-samples with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @RequestMapping(path = "/", method = POST, consumes = "*/*") @ResponseStatus(HttpStatus.ACCEPTED) public void handleRequest(@RequestBody String body, @RequestHeader(HttpHeaders.CONTENT_TYPE) Object contentType) throws Exception { Map<String, String> payload = jsonMapper.readValue(body, Map.class); String destinationName = payload.get("id"); Message<?> message = MessageBuilder.withPayload(payload) .setHeader("spring.cloud.stream.sendto.destination", destinationName).build(); processor.onNext(message); }
Example 4
Source File: DynamicDestinationSourceApplication.java From spring-cloud-stream-samples with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @RequestMapping(path = "/", method = POST, consumes = "*/*") @ResponseStatus(HttpStatus.ACCEPTED) public void handleRequest(@RequestBody String body, @RequestHeader(HttpHeaders.CONTENT_TYPE) Object contentType) throws Exception { Map<String, String> payload = jsonMapper.readValue(body, Map.class); String destinationName = payload.get("id"); Message<?> message = MessageBuilder.withPayload(payload) .setHeader("spring.cloud.stream.sendto.destination", destinationName).build(); processor.onNext(message); }
Example 5
Source File: XssHttpServletRequestWrapper.java From DimpleBlog with Apache License 2.0 | 4 votes |
/** * 是否是Json请求 * * @param request */ public boolean isJsonRequest() { String header = super.getHeader(HttpHeaders.CONTENT_TYPE); return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header) || MediaType.APPLICATION_JSON_UTF8_VALUE.equalsIgnoreCase(header); }
Example 6
Source File: HttpSourceConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 4 votes |
@RequestMapping(path = "${http.pathPattern:/}", method = POST, consumes = {"text/*", "application/json"}) @ResponseStatus(HttpStatus.ACCEPTED) public void handleRequest(@RequestBody String body, @RequestHeader(HttpHeaders.CONTENT_TYPE) Object contentType) { sendMessage(body, contentType); }
Example 7
Source File: HttpSourceConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 4 votes |
@RequestMapping(path = "${http.pathPattern:/}", method = POST, consumes = "*/*") @ResponseStatus(HttpStatus.ACCEPTED) public void handleRequest(@RequestBody byte[] body, @RequestHeader(HttpHeaders.CONTENT_TYPE) Object contentType) { sendMessage(body, contentType); }