|
|
|
@ -31,6 +31,8 @@ import io.rsocket.Payload; |
|
|
|
import io.rsocket.metadata.CompositeMetadata; |
|
|
|
import io.rsocket.metadata.CompositeMetadata; |
|
|
|
import io.rsocket.metadata.RoutingMetadata; |
|
|
|
import io.rsocket.metadata.RoutingMetadata; |
|
|
|
import io.rsocket.metadata.WellKnownMimeType; |
|
|
|
import io.rsocket.metadata.WellKnownMimeType; |
|
|
|
|
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
|
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.core.ParameterizedTypeReference; |
|
|
|
import org.springframework.core.ParameterizedTypeReference; |
|
|
|
import org.springframework.core.ResolvableType; |
|
|
|
import org.springframework.core.ResolvableType; |
|
|
|
@ -52,6 +54,9 @@ import org.springframework.util.MimeType; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class DefaultMetadataExtractor implements MetadataExtractor, MetadataExtractorRegistry { |
|
|
|
public class DefaultMetadataExtractor implements MetadataExtractor, MetadataExtractorRegistry { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Log logger = LogFactory.getLog(DefaultMetadataExtractor.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final List<Decoder<?>> decoders; |
|
|
|
private final List<Decoder<?>> decoders; |
|
|
|
|
|
|
|
|
|
|
|
private final Map<String, EntryExtractor<?>> registrations = new HashMap<>(); |
|
|
|
private final Map<String, EntryExtractor<?>> registrations = new HashMap<>(); |
|
|
|
@ -119,6 +124,10 @@ public class DefaultMetadataExtractor implements MetadataExtractor, MetadataExtr |
|
|
|
else { |
|
|
|
else { |
|
|
|
extractEntry(payload.metadata().slice(), metadataMimeType.toString(), result); |
|
|
|
extractEntry(payload.metadata().slice(), metadataMimeType.toString(), result); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
|
|
|
logger.debug("Values extracted from metadata: " + result + |
|
|
|
|
|
|
|
" with registrations for " + this.registrations.keySet() + "."); |
|
|
|
|
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -175,7 +184,7 @@ public class DefaultMetadataExtractor implements MetadataExtractor, MetadataExtr |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String toString() { |
|
|
|
public String toString() { |
|
|
|
return "mimeType=" + this.mimeType + ", targetType=" + this.targetType; |
|
|
|
return "\"" + this.mimeType + "\" => " + this.targetType; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|