diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java index e27895f3df9..3e62ba13eef 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java @@ -328,7 +328,6 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler @Override protected void startInternal() { - this.clientInboundChannel.subscribe(this); this.brokerChannel.subscribe(this); @@ -382,7 +381,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler String sessionId = headers.getSessionId(); if (!isBrokerAvailable()) { - if (sessionId == null || sessionId.equals(SystemStompConnectionHandler.SESSION_ID)) { + if (sessionId == null || SystemStompConnectionHandler.SESSION_ID.equals(sessionId)) { throw new MessageDeliveryException("Message broker is not active."); } if (SimpMessageType.CONNECT.equals(headers.getMessageType()) && logger.isErrorEnabled()) { @@ -574,7 +573,6 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler } private void initHeartbeats(StompHeaderAccessor connectedHeaders) { - // Remote clients do their own heartbeat management if (this.isRemoteClientSession) { return; } diff --git a/spring-web/src/main/java/org/springframework/http/HttpEntity.java b/spring-web/src/main/java/org/springframework/http/HttpEntity.java index 2bd3856506c..98d566f1ff7 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpEntity.java +++ b/spring-web/src/main/java/org/springframework/http/HttpEntity.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -138,20 +138,20 @@ public class HttpEntity { @Override public int hashCode() { - return ObjectUtils.nullSafeHashCode(this.headers) * 29 + ObjectUtils.nullSafeHashCode(this.body); + return (ObjectUtils.nullSafeHashCode(this.headers) * 29 + ObjectUtils.nullSafeHashCode(this.body)); } @Override public String toString() { StringBuilder builder = new StringBuilder("<"); - if (body != null) { - builder.append(body); - if (headers != null) { + if (this.body != null) { + builder.append(this.body); + if (this.headers != null) { builder.append(','); } } - if (headers != null) { - builder.append(headers); + if (this.headers != null) { + builder.append(this.headers); } builder.append('>'); return builder.toString(); diff --git a/spring-web/src/main/java/org/springframework/http/ResponseEntity.java b/spring-web/src/main/java/org/springframework/http/ResponseEntity.java index e4451aec28d..69c2a31e270 100644 --- a/spring-web/src/main/java/org/springframework/http/ResponseEntity.java +++ b/spring-web/src/main/java/org/springframework/http/ResponseEntity.java @@ -106,16 +106,16 @@ public class ResponseEntity extends HttpEntity { if (this == other) { return true; } - if (!(other instanceof ResponseEntity)) { + if (!(other instanceof ResponseEntity) || !super.equals(other)) { return false; } ResponseEntity otherEntity = (ResponseEntity) other; - return (ObjectUtils.nullSafeEquals(this.statusCode, otherEntity.statusCode) && super.equals(other)); + return ObjectUtils.nullSafeEquals(this.statusCode, otherEntity.statusCode); } @Override public int hashCode() { - return super.hashCode() * 29 + ObjectUtils.nullSafeHashCode(this.statusCode); + return (super.hashCode() * 29 + ObjectUtils.nullSafeHashCode(this.statusCode)); } @Override diff --git a/spring-web/src/main/java/org/springframework/web/client/RestOperations.java b/spring-web/src/main/java/org/springframework/web/client/RestOperations.java index 1f758ff2125..a719f4b491a 100644 --- a/spring-web/src/main/java/org/springframework/web/client/RestOperations.java +++ b/spring-web/src/main/java/org/springframework/web/client/RestOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -106,6 +106,7 @@ public interface RestOperations { */ ResponseEntity getForEntity(URI url, Class responseType) throws RestClientException; + // HEAD /** @@ -133,6 +134,7 @@ public interface RestOperations { */ HttpHeaders headForHeaders(URI url) throws RestClientException; + // POST /** @@ -265,6 +267,7 @@ public interface RestOperations { */ ResponseEntity postForEntity(URI url, Object request, Class responseType) throws RestClientException; + // PUT /** @@ -301,6 +304,7 @@ public interface RestOperations { */ void put(URI url, Object request) throws RestClientException; + // DELETE /** @@ -326,6 +330,7 @@ public interface RestOperations { */ void delete(URI url) throws RestClientException; + // OPTIONS /** @@ -353,6 +358,7 @@ public interface RestOperations { */ Set optionsForAllow(URI url) throws RestClientException; + // exchange /** @@ -402,12 +408,10 @@ public interface RestOperations { * Execute the HTTP method to the given URI template, writing the given * request entity to the request, and returns the response as {@link ResponseEntity}. * The given {@link ParameterizedTypeReference} is used to pass generic type information: - * *
 	 * ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
 	 * ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);
 	 * 
- * * @param url the URL * @param method the HTTP method (GET, POST, etc) * @param requestEntity the entity (headers and/or body) to write to the @@ -415,7 +419,7 @@ public interface RestOperations { * @param responseType the type of the return value * @param uriVariables the variables to expand in the template * @return the response as entity - * @since 3.2.0 + * @since 3.2 */ ResponseEntity exchange(String url,HttpMethod method, HttpEntity requestEntity, ParameterizedTypeReference responseType, Object... uriVariables) throws RestClientException; @@ -424,19 +428,17 @@ public interface RestOperations { * Execute the HTTP method to the given URI template, writing the given * request entity to the request, and returns the response as {@link ResponseEntity}. * The given {@link ParameterizedTypeReference} is used to pass generic type information: - * *
 	 * ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
 	 * ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);
 	 * 
- * * @param url the URL * @param method the HTTP method (GET, POST, etc) * @param requestEntity the entity (headers and/or body) to write to the request, may be {@code null} * @param responseType the type of the return value * @param uriVariables the variables to expand in the template * @return the response as entity - * @since 3.2.0 + * @since 3.2 */ ResponseEntity exchange(String url, HttpMethod method, HttpEntity requestEntity, ParameterizedTypeReference responseType, Map uriVariables) throws RestClientException; @@ -445,22 +447,21 @@ public interface RestOperations { * Execute the HTTP method to the given URI template, writing the given * request entity to the request, and returns the response as {@link ResponseEntity}. * The given {@link ParameterizedTypeReference} is used to pass generic type information: - * *
 	 * ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
 	 * ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);
 	 * 
- * * @param url the URL * @param method the HTTP method (GET, POST, etc) * @param requestEntity the entity (headers and/or body) to write to the request, may be {@code null} * @param responseType the type of the return value * @return the response as entity - * @since 3.2.0 + * @since 3.2 */ ResponseEntity exchange(URI url, HttpMethod method, HttpEntity requestEntity, ParameterizedTypeReference responseType) throws RestClientException; + // general execution /** diff --git a/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java b/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java index 9d9ebc450b7..26bfd710095 100644 --- a/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java +++ b/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java @@ -284,6 +284,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat return execute(url, HttpMethod.GET, requestCallback, responseExtractor); } + // HEAD @Override @@ -301,6 +302,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat return execute(url, HttpMethod.HEAD, null, headersExtractor()); } + // POST @Override @@ -377,6 +379,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat return execute(url, HttpMethod.POST, requestCallback, responseExtractor); } + // PUT @Override @@ -397,6 +400,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat execute(url, HttpMethod.PUT, requestCallback, null); } + // DELETE @Override @@ -414,6 +418,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat execute(url, HttpMethod.DELETE, null, null); } + // OPTIONS @Override @@ -437,6 +442,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat return headers.getAllow(); } + // exchange @Override