Polishing
This commit is contained in:
parent
783cb2c438
commit
1cc042d4c7
|
|
@ -33,6 +33,11 @@ public class PayloadApplicationEvent<T> extends ApplicationEvent {
|
||||||
private final T payload;
|
private final T payload;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PayloadApplicationEvent.
|
||||||
|
* @param source the component that published the event (never {@code null})
|
||||||
|
* @param payload the payload object
|
||||||
|
*/
|
||||||
public PayloadApplicationEvent(Object source, T payload) {
|
public PayloadApplicationEvent(Object source, T payload) {
|
||||||
super(source);
|
super(source);
|
||||||
Assert.notNull(payload, "Payload must not be null");
|
Assert.notNull(payload, "Payload must not be null");
|
||||||
|
|
@ -44,8 +49,7 @@ public class PayloadApplicationEvent<T> extends ApplicationEvent {
|
||||||
* Return the payload of the event.
|
* Return the payload of the event.
|
||||||
*/
|
*/
|
||||||
public T getPayload() {
|
public T getPayload() {
|
||||||
return payload;
|
return this.payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -636,9 +636,9 @@ public class AnnotationDrivenEventListenerTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@EventListener(condition = "'OK'.equals(#content)")
|
@EventListener(condition = "#payload.startsWith('OK')")
|
||||||
public void handleString(String content) {
|
public void handleString(String payload) {
|
||||||
super.handleString(content);
|
super.handleString(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventListener(condition = "#root.event.timestamp > #p0")
|
@EventListener(condition = "#root.event.timestamp > #p0")
|
||||||
|
|
|
||||||
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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);
|
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() {
|
public boolean isHeartbeat() {
|
||||||
return (SimpMessageType.HEARTBEAT == getMessageType());
|
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) {
|
public void setAcceptVersion(String acceptVersion) {
|
||||||
setNativeHeader(STOMP_ACCEPT_VERSION_HEADER, 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) {
|
public void setHost(String host) {
|
||||||
setNativeHeader(STOMP_HOST_HEADER, host);
|
setNativeHeader(STOMP_HOST_HEADER, host);
|
||||||
}
|
}
|
||||||
|
|
@ -245,15 +254,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
|
||||||
setNativeHeader(STOMP_DESTINATION_HEADER, destination);
|
setNativeHeader(STOMP_DESTINATION_HEADER, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long[] getHeartbeat() {
|
@Override
|
||||||
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 setContentType(MimeType contentType) {
|
public void setContentType(MimeType contentType) {
|
||||||
super.setContentType(contentType);
|
super.setContentType(contentType);
|
||||||
setNativeHeader(STOMP_CONTENT_TYPE_HEADER, contentType.toString());
|
setNativeHeader(STOMP_CONTENT_TYPE_HEADER, contentType.toString());
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@ import java.lang.annotation.Target;
|
||||||
* Marks the annotated method as permitting cross origin requests.
|
* Marks the annotated method as permitting cross origin requests.
|
||||||
* By default, all origins and headers are permitted.
|
* By default, all origins and headers are permitted.
|
||||||
*
|
*
|
||||||
* @since 4.2
|
|
||||||
* @author Russell Allen
|
* @author Russell Allen
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
|
@ -37,7 +37,7 @@ public @interface CrossOrigin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of allowed origins. {@code "*"} means that all origins are allowed. These values
|
* List of allowed origins. {@code "*"} means that all origins are allowed. These values
|
||||||
* are placed in the {@code Access-Control-Allow-Origin } header of both the pre-flight
|
* are placed in the {@code Access-Control-Allow-Origin} header of both the pre-flight
|
||||||
* and actual responses. Default value is <b>"*"</b>.
|
* and actual responses. Default value is <b>"*"</b>.
|
||||||
*/
|
*/
|
||||||
String[] origin() default {"*"};
|
String[] origin() default {"*"};
|
||||||
|
|
@ -71,7 +71,7 @@ public @interface CrossOrigin {
|
||||||
String allowCredentials() default "true";
|
String allowCredentials() default "true";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the cache duration for pre-flight responses. Setting this to a reasonable
|
* Controls the cache duration for pre-flight responses. Setting this to a reasonable
|
||||||
* value can reduce the number of pre-flight request/response interaction required by
|
* value can reduce the number of pre-flight request/response interaction required by
|
||||||
* the browser. This property controls the value of the {@code Access-Control-Max-Age header}
|
* the browser. This property controls the value of the {@code Access-Control-Max-Age header}
|
||||||
* in the pre-flight response. Value set to -1 means undefined. Default value is
|
* in the pre-flight response. Value set to -1 means undefined. Default value is
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2012 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -52,7 +52,7 @@ public class MaxUploadSizeExceededException extends MultipartException {
|
||||||
* Return the maximum upload size allowed.
|
* Return the maximum upload size allowed.
|
||||||
*/
|
*/
|
||||||
public long getMaxUploadSize() {
|
public long getMaxUploadSize() {
|
||||||
return maxUploadSize;
|
return this.maxUploadSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue