Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.services.assets
Interface AssetRequestHandler

All Known Implementing Classes:
  ClasspathAssetRequestHandler, ContextAssetRequestHandler, StackAssetRequestHandler

    public interface AssetRequestHandler

Handler for asset requests, which expose some kind of `Asset` to the user agent (i.e., the client web browser). Starting in Tapestry 5.2, asset paths are more structured, consisting of four parts:

- `/assets/` -- the root path for all assets
- application version -- the application version, as defined by the `SymbolConstants.APPLICATION_VERSION` symbol
- handler id -- a handler for this part of the asset path (defined by contributions to the `AssetDispatcher` service)
- extra path -- additional path beyond the handler id, used to identify the specific resource

So, an example path might be `/assets/1.0.1/corelib/components/select.png`. The handler id would be `corelib`, and the extra path would be `components/select.png`.

Since:
  5.2.0
See Also:
  `AssetDispatcher`

Method Summary
`boolean` | `handleAssetRequest(Request request, Response response, java.lang.String extraPath)` Given a request targeted (via the handler id) to the specific handler, process the request.

Method Detail

### handleAssetRequest

    boolean handleAssetRequest(Request request,
                               Response response,
                               java.lang.String extraPath)
                               throws java.io.IOException

  Given a request targeted (via the handler id) to the specific handler, process the request. The handler is responsible for processing the request, sending back either a bytestream (via `Response.getOutputStream(String)`) or an error response (via `Response.sendError(int, String)`). It is the handler's responsibility to allow for client-side caching (possibly sending an `HttpServletResponse.SC_NOT_MODIFIED` response).

  The handler should return true if it provided a response. If the handler returns false, this indicates that the extra path did not identify a known asset (virtual or otherwise) and the AssetDispatcher service should send a `HttpServletResponse.SC_NOT_FOUND` response.

  Parameters:
    `request` - incoming asset request
    `response` - used to send a response to client
    `extraPath` - additional path to identify the specific asset
  Returns:
    true if request handler, false if asset not found
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.