Polish
This commit is contained in:
parent
5632d043ff
commit
c90a5a9e9e
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ import org.springframework.boot.autoconfigure.security.StaticResourceLocation;
|
|||
import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher;
|
||||
|
||||
/**
|
||||
* Factory that can be used to create a {@link ServerWebExchangeMatcher} for commonly used paths.
|
||||
* Factory that can be used to create a {@link ServerWebExchangeMatcher} for commonly used
|
||||
* paths.
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @since 2.0.0
|
||||
|
|
@ -36,8 +37,7 @@ public final class PathRequest {
|
|||
* @return a {@link StaticResourceRequest}
|
||||
*/
|
||||
public static StaticResourceRequest toStaticResources() {
|
||||
return StaticResourceRequest.get();
|
||||
return StaticResourceRequest.INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ import org.springframework.util.Assert;
|
|||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
/**
|
||||
* Used to create a {@link ServerWebExchangeMatcher} for static resources in
|
||||
* commonly used locations. Returned by {@link PathRequest#toStaticResources()}.
|
||||
* Used to create a {@link ServerWebExchangeMatcher} for static resources in commonly used
|
||||
* locations. Returned by {@link PathRequest#toStaticResources()}.
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @since 2.0.0
|
||||
|
|
@ -42,7 +42,7 @@ import org.springframework.web.server.ServerWebExchange;
|
|||
*/
|
||||
public final class StaticResourceRequest {
|
||||
|
||||
private static final StaticResourceRequest INSTANCE = new StaticResourceRequest();
|
||||
static final StaticResourceRequest INSTANCE = new StaticResourceRequest();
|
||||
|
||||
private StaticResourceRequest() {
|
||||
}
|
||||
|
|
@ -83,20 +83,11 @@ public final class StaticResourceRequest {
|
|||
* @param locations the locations to include
|
||||
* @return the configured {@link ServerWebExchangeMatcher}
|
||||
*/
|
||||
public StaticResourceServerWebExchange at(
|
||||
Set<StaticResourceLocation> locations) {
|
||||
public StaticResourceServerWebExchange at(Set<StaticResourceLocation> locations) {
|
||||
Assert.notNull(locations, "Locations must not be null");
|
||||
return new StaticResourceServerWebExchange(new LinkedHashSet<>(locations));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the static resource request.
|
||||
* @return the static resource request
|
||||
*/
|
||||
static StaticResourceRequest get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* The server web exchange matcher used to match against resource
|
||||
* {@link StaticResourceLocation Locations}.
|
||||
|
|
|
|||
|
|
@ -42,11 +42,12 @@ public final class PathRequest {
|
|||
* @return a {@link StaticResourceRequest}
|
||||
*/
|
||||
public static StaticResourceRequest toStaticResources() {
|
||||
return StaticResourceRequest.get();
|
||||
return StaticResourceRequest.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a matcher that includes the H2 console location. For example: <pre class="code">
|
||||
* Returns a matcher that includes the H2 console location. For example:
|
||||
* <pre class="code">
|
||||
* PathRequest.toH2Console()
|
||||
* </pre>
|
||||
* @return the configured {@link RequestMatcher}
|
||||
|
|
@ -73,7 +74,8 @@ public final class PathRequest {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean matches(HttpServletRequest request, H2ConsoleProperties context) {
|
||||
protected boolean matches(HttpServletRequest request,
|
||||
H2ConsoleProperties context) {
|
||||
return this.delegate.matches(request);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
|
|||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Used to create a {@link RequestMatcher} for static resources in
|
||||
* commonly used locations. Returned by {@link PathRequest#toStaticResources()}.
|
||||
* Used to create a {@link RequestMatcher} for static resources in commonly used
|
||||
* locations. Returned by {@link PathRequest#toStaticResources()}.
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @author Phillip Webb
|
||||
|
|
@ -44,7 +44,7 @@ import org.springframework.util.Assert;
|
|||
*/
|
||||
public final class StaticResourceRequest {
|
||||
|
||||
private static final StaticResourceRequest INSTANCE = new StaticResourceRequest();
|
||||
static final StaticResourceRequest INSTANCE = new StaticResourceRequest();
|
||||
|
||||
private StaticResourceRequest() {
|
||||
}
|
||||
|
|
@ -90,14 +90,6 @@ public final class StaticResourceRequest {
|
|||
return new StaticResourceRequestMatcher(new LinkedHashSet<>(locations));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the static resource request.
|
||||
* @return the static resource request
|
||||
*/
|
||||
static StaticResourceRequest get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* The request matcher used to match against resource {@link StaticResourceLocation
|
||||
* Locations}.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ public class PathRequestTests {
|
|||
|
||||
@Test
|
||||
public void toStaticResourcesShouldReturnStaticResourceRequest() {
|
||||
assertThat(PathRequest.toStaticResources()).isInstanceOf(StaticResourceRequest.class);
|
||||
assertThat(PathRequest.toStaticResources())
|
||||
.isInstanceOf(StaticResourceRequest.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import static org.mockito.Mockito.mock;
|
|||
*/
|
||||
public class StaticResourceRequestTests {
|
||||
|
||||
private StaticResourceRequest resourceRequest = StaticResourceRequest.get();
|
||||
private StaticResourceRequest resourceRequest = StaticResourceRequest.INSTANCE;
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ public class PathRequestTests {
|
|||
|
||||
@Test
|
||||
public void toStaticResourcesShouldReturnStaticResourceRequest() {
|
||||
assertThat(PathRequest.toStaticResources()).isInstanceOf(StaticResourceRequest.class);
|
||||
assertThat(PathRequest.toStaticResources())
|
||||
.isInstanceOf(StaticResourceRequest.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*/
|
||||
public class StaticResourceRequestTests {
|
||||
|
||||
private StaticResourceRequest resourceRequest = StaticResourceRequest.get();
|
||||
private StaticResourceRequest resourceRequest = StaticResourceRequest.INSTANCE;
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
|
@ -92,8 +92,7 @@ public class StaticResourceRequestTests {
|
|||
public void excludeFromSetWhenSetIsNullShouldThrowException() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
this.thrown.expectMessage("Locations must not be null");
|
||||
this.resourceRequest.atCommonLocations()
|
||||
.excluding(null);
|
||||
this.resourceRequest.atCommonLocations().excluding(null);
|
||||
}
|
||||
|
||||
private RequestMatcherAssert assertMatcher(RequestMatcher matcher) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public final class LambdaSafe {
|
|||
Object... additionalArguments) {
|
||||
Assert.notNull(callbackType, "CallbackType must not be null");
|
||||
Assert.notNull(callbackInstances, "CallbackInstances must not be null");
|
||||
return new Callbacks<C, A>(callbackType, callbackInstances, argument,
|
||||
return new Callbacks<>(callbackType, callbackInstances, argument,
|
||||
additionalArguments);
|
||||
}
|
||||
|
||||
|
|
@ -341,8 +341,7 @@ public final class LambdaSafe {
|
|||
*/
|
||||
public final static class InvocationResult<R> {
|
||||
|
||||
private static final InvocationResult<?> NONE = new InvocationResult<Object>(
|
||||
null);
|
||||
private static final InvocationResult<?> NONE = new InvocationResult<>(null);
|
||||
|
||||
private final R value;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue