|
|
|
@ -25,8 +25,6 @@ import java.util.regex.Pattern;
@@ -25,8 +25,6 @@ import java.util.regex.Pattern;
|
|
|
|
|
import io.netty.buffer.ByteBuf; |
|
|
|
|
import io.netty.buffer.ByteBufAllocator; |
|
|
|
|
import io.netty.buffer.CompositeByteBuf; |
|
|
|
|
import io.rsocket.metadata.CompositeMetadataFlyweight; |
|
|
|
|
import io.rsocket.metadata.TaggingMetadataFlyweight; |
|
|
|
|
import io.rsocket.metadata.WellKnownMimeType; |
|
|
|
|
import reactor.core.publisher.Mono; |
|
|
|
|
|
|
|
|
@ -180,17 +178,18 @@ final class MetadataEncoder {
@@ -180,17 +178,18 @@ final class MetadataEncoder {
|
|
|
|
|
Mono.fromCallable(() -> encodeEntries(this.metadataEntries)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
|
private DataBuffer encodeEntries(List<MetadataEntry> entries) { |
|
|
|
|
if (this.isComposite) { |
|
|
|
|
CompositeByteBuf composite = this.allocator.compositeBuffer(); |
|
|
|
|
try { |
|
|
|
|
if (this.route != null) { |
|
|
|
|
CompositeMetadataFlyweight.encodeAndAddMetadata(composite, this.allocator, |
|
|
|
|
io.rsocket.metadata.CompositeMetadataFlyweight.encodeAndAddMetadata(composite, this.allocator, |
|
|
|
|
WellKnownMimeType.MESSAGE_RSOCKET_ROUTING, encodeRoute()); |
|
|
|
|
} |
|
|
|
|
entries.forEach(entry -> { |
|
|
|
|
Object value = entry.value(); |
|
|
|
|
CompositeMetadataFlyweight.encodeAndAddMetadata( |
|
|
|
|
io.rsocket.metadata.CompositeMetadataFlyweight.encodeAndAddMetadata( |
|
|
|
|
composite, this.allocator, entry.mimeType().toString(), |
|
|
|
|
value instanceof ByteBuf ? (ByteBuf) value : PayloadUtils.asByteBuf(encodeEntry(entry))); |
|
|
|
|
}); |
|
|
|
@ -220,8 +219,9 @@ final class MetadataEncoder {
@@ -220,8 +219,9 @@ final class MetadataEncoder {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
|
private ByteBuf encodeRoute() { |
|
|
|
|
return TaggingMetadataFlyweight.createRoutingMetadata( |
|
|
|
|
return io.rsocket.metadata.TaggingMetadataFlyweight.createRoutingMetadata( |
|
|
|
|
this.allocator, Collections.singletonList(this.route)).getContent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|