Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
08931950
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
08931950
编写于
10月 21, 2016
作者:
A
Arjen Poutsma
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add byte[] encoder and decoder
This commit adds a ByteArrayDecoder and ByteArrayEncoder.
上级
3726c6f1
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
309 addition
and
4 deletion
+309
-4
spring-core/src/main/java/org/springframework/core/codec/ByteArrayDecoder.java
...java/org/springframework/core/codec/ByteArrayDecoder.java
+62
-0
spring-core/src/main/java/org/springframework/core/codec/ByteArrayEncoder.java
...java/org/springframework/core/codec/ByteArrayEncoder.java
+57
-0
spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferFactory.java
...org/springframework/core/io/buffer/DataBufferFactory.java
+7
-0
spring-core/src/main/java/org/springframework/core/io/buffer/DefaultDataBufferFactory.java
...ingframework/core/io/buffer/DefaultDataBufferFactory.java
+6
-0
spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBufferFactory.java
...pringframework/core/io/buffer/NettyDataBufferFactory.java
+6
-0
spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java
...org/springframework/core/codec/ByteArrayDecoderTests.java
+68
-0
spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java
...org/springframework/core/codec/ByteArrayEncoderTests.java
+82
-0
spring-web-reactive/src/main/java/org/springframework/web/reactive/config/WebReactiveConfigurationSupport.java
.../web/reactive/config/WebReactiveConfigurationSupport.java
+4
-0
spring-web-reactive/src/main/java/org/springframework/web/reactive/function/DefaultHandlerStrategiesBuilder.java
...eb/reactive/function/DefaultHandlerStrategiesBuilder.java
+4
-0
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java
...esult/method/annotation/RequestMappingHandlerAdapter.java
+2
-0
spring-web-reactive/src/test/java/org/springframework/web/reactive/config/DelegatingWebReactiveConfigurationTests.java
...ctive/config/DelegatingWebReactiveConfigurationTests.java
+1
-1
spring-web-reactive/src/test/java/org/springframework/web/reactive/config/WebReactiveConfigurationSupportTests.java
...reactive/config/WebReactiveConfigurationSupportTests.java
+6
-3
spring-web/src/main/java/org/springframework/web/client/reactive/DefaultWebClientStrategiesBuilder.java
...eb/client/reactive/DefaultWebClientStrategiesBuilder.java
+4
-0
未找到文件。
spring-core/src/main/java/org/springframework/core/codec/ByteArrayDecoder.java
0 → 100644
浏览文件 @
08931950
/*
* Copyright 2002-2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.core.codec
;
import
java.util.Map
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.core.io.buffer.DataBufferUtils
;
import
org.springframework.util.MimeType
;
import
org.springframework.util.MimeTypeUtils
;
/**
* Decoder for {@code byte} arrays.
*
* @author Arjen Poutsma
* @since 5.0
*/
public
class
ByteArrayDecoder
extends
AbstractDecoder
<
byte
[]>
{
public
ByteArrayDecoder
()
{
super
(
MimeTypeUtils
.
ALL
);
}
@Override
public
boolean
canDecode
(
ResolvableType
elementType
,
MimeType
mimeType
)
{
Class
<?>
clazz
=
elementType
.
getRawClass
();
return
(
super
.
canDecode
(
elementType
,
mimeType
)
&&
byte
[].
class
==
clazz
);
}
@Override
public
Flux
<
byte
[]>
decode
(
Publisher
<
DataBuffer
>
inputStream
,
ResolvableType
elementType
,
MimeType
mimeType
,
Map
<
String
,
Object
>
hints
)
{
return
Flux
.
from
(
inputStream
).
map
((
dataBuffer
)
->
{
byte
[]
result
=
new
byte
[
dataBuffer
.
readableByteCount
()];
dataBuffer
.
read
(
result
);
DataBufferUtils
.
release
(
dataBuffer
);
return
result
;
});
}
}
spring-core/src/main/java/org/springframework/core/codec/ByteArrayEncoder.java
0 → 100644
浏览文件 @
08931950
/*
* Copyright 2002-2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.core.codec
;
import
java.util.Map
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.core.io.buffer.DataBufferFactory
;
import
org.springframework.util.MimeType
;
import
org.springframework.util.MimeTypeUtils
;
/**
* Encoder for {@code byte} arrays.
*
* @author Arjen Poutsma
* @since 5.0
*/
public
class
ByteArrayEncoder
extends
AbstractEncoder
<
byte
[]>
{
public
ByteArrayEncoder
()
{
super
(
MimeTypeUtils
.
ALL
);
}
@Override
public
boolean
canEncode
(
ResolvableType
elementType
,
MimeType
mimeType
)
{
Class
<?>
clazz
=
elementType
.
getRawClass
();
return
(
super
.
canEncode
(
elementType
,
mimeType
)
&&
byte
[].
class
.
isAssignableFrom
(
clazz
));
}
@Override
public
Flux
<
DataBuffer
>
encode
(
Publisher
<?
extends
byte
[]>
inputStream
,
DataBufferFactory
bufferFactory
,
ResolvableType
elementType
,
MimeType
mimeType
,
Map
<
String
,
Object
>
hints
)
{
return
Flux
.
from
(
inputStream
).
map
(
bufferFactory:
:
wrap
);
}
}
spring-core/src/main/java/org/springframework/core/io/buffer/DataBufferFactory.java
浏览文件 @
08931950
...
...
@@ -52,4 +52,11 @@ public interface DataBufferFactory {
*/
DataBuffer
wrap
(
ByteBuffer
byteBuffer
);
/**
* Wrap the given {@code byte} array in a {@code DataBuffer}.
* @param bytes the byte array to wrap
* @return the wrapped buffer
*/
DataBuffer
wrap
(
byte
[]
bytes
);
}
spring-core/src/main/java/org/springframework/core/io/buffer/DefaultDataBufferFactory.java
浏览文件 @
08931950
...
...
@@ -94,6 +94,12 @@ public class DefaultDataBufferFactory implements DataBufferFactory {
return
new
DefaultDataBuffer
(
sliced
,
0
,
byteBuffer
.
remaining
(),
this
);
}
@Override
public
DataBuffer
wrap
(
byte
[]
bytes
)
{
ByteBuffer
wrapper
=
ByteBuffer
.
wrap
(
bytes
);
return
new
DefaultDataBuffer
(
wrapper
,
0
,
bytes
.
length
,
this
);
}
@Override
public
String
toString
()
{
return
"DefaultDataBufferFactory (preferDirect="
+
this
.
preferDirect
+
")"
;
...
...
spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBufferFactory.java
浏览文件 @
08931950
...
...
@@ -68,6 +68,12 @@ public class NettyDataBufferFactory implements DataBufferFactory {
return
new
NettyDataBuffer
(
byteBuf
,
this
);
}
@Override
public
DataBuffer
wrap
(
byte
[]
bytes
)
{
ByteBuf
byteBuf
=
Unpooled
.
wrappedBuffer
(
bytes
);
return
new
NettyDataBuffer
(
byteBuf
,
this
);
}
/**
* Wrap the given Netty {@link ByteBuf} in a {@code NettyDataBuffer}.
* @param byteBuf the Netty byte buffer to wrap
...
...
spring-core/src/test/java/org/springframework/core/codec/ByteArrayDecoderTests.java
0 → 100644
浏览文件 @
08931950
/*
* Copyright 2002-2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.core.codec
;
import
java.util.Collections
;
import
org.junit.Test
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.tests.TestSubscriber
;
import
org.springframework.util.MimeTypeUtils
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
* @author Arjen Poutsma
*/
public
class
ByteArrayDecoderTests
extends
AbstractDataBufferAllocatingTestCase
{
private
final
ByteArrayDecoder
decoder
=
new
ByteArrayDecoder
();
@Test
public
void
canDecode
()
{
assertTrue
(
this
.
decoder
.
canDecode
(
ResolvableType
.
forClass
(
byte
[].
class
),
MimeTypeUtils
.
TEXT_PLAIN
));
assertFalse
(
this
.
decoder
.
canDecode
(
ResolvableType
.
forClass
(
Integer
.
class
),
MimeTypeUtils
.
TEXT_PLAIN
));
assertTrue
(
this
.
decoder
.
canDecode
(
ResolvableType
.
forClass
(
byte
[].
class
),
MimeTypeUtils
.
APPLICATION_JSON
));
}
@Test
public
void
decode
()
{
DataBuffer
fooBuffer
=
stringBuffer
(
"foo"
);
DataBuffer
barBuffer
=
stringBuffer
(
"bar"
);
Flux
<
DataBuffer
>
source
=
Flux
.
just
(
fooBuffer
,
barBuffer
);
Flux
<
byte
[]>
output
=
this
.
decoder
.
decode
(
source
,
ResolvableType
.
forClassWithGenerics
(
Publisher
.
class
,
byte
[].
class
),
null
,
Collections
.
emptyMap
());
TestSubscriber
.
subscribe
(
output
)
.
assertNoError
()
.
assertComplete
()
.
assertValuesWith
(
bytes
->
assertArrayEquals
(
"foo"
.
getBytes
(),
bytes
),
bytes
->
assertArrayEquals
(
"bar"
.
getBytes
(),
bytes
));
}
}
\ No newline at end of file
spring-core/src/test/java/org/springframework/core/codec/ByteArrayEncoderTests.java
0 → 100644
浏览文件 @
08931950
/*
* Copyright 2002-2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.core.codec
;
import
java.nio.ByteBuffer
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Collections
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase
;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.tests.TestSubscriber
;
import
org.springframework.util.MimeTypeUtils
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
* @author Arjen Poutsma
*/
public
class
ByteArrayEncoderTests
extends
AbstractDataBufferAllocatingTestCase
{
private
ByteArrayEncoder
encoder
;
@Before
public
void
createEncoder
()
{
this
.
encoder
=
new
ByteArrayEncoder
();
}
@Test
public
void
canEncode
()
{
assertTrue
(
this
.
encoder
.
canEncode
(
ResolvableType
.
forClass
(
byte
[].
class
),
MimeTypeUtils
.
TEXT_PLAIN
));
assertFalse
(
this
.
encoder
.
canEncode
(
ResolvableType
.
forClass
(
Integer
.
class
),
MimeTypeUtils
.
TEXT_PLAIN
));
assertTrue
(
this
.
encoder
.
canEncode
(
ResolvableType
.
forClass
(
byte
[].
class
),
MimeTypeUtils
.
APPLICATION_JSON
));
}
@Test
public
void
encode
()
{
byte
[]
fooBytes
=
"foo"
.
getBytes
(
StandardCharsets
.
UTF_8
);
byte
[]
barBytes
=
"bar"
.
getBytes
(
StandardCharsets
.
UTF_8
);
Flux
<
byte
[]>
source
=
Flux
.
just
(
fooBytes
,
barBytes
);
Flux
<
DataBuffer
>
output
=
this
.
encoder
.
encode
(
source
,
this
.
bufferFactory
,
ResolvableType
.
forClassWithGenerics
(
Publisher
.
class
,
ByteBuffer
.
class
),
null
,
Collections
.
emptyMap
());
TestSubscriber
.
subscribe
(
output
)
.
assertValuesWith
(
b
->
{
byte
[]
buf
=
new
byte
[
3
];
b
.
read
(
buf
);
assertArrayEquals
(
fooBytes
,
buf
);
},
b
->
{
byte
[]
buf
=
new
byte
[
3
];
b
.
read
(
buf
);
assertArrayEquals
(
barBytes
,
buf
);
});
}
}
spring-web-reactive/src/main/java/org/springframework/web/reactive/config/WebReactiveConfigurationSupport.java
浏览文件 @
08931950
...
...
@@ -28,6 +28,8 @@ import org.springframework.beans.factory.BeanInitializationException;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.core.codec.ByteArrayDecoder
;
import
org.springframework.core.codec.ByteArrayEncoder
;
import
org.springframework.core.codec.ByteBufferDecoder
;
import
org.springframework.core.codec.ByteBufferEncoder
;
import
org.springframework.core.codec.CharSequenceEncoder
;
...
...
@@ -307,6 +309,7 @@ public class WebReactiveConfigurationSupport implements ApplicationContextAware
* {@link #configureMessageReaders(List)}.
*/
protected
final
void
addDefaultHttpMessageReaders
(
List
<
HttpMessageReader
<?>>
readers
)
{
readers
.
add
(
new
DecoderHttpMessageReader
<>(
new
ByteArrayDecoder
()));
readers
.
add
(
new
DecoderHttpMessageReader
<>(
new
ByteBufferDecoder
()));
readers
.
add
(
new
DecoderHttpMessageReader
<>(
new
StringDecoder
()));
readers
.
add
(
new
DecoderHttpMessageReader
<>(
new
ResourceDecoder
()));
...
...
@@ -444,6 +447,7 @@ public class WebReactiveConfigurationSupport implements ApplicationContextAware
*/
protected
final
void
addDefaultHttpMessageWriters
(
List
<
HttpMessageWriter
<?>>
writers
)
{
List
<
Encoder
<?>>
sseDataEncoders
=
new
ArrayList
<>();
writers
.
add
(
new
EncoderHttpMessageWriter
<>(
new
ByteArrayEncoder
()));
writers
.
add
(
new
EncoderHttpMessageWriter
<>(
new
ByteBufferEncoder
()));
writers
.
add
(
new
EncoderHttpMessageWriter
<>(
new
CharSequenceEncoder
()));
writers
.
add
(
new
ResourceHttpMessageWriter
());
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/function/DefaultHandlerStrategiesBuilder.java
浏览文件 @
08931950
...
...
@@ -23,6 +23,8 @@ import java.util.function.Supplier;
import
java.util.stream.Stream
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.core.codec.ByteArrayDecoder
;
import
org.springframework.core.codec.ByteArrayEncoder
;
import
org.springframework.core.codec.ByteBufferDecoder
;
import
org.springframework.core.codec.ByteBufferEncoder
;
import
org.springframework.core.codec.CharSequenceEncoder
;
...
...
@@ -65,8 +67,10 @@ class DefaultHandlerStrategiesBuilder implements HandlerStrategies.Builder {
private
final
List
<
ViewResolver
>
viewResolvers
=
new
ArrayList
<>();
public
void
defaultConfiguration
()
{
messageReader
(
new
DecoderHttpMessageReader
<>(
new
ByteArrayDecoder
()));
messageReader
(
new
DecoderHttpMessageReader
<>(
new
ByteBufferDecoder
()));
messageReader
(
new
DecoderHttpMessageReader
<>(
new
StringDecoder
()));
messageWriter
(
new
EncoderHttpMessageWriter
<>(
new
ByteArrayEncoder
()));
messageWriter
(
new
EncoderHttpMessageWriter
<>(
new
ByteBufferEncoder
()));
messageWriter
(
new
EncoderHttpMessageWriter
<>(
new
CharSequenceEncoder
()));
if
(
jaxb2Present
)
{
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java
浏览文件 @
08931950
...
...
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.BeanFactoryAware;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.config.ConfigurableBeanFactory
;
import
org.springframework.core.ReactiveAdapterRegistry
;
import
org.springframework.core.codec.ByteArrayDecoder
;
import
org.springframework.core.codec.ByteBufferDecoder
;
import
org.springframework.core.codec.StringDecoder
;
import
org.springframework.http.codec.DecoderHttpMessageReader
;
...
...
@@ -75,6 +76,7 @@ public class RequestMappingHandlerAdapter implements HandlerAdapter, BeanFactory
public
RequestMappingHandlerAdapter
()
{
this
.
messageReaders
.
add
(
new
DecoderHttpMessageReader
<>(
new
ByteArrayDecoder
()));
this
.
messageReaders
.
add
(
new
DecoderHttpMessageReader
<>(
new
ByteBufferDecoder
()));
this
.
messageReaders
.
add
(
new
DecoderHttpMessageReader
<>(
new
StringDecoder
()));
}
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/config/DelegatingWebReactiveConfigurationTests.java
浏览文件 @
08931950
...
...
@@ -151,7 +151,7 @@ public class DelegatingWebReactiveConfigurationTests {
verify
(
webReactiveConfigurer
).
addArgumentResolvers
(
any
());
assertSame
(
formatterRegistry
.
getValue
(),
initializerConversionService
);
assertEquals
(
5
,
readers
.
getValue
().
size
());
assertEquals
(
6
,
readers
.
getValue
().
size
());
}
@Test
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/config/WebReactiveConfigurationSupportTests.java
浏览文件 @
08931950
...
...
@@ -145,8 +145,9 @@ public class WebReactiveConfigurationSupportTests {
assertNotNull
(
adapter
);
List
<
HttpMessageReader
<?>>
readers
=
adapter
.
getMessageReaders
();
assertEquals
(
5
,
readers
.
size
());
assertEquals
(
6
,
readers
.
size
());
assertHasMessageReader
(
readers
,
byte
[].
class
,
APPLICATION_OCTET_STREAM
);
assertHasMessageReader
(
readers
,
ByteBuffer
.
class
,
APPLICATION_OCTET_STREAM
);
assertHasMessageReader
(
readers
,
String
.
class
,
TEXT_PLAIN
);
assertHasMessageReader
(
readers
,
Resource
.
class
,
IMAGE_PNG
);
...
...
@@ -194,8 +195,9 @@ public class WebReactiveConfigurationSupportTests {
assertEquals
(
0
,
handler
.
getOrder
());
List
<
HttpMessageWriter
<?>>
writers
=
handler
.
getMessageWriters
();
assertEquals
(
6
,
writers
.
size
());
assertEquals
(
7
,
writers
.
size
());
assertHasMessageWriter
(
writers
,
byte
[].
class
,
APPLICATION_OCTET_STREAM
);
assertHasMessageWriter
(
writers
,
ByteBuffer
.
class
,
APPLICATION_OCTET_STREAM
);
assertHasMessageWriter
(
writers
,
String
.
class
,
TEXT_PLAIN
);
assertHasMessageWriter
(
writers
,
Resource
.
class
,
IMAGE_PNG
);
...
...
@@ -219,8 +221,9 @@ public class WebReactiveConfigurationSupportTests {
assertEquals
(
100
,
handler
.
getOrder
());
List
<
HttpMessageWriter
<?>>
writers
=
handler
.
getMessageWriters
();
assertEquals
(
6
,
writers
.
size
());
assertEquals
(
7
,
writers
.
size
());
assertHasMessageWriter
(
writers
,
byte
[].
class
,
APPLICATION_OCTET_STREAM
);
assertHasMessageWriter
(
writers
,
ByteBuffer
.
class
,
APPLICATION_OCTET_STREAM
);
assertHasMessageWriter
(
writers
,
String
.
class
,
TEXT_PLAIN
);
assertHasMessageWriter
(
writers
,
Resource
.
class
,
IMAGE_PNG
);
...
...
spring-web/src/main/java/org/springframework/web/client/reactive/DefaultWebClientStrategiesBuilder.java
浏览文件 @
08931950
...
...
@@ -23,6 +23,8 @@ import java.util.function.Supplier;
import
java.util.stream.Stream
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.core.codec.ByteArrayDecoder
;
import
org.springframework.core.codec.ByteArrayEncoder
;
import
org.springframework.core.codec.ByteBufferDecoder
;
import
org.springframework.core.codec.ByteBufferEncoder
;
import
org.springframework.core.codec.CharSequenceEncoder
;
...
...
@@ -65,8 +67,10 @@ class DefaultWebClientStrategiesBuilder implements WebClientStrategies.Builder {
public
void
defaultConfiguration
()
{
messageReader
(
new
DecoderHttpMessageReader
<>(
new
ByteArrayDecoder
()));
messageReader
(
new
DecoderHttpMessageReader
<>(
new
ByteBufferDecoder
()));
messageReader
(
new
DecoderHttpMessageReader
<>(
new
StringDecoder
(
false
)));
messageWriter
(
new
EncoderHttpMessageWriter
<>(
new
ByteArrayEncoder
()));
messageWriter
(
new
EncoderHttpMessageWriter
<>(
new
ByteBufferEncoder
()));
messageWriter
(
new
EncoderHttpMessageWriter
<>(
new
CharSequenceEncoder
()));
if
(
jaxb2Present
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录