本文整理汇总了Java中org.springframework.messaging.MessageHeaders.get方法的典型用法代码示例。如果您正苦于以下问题:Java MessageHeaders.get方法的具体用法?Java MessageHeaders.get怎么用?Java MessageHeaders.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.messaging.MessageHeaders
的用法示例。
在下文中一共展示了MessageHeaders.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolve
import org.springframework.messaging.MessageHeaders; //导入方法依赖的package包/类
@Override
public MimeType resolve(MessageHeaders headers) {
if (headers == null || headers.get(MessageHeaders.CONTENT_TYPE) == null) {
return this.defaultMimeType;
}
Object value = headers.get(MessageHeaders.CONTENT_TYPE);
if (value instanceof MimeType) {
return (MimeType) value;
}
else if (value instanceof String) {
return MimeType.valueOf((String) value);
}
else {
throw new IllegalArgumentException(
"Unknown type for contentType header value: " + value.getClass());
}
}
示例2: read
import org.springframework.messaging.MessageHeaders; //导入方法依赖的package包/类
@Override
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
MessageHeaders headers = (MessageHeaders) target;
SimpMessageHeaderAccessor accessor =
MessageHeaderAccessor.getAccessor(headers, SimpMessageHeaderAccessor.class);
Object value;
if ("destination".equalsIgnoreCase(name)) {
value = accessor.getDestination();
}
else {
value = accessor.getFirstNativeHeader(name);
if (value == null) {
value = headers.get(name);
}
}
return new TypedValue(value);
}
示例3: parseToken
import org.springframework.messaging.MessageHeaders; //导入方法依赖的package包/类
private String parseToken(MessageHeaders headers) {
System.out.println("---- Headers ----");
System.out.println(headers.toString());
Object headersObj = headers.get("nativeHeaders");
ObjectMapper m = new ObjectMapper();
Map<String, LinkedList<String>> props = m.convertValue(headersObj, Map.class);
LinkedList<String> tokenArray = props.get("token");
if (tokenArray.size() > 0) {
return tokenArray.get(0);
}
return "";
}
示例4: initVarResolver
import org.springframework.messaging.MessageHeaders; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private PlaceholderResolver initVarResolver(MessageHeaders headers) {
String name = DestinationVariableMethodArgumentResolver.DESTINATION_TEMPLATE_VARIABLES_HEADER;
Map<String, String> vars = (Map<String, String>) headers.get(name);
return new DestinationVariablePlaceholderResolver(vars);
}