Polish WebJarsResourceResolver
Follow up to accb8519fd - same fix when resolving missing resources or
resolving a public URL for these resources.
This commit is contained in:
parent
0b0a5a9ed4
commit
0e2e6cf045
|
|
@ -63,7 +63,9 @@ public class WebJarsResourceResolver extends AbstractResourceResolver {
|
|||
Resource resolved = chain.resolveResource(request, requestPath, locations);
|
||||
if (resolved == null) {
|
||||
String webJarResourcePath = findWebJarResourcePath(requestPath);
|
||||
return chain.resolveResource(request, webJarResourcePath, locations);
|
||||
if(webJarResourcePath != null) {
|
||||
return chain.resolveResource(request, webJarResourcePath, locations);
|
||||
}
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class WebJarsResourceResolverTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void resolverUrlWebJarResourceNotFound() {
|
||||
public void resolveUrlWebJarResourceNotFound() {
|
||||
String file = "/something/something.js";
|
||||
given(this.chain.resolveUrlPath(file, this.locations)).willReturn(null);
|
||||
|
||||
|
|
@ -123,6 +123,18 @@ public class WebJarsResourceResolverTests {
|
|||
verify(this.chain, times(1)).resolveResource(this.request, file, this.locations);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveResourceNotFound() {
|
||||
String file = "/something/something.js";
|
||||
given(this.chain.resolveUrlPath(file, this.locations)).willReturn(null);
|
||||
|
||||
Resource actual = this.resolver.resolveResource(this.request, file, this.locations, this.chain);
|
||||
|
||||
assertNull(actual);
|
||||
verify(this.chain, times(1)).resolveResource(this.request, file, this.locations);
|
||||
verify(this.chain, never()).resolveResource(this.request, null, this.locations);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveResourceWebJar() {
|
||||
Resource expected = mock(Resource.class);
|
||||
|
|
|
|||
Loading…
Reference in New Issue