Polishing

This commit is contained in:
Juergen Hoeller 2018-02-25 21:24:38 +01:00
parent 8a56cd0e8b
commit 2a379e099c
2 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@ -68,7 +68,7 @@ public class DefaultUserDestinationResolver implements UserDestinationResolver {
* @param userRegistry the registry, never {@code null}
*/
public DefaultUserDestinationResolver(SimpUserRegistry userRegistry) {
Assert.notNull(userRegistry, "'userRegistry' must not be null");
Assert.notNull(userRegistry, "SimpUserRegistry must not be null");
this.userRegistry = userRegistry;
}
@ -87,8 +87,8 @@ public class DefaultUserDestinationResolver implements UserDestinationResolver {
* @param prefix the prefix to use
*/
public void setUserDestinationPrefix(String prefix) {
Assert.hasText(prefix, "prefix must not be empty");
this.prefix = prefix.endsWith("/") ? prefix : prefix + "/";
Assert.hasText(prefix, "Prefix must not be empty");
this.prefix = (prefix.endsWith("/") ? prefix : prefix + "/");
}
/**
@ -102,11 +102,11 @@ public class DefaultUserDestinationResolver implements UserDestinationResolver {
* Use this property to indicate whether the leading slash from translated
* user destinations should be removed or not. This depends on the
* destination prefixes the message broker is configured with.
* <p>By default this is set to {@code false}, i.e. "do not change the
* target destination", although
* <p>By default this is set to {@code false}, i.e.
* "do not change the target destination", although
* {@link org.springframework.messaging.simp.config.AbstractMessageBrokerConfiguration
* AbstractMessageBrokerConfiguration} may change that to {@code true} if
* the configured destinations do not have a leading slash.
* AbstractMessageBrokerConfiguration} may change that to {@code true}
* if the configured destinations do not have a leading slash.
* @param remove whether to remove the leading slash
* @since 4.3.14
*/
@ -116,6 +116,7 @@ public class DefaultUserDestinationResolver implements UserDestinationResolver {
/**
* Whether to remove the leading slash from target destinations.
* @since 4.3.14
*/
public boolean isRemoveLeadingSlash() {
return this.removeLeadingSlash;

View File

@ -42,7 +42,6 @@ import static org.junit.Assert.*;
*/
public class ServerHttpRequestTests {
@Test
public void queryParamsNone() throws Exception {
MultiValueMap<String, String> params = createHttpRequest("/path").getQueryParams();
@ -64,7 +63,7 @@ public class ServerHttpRequestTests {
assertEquals(Arrays.asList("1", "2"), params.get("a"));
}
@Test // SPR-15140
@Test // SPR-15140
public void queryParamsWithEncodedValue() throws Exception {
MultiValueMap<String, String> params = createHttpRequest("/path?a=%20%2B+%C3%A0").getQueryParams();
assertEquals(1, params.size());
@ -85,7 +84,7 @@ public class ServerHttpRequestTests {
assertEquals(Collections.singletonList(null), params.get("a"));
}
@Test // SPR-16434
@Test // SPR-16434
public void mutatePathWithEncodedQueryParams() throws Exception {
ServerHttpRequest request = createHttpRequest("/path?name=%E6%89%8E%E6%A0%B9")
.mutate().path("/mutatedPath").build();