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 Details

    • resolveResourcePath

      Optional<String> resolveResourcePath(String logicalPath)
      Parameters:
      logicalPath - version-less path such as bootstrap/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

      Optional<String> resolveUrl(String logicalPath, jakarta.servlet.http.HttpServletRequest request)
      Parameters:
      logicalPath - version-less path such as bootstrap/css/bootstrap.min.css
      request - the current request (used for the servlet context path)
      Returns:
      a servable URL, or empty
    • isEnabled

      boolean isEnabled()
      Returns:
      whether WebJars support is enabled