Shared static instance of DefaultDataBufferFactory
This commit is contained in:
@@ -121,7 +121,7 @@ public class HttpHandlerConnectorTests {
|
||||
}
|
||||
|
||||
private DataBuffer toDataBuffer(String body) {
|
||||
return new DefaultDataBufferFactory().wrap(body.getBytes(UTF_8));
|
||||
return DefaultDataBufferFactory.sharedInstance.wrap(body.getBytes(UTF_8));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -88,7 +88,7 @@ public class MockServerSpecTests {
|
||||
@Override
|
||||
protected WebHttpHandlerBuilder initHttpHandlerBuilder() {
|
||||
return WebHttpHandlerBuilder.webHandler(exchange -> {
|
||||
DefaultDataBufferFactory factory = new DefaultDataBufferFactory();
|
||||
DefaultDataBufferFactory factory = DefaultDataBufferFactory.sharedInstance;
|
||||
String text = exchange.getAttributes().toString();
|
||||
DataBuffer buffer = factory.wrap(text.getBytes(StandardCharsets.UTF_8));
|
||||
return exchange.getResponse().writeWith(Mono.just(buffer));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -161,7 +161,7 @@ public class MockServerTests {
|
||||
|
||||
private DataBuffer toDataBuffer(String value) {
|
||||
byte[] bytes = value.getBytes(UTF_8);
|
||||
return new DefaultDataBufferFactory().wrap(bytes);
|
||||
return DefaultDataBufferFactory.sharedInstance.wrap(bytes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,7 +36,7 @@ public class WebFilterTests {
|
||||
public void testWebFilter() throws Exception {
|
||||
|
||||
WebFilter filter = (exchange, chain) -> {
|
||||
DataBuffer buffer = new DefaultDataBufferFactory().allocateBuffer();
|
||||
DataBuffer buffer = DefaultDataBufferFactory.sharedInstance.allocateBuffer();
|
||||
buffer.write("It works!".getBytes(StandardCharsets.UTF_8));
|
||||
return exchange.getResponse().writeWith(Mono.just(buffer));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user