org.apache.tapestry5

## Interface Asset

- All Known Subinterfaces:
    Asset2
  All Known Implementing Classes:
    AbstractAsset, UrlAsset

      public interface Asset

  An Asset is any kind of resource that can be exposed to the client web browser. Although quite often an Asset is a resource in a web application's context folder, within Tapestry, Assets may also be resources on the classpath (i.e., packaged inside JARs). An Asset's toString() will return the URL for the resource (the same value as `toClientURL()`). Release 5.1.0.0 introduced `Asset2`, which extends this interface with an additional method.
  See Also:
    `AssetPathConverter`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Resource` | `getResource()` Returns the underlying Resource for the Asset.
    `String` | `toClientURL()` Returns a URL that can be passed, unchanged, to the client in order for it to access the resource.

- - ### Method Detail

    - #### toClientURL

          String toClientURL()

      Returns a URL that can be passed, unchanged, to the client in order for it to access the resource. The same value is returned from `toString()`. Tapestry's built-in asset types (context and classpath) always incorporate a checksum as part of the path, and alternate implementations are encouraged to do so as well. In addition, Tapestry ensures that context and classpath assets have a far-future expires header (to ensure aggressive caching by the client). Note that starting in Tapestry 5.4, it is expected that Asset instances recognize when the underlying Resource's content has changed, and update the clientURL to reflect the new content's checksum. This wasn't an issue in earlier releases where the clientURL incorporated a version number. Finally, starting in 5.4, this value will often be variant: the exact URL returned will depend on whether the underlying resource content is compressable, whether the current `Request` supports compression.
      See Also:
        `AssetSource`, `AssetPathConverter`

    - #### getResource

          Resource getResource()

      Returns the underlying Resource for the Asset.

5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.