Class FrontendDependencyUrlResolver

java.lang.Object
com.vaadin.flow.server.FrontendDependencyUrlResolver
All Implemented Interfaces:
Serializable

public final class FrontendDependencyUrlResolver extends Object implements Serializable
Resolves the value() of frontend dependency annotations to a canonical form that BootstrapHandler.BootstrapUriResolver can expand at render time. The same rules are used whether the annotation is on an AppShellConfigurator or on an ordinary Component.

Used for StyleSheet values, and for the JavaScript values that are loaded at runtime instead of being bundled. Callers should note that a rejected value (see the rules below) yields null rather than an exception, and that the dependency is then skipped.

For internal framework use only.

Since:
25.2
See Also:
  • Method Details

    • resolveToContextRoot

      public static String resolveToContextRoot(String rawValue)
      Normalizes a frontend-dependency URL value to a form that the bootstrap URI resolver can expand.

      Rules, in order:

      1. null or blank values return null.
      2. Values containing path traversals (..) are rejected with a warning and null is returned.
      3. http://, https://, //, context:// and base:// prefixes are returned unchanged.
      4. A leading ./ is stripped.
      5. If the value (after the previous step) starts with /, it is returned unchanged.
      6. Otherwise, context:// is prepended so the value resolves against the servlet context root.
      Parameters:
      rawValue - the raw annotation value
      Returns:
      the normalized value, or null if rejected