Java Code Examples for org.springframework.core.io.buffer.DataBufferUtils#readInputStream()
The following examples show how to use
org.springframework.core.io.buffer.DataBufferUtils#readInputStream() .
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: InstancesProxyController.java From spring-boot-admin with Apache License 2.0 | 5 votes |
@ResponseBody @RequestMapping(path = INSTANCE_MAPPED_PATH, method = { RequestMethod.GET, RequestMethod.HEAD, RequestMethod.POST, RequestMethod.PUT, RequestMethod.PATCH, RequestMethod.DELETE, RequestMethod.OPTIONS }) public Mono<Void> endpointProxy(@PathVariable("instanceId") String instanceId, HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws IOException { ServerHttpRequest request = new ServletServerHttpRequest(servletRequest); String endpointLocalPath = this.getEndpointLocalPath(this.adminContextPath + INSTANCE_MAPPED_PATH, servletRequest); URI uri = UriComponentsBuilder.fromPath(endpointLocalPath).query(request.getURI().getRawQuery()).build(true) .toUri(); // We need to explicitly block until the headers are recieved and write them // before the async dispatch. // otherwise the FrameworkServlet will add wrong Allow header for OPTIONS request Flux<DataBuffer> requestBody = DataBufferUtils.readInputStream(request::getBody, this.bufferFactory, 4096); ClientResponse clientResponse = this.instanceWebProxy .forward(this.registry.getInstance(InstanceId.of(instanceId)), uri, request.getMethod(), this.httpHeadersFilter.filterHeaders(request.getHeaders()), BodyInserters.fromDataBuffers(requestBody)) .block(); ServerHttpResponse response = new ServletServerHttpResponse(servletResponse); response.setStatusCode(clientResponse.statusCode()); response.getHeaders().addAll(this.httpHeadersFilter.filterHeaders(clientResponse.headers().asHttpHeaders())); OutputStream responseBody = response.getBody(); response.flush(); return clientResponse.body(BodyExtractors.toDataBuffers()).window(1) .concatMap((body) -> writeAndFlush(body, responseBody)).then(); }
Example 2
Source File: SynchronossPartHttpMessageReader.java From spring-analysis-note with MIT License | 4 votes |
@Override public Flux<DataBuffer> content() { return DataBufferUtils.readInputStream(getStorage()::getInputStream, getBufferFactory(), 4096); }
Example 3
Source File: LegacyEndpointConvertersTest.java From Moss with Apache License 2.0 | 4 votes |
private Flux<DataBuffer> read(String resourceName) { return DataBufferUtils.readInputStream( () -> LegacyEndpointConvertersTest.class.getResourceAsStream(resourceName), bufferFactory, 10); }
Example 4
Source File: SynchronossPartHttpMessageReader.java From java-technology-stack with MIT License | 4 votes |
@Override public Flux<DataBuffer> content() { return DataBufferUtils.readInputStream(getStorage()::getInputStream, getBufferFactory(), 4096); }
Example 5
Source File: LegacyEndpointConvertersTest.java From spring-boot-admin with Apache License 2.0 | 4 votes |
private Flux<DataBuffer> read(String resourceName) { return DataBufferUtils.readInputStream( () -> LegacyEndpointConvertersTest.class.getResourceAsStream(resourceName), bufferFactory, 10); }