Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Apr 8, 2024
1 parent 36636b0 commit 1455a9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -47,21 +47,21 @@ public class LiteWebJarsResourceResolver extends AbstractResourceResolver {

private static final int WEBJARS_LOCATION_LENGTH = WebJarVersionLocator.WEBJARS_PATH_PREFIX.length() + 1;

private final WebJarVersionLocator webJarAssetLocator;
private final WebJarVersionLocator webJarVersionLocator;

/**
* Create a {@code LiteWebJarsResourceResolver} with a default {@code WebJarVersionLocator} instance.
*/
public LiteWebJarsResourceResolver() {
this.webJarAssetLocator = new WebJarVersionLocator();
this.webJarVersionLocator = new WebJarVersionLocator();
}

/**
* Create a {@code LiteWebJarsResourceResolver} with a custom {@code WebJarVersionLocator} instance,
* e.g. with a custom cache implementation.
*/
public LiteWebJarsResourceResolver(WebJarVersionLocator webJarAssetLocator) {
this.webJarAssetLocator = webJarAssetLocator;
public LiteWebJarsResourceResolver(WebJarVersionLocator webJarVersionLocator) {
this.webJarVersionLocator = webJarVersionLocator;
}

@Override
Expand Down Expand Up @@ -98,12 +98,12 @@ protected Mono<String> resolveUrlPathInternal(String resourceUrlPath,

@Nullable
protected String findWebJarResourcePath(String path) {
int startOffset = (path.startsWith("/") ? 1 : 0);
int endOffset = path.indexOf('/', 1);
if (endOffset != -1) {
int startOffset = (path.startsWith("/") ? 1 : 0);
String webjar = path.substring(startOffset, endOffset);
String partialPath = path.substring(endOffset + 1);
String webJarPath = this.webJarAssetLocator.fullPath(webjar, partialPath);
String webJarPath = this.webJarVersionLocator.fullPath(webjar, partialPath);
if (webJarPath != null) {
return webJarPath.substring(WEBJARS_LOCATION_LENGTH);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ public class LiteWebJarsResourceResolver extends AbstractResourceResolver {

private static final int WEBJARS_LOCATION_LENGTH = WebJarVersionLocator.WEBJARS_PATH_PREFIX.length() + 1;

private final WebJarVersionLocator webJarAssetLocator;
private final WebJarVersionLocator webJarVersionLocator;

/**
* Create a {@code LiteWebJarsResourceResolver} with a default {@code WebJarVersionLocator} instance.
*/
public LiteWebJarsResourceResolver() {
this.webJarAssetLocator = new WebJarVersionLocator();
this.webJarVersionLocator = new WebJarVersionLocator();
}

/**
* Create a {@code LiteWebJarsResourceResolver} with a custom {@code WebJarVersionLocator} instance,
* e.g. with a custom cache implementation.
*/
public LiteWebJarsResourceResolver(WebJarVersionLocator webJarAssetLocator) {
this.webJarAssetLocator = webJarAssetLocator;
public LiteWebJarsResourceResolver(WebJarVersionLocator webJarVersionLocator) {
this.webJarVersionLocator = webJarVersionLocator;
}

@Override
Expand Down Expand Up @@ -96,12 +96,12 @@ protected String resolveUrlPathInternal(String resourceUrlPath,

@Nullable
protected String findWebJarResourcePath(String path) {
int startOffset = (path.startsWith("/") ? 1 : 0);
int endOffset = path.indexOf('/', 1);
if (endOffset != -1) {
int startOffset = (path.startsWith("/") ? 1 : 0);
String webjar = path.substring(startOffset, endOffset);
String partialPath = path.substring(endOffset + 1);
String webJarPath = this.webJarAssetLocator.fullPath(webjar, partialPath);
String webJarPath = this.webJarVersionLocator.fullPath(webjar, partialPath);
if (webJarPath != null) {
return webJarPath.substring(WEBJARS_LOCATION_LENGTH);
}
Expand Down

0 comments on commit 1455a9f

Please sign in to comment.