Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -218,19 +218,28 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
|
||||
return (StompCommand) getHeader(COMMAND_HEADER);
|
||||
}
|
||||
|
||||
public Set<String> getAcceptVersion() {
|
||||
String rawValue = getFirstNativeHeader(STOMP_ACCEPT_VERSION_HEADER);
|
||||
return (rawValue != null ? StringUtils.commaDelimitedListToSet(rawValue) : Collections.<String>emptySet());
|
||||
}
|
||||
|
||||
public boolean isHeartbeat() {
|
||||
return (SimpMessageType.HEARTBEAT == getMessageType());
|
||||
}
|
||||
|
||||
public long[] getHeartbeat() {
|
||||
String rawValue = getFirstNativeHeader(STOMP_HEARTBEAT_HEADER);
|
||||
if (!StringUtils.hasText(rawValue)) {
|
||||
return Arrays.copyOf(DEFAULT_HEARTBEAT, 2);
|
||||
}
|
||||
String[] rawValues = StringUtils.commaDelimitedListToStringArray(rawValue);
|
||||
return new long[] {Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])};
|
||||
}
|
||||
|
||||
public void setAcceptVersion(String acceptVersion) {
|
||||
setNativeHeader(STOMP_ACCEPT_VERSION_HEADER, acceptVersion);
|
||||
}
|
||||
|
||||
public Set<String> getAcceptVersion() {
|
||||
String rawValue = getFirstNativeHeader(STOMP_ACCEPT_VERSION_HEADER);
|
||||
return (rawValue != null ? StringUtils.commaDelimitedListToSet(rawValue) : Collections.<String>emptySet());
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
setNativeHeader(STOMP_HOST_HEADER, host);
|
||||
}
|
||||
@@ -245,15 +254,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
|
||||
setNativeHeader(STOMP_DESTINATION_HEADER, destination);
|
||||
}
|
||||
|
||||
public long[] getHeartbeat() {
|
||||
String rawValue = getFirstNativeHeader(STOMP_HEARTBEAT_HEADER);
|
||||
if (!StringUtils.hasText(rawValue)) {
|
||||
return Arrays.copyOf(DEFAULT_HEARTBEAT, 2);
|
||||
}
|
||||
String[] rawValues = StringUtils.commaDelimitedListToStringArray(rawValue);
|
||||
return new long[] { Long.valueOf(rawValues[0]), Long.valueOf(rawValues[1])};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentType(MimeType contentType) {
|
||||
super.setContentType(contentType);
|
||||
setNativeHeader(STOMP_CONTENT_TYPE_HEADER, contentType.toString());
|
||||
|
||||
Reference in New Issue
Block a user