Polishing
This commit is contained in:
@@ -70,7 +70,7 @@ public class AcceptHeaderLocaleResolver implements LocaleResolver {
|
||||
/**
|
||||
* Configure a fixed default locale to fall back on if the request does not
|
||||
* have an "Accept-Language" header.
|
||||
* <p>By default this is not set in which case when there is "Accept-Lanaguage"
|
||||
* <p>By default this is not set in which case when there is "Accept-Language"
|
||||
* header, the default locale for the server is used as defined in
|
||||
* {@link HttpServletRequest#getLocale()}.
|
||||
* @param defaultLocale the default locale to use
|
||||
@@ -81,7 +81,8 @@ public class AcceptHeaderLocaleResolver implements LocaleResolver {
|
||||
}
|
||||
|
||||
/**
|
||||
* The configured default locale.
|
||||
* The configured default locale, if any.
|
||||
* @since 4.3
|
||||
*/
|
||||
public Locale getDefaultLocale() {
|
||||
return this.defaultLocale;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*/
|
||||
abstract class AbstractMediaTypeExpression implements Comparable<AbstractMediaTypeExpression>, MediaTypeExpression {
|
||||
abstract class AbstractMediaTypeExpression implements MediaTypeExpression, Comparable<AbstractMediaTypeExpression> {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -66,6 +66,7 @@ abstract class AbstractMediaTypeExpression implements Comparable<AbstractMediaTy
|
||||
return this.isNegated;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(AbstractMediaTypeExpression other) {
|
||||
return MediaType.SPECIFICITY_COMPARATOR.compare(this.getMediaType(), other.getMediaType());
|
||||
|
||||
@@ -24,14 +24,11 @@ import org.junit.Test;
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.web.servlet.mvc.condition.ProducesRequestCondition.ProduceMediaTypeExpression;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ProducesRequestCondition}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
@@ -330,6 +327,7 @@ public class ProducesRequestConditionTests {
|
||||
assertNull(result);
|
||||
}
|
||||
|
||||
|
||||
private void assertConditions(ProducesRequestCondition condition, String... expected) {
|
||||
Collection<ProduceMediaTypeExpression> expressions = condition.getContent();
|
||||
assertEquals("Invalid number of conditions", expressions.size(), expected.length);
|
||||
|
||||
Reference in New Issue
Block a user