Package org.apache.struts2.webjars
Interface WebJarUrlProvider
- All Known Implementing Classes:
StrutsWebJarUrlProvider
public interface WebJarUrlProvider
Resolves version-less WebJar logical paths (e.g.
bootstrap/css/bootstrap.min.css) to either a
concrete classpath resource under META-INF/resources/webjars/ (for serving) or a servable URL
(for tags/macros). Resolution is constrained to the WebJars root, honours an optional allowlist and the
struts.webjars.enabled switch, and fails closed (empty result) when unresolved or blocked.-
Method Summary
Modifier and TypeMethodDescriptionbooleanresolveResourcePath(String logicalPath) resolveUrl(String logicalPath, jakarta.servlet.http.HttpServletRequest request)
-
Method Details
-
resolveResourcePath
- Parameters:
logicalPath- version-less path such asbootstrap/css/bootstrap.min.css- Returns:
- the concrete classpath resource path (e.g.
META-INF/resources/webjars/bootstrap/5.3.8/css/bootstrap.min.css), or empty
-
resolveUrl
- Parameters:
logicalPath- version-less path such asbootstrap/css/bootstrap.min.cssrequest- the current request (used for the servlet context path)- Returns:
- a servable URL, or empty
-
isEnabled
boolean isEnabled()- Returns:
- whether WebJars support is enabled
-