|
1 | 1 | /* |
2 | | - * Copyright 2002-2016 the original author or authors. |
| 2 | + * Copyright 2002-2017 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
17 | 17 | package org.springframework.web.servlet.resource; |
18 | 18 |
|
19 | 19 | import java.util.List; |
| 20 | + |
20 | 21 | import javax.servlet.http.HttpServletRequest; |
21 | 22 |
|
22 | | -import org.webjars.MultipleMatchesException; |
23 | 23 | import org.webjars.WebJarAssetLocator; |
24 | 24 |
|
25 | 25 | import org.springframework.core.io.Resource; |
@@ -99,26 +99,16 @@ protected String resolveUrlPathInternal(String resourceUrlPath, |
99 | 99 | } |
100 | 100 |
|
101 | 101 | protected String findWebJarResourcePath(String path) { |
102 | | - try { |
103 | | - int startOffset = (path.startsWith("/") ? 1 : 0); |
104 | | - int endOffset = path.indexOf("/", 1); |
105 | | - if (endOffset != -1) { |
106 | | - String webjar = path.substring(startOffset, endOffset); |
107 | | - String partialPath = path.substring(endOffset); |
108 | | - String webJarPath = webJarAssetLocator.getFullPath(webjar, partialPath); |
| 102 | + int startOffset = (path.startsWith("/") ? 1 : 0); |
| 103 | + int endOffset = path.indexOf("/", 1); |
| 104 | + if (endOffset != -1) { |
| 105 | + String webjar = path.substring(startOffset, endOffset); |
| 106 | + String partialPath = path.substring(endOffset + 1); |
| 107 | + String webJarPath = webJarAssetLocator.getFullPathExact(webjar, partialPath); |
| 108 | + if (webJarPath != null) { |
109 | 109 | return webJarPath.substring(WEBJARS_LOCATION_LENGTH); |
110 | 110 | } |
111 | 111 | } |
112 | | - catch (MultipleMatchesException ex) { |
113 | | - if (logger.isWarnEnabled()) { |
114 | | - logger.warn("WebJar version conflict for \"" + path + "\"", ex); |
115 | | - } |
116 | | - } |
117 | | - catch (IllegalArgumentException ex) { |
118 | | - if (logger.isTraceEnabled()) { |
119 | | - logger.trace("No WebJar resource found for \"" + path + "\""); |
120 | | - } |
121 | | - } |
122 | 112 | return null; |
123 | 113 | } |
124 | 114 |
|
|
0 commit comments