Polishing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<T> {
|
||||
|
||||
@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();
|
||||
|
||||
@@ -106,16 +106,16 @@ public class ResponseEntity<T> extends HttpEntity<T> {
|
||||
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
|
||||
|
||||
@@ -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 {
|
||||
*/
|
||||
<T> ResponseEntity<T> getForEntity(URI url, Class<T> 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 {
|
||||
*/
|
||||
<T> ResponseEntity<T> postForEntity(URI url, Object request, Class<T> 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<HttpMethod> 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:
|
||||
*
|
||||
* <pre class="code">
|
||||
* ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
|
||||
* ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);
|
||||
* </pre>
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
<T> ResponseEntity<T> exchange(String url,HttpMethod method, HttpEntity<?> requestEntity,
|
||||
ParameterizedTypeReference<T> 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:
|
||||
*
|
||||
* <pre class="code">
|
||||
* ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
|
||||
* ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);
|
||||
* </pre>
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
<T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity,
|
||||
ParameterizedTypeReference<T> responseType, Map<String, ?> 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:
|
||||
*
|
||||
* <pre class="code">
|
||||
* ParameterizedTypeReference<List<MyBean>> myBean = new ParameterizedTypeReference<List<MyBean>>() {};
|
||||
* ResponseEntity<List<MyBean>> response = template.exchange("http://example.com",HttpMethod.GET, null, myBean);
|
||||
* </pre>
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
<T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity,
|
||||
ParameterizedTypeReference<T> responseType) throws RestClientException;
|
||||
|
||||
|
||||
// general execution
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user