Interface AssetRequestHandler
-
- All Known Implementing Classes:
ClasspathAssetRequestHandler
,ContextAssetRequestHandler
,StackAssetRequestHandler
public interface AssetRequestHandler
Handler for asset requests, which expose some kind ofAsset
to the user agent (i.e., the client web browser). When contributed to theAssetDispatcher
service, the contributed key is a handler id (such as "meta/core"). An example request path might be/assets/meta/core/dd8d73ac51dbab28caaec4865d302bf2/deselect.png
. The handler id would bemeta/core
, the checksum of the resource content is the hex string, and the extra path would beselect.png
.- Since:
- 5.2.0
- See Also:
AssetDispatcher
,AssetRequestDispatcher
,AssetPathConstructor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
handleAssetRequest(Request request, Response response, 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, String extraPath) throws 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 (viaResponse.getOutputStream(String)
) or an error response (viaResponse.sendError(int, String)
). It is the handler's responsibility to allow for client-side caching (possibly sending anHttpServletResponse.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 aHttpServletResponse.SC_NOT_FOUND
response. Starting in Tapestry 5.4, the handler is informed by theAssetRequestDispatcher
whether or not the content should be compressed (this is determined based on information in the URL).- Parameters:
request
- incoming asset requestresponse
- used to send a response to clientextraPath
- additional path to identify the specific asset- Returns:
- true if request was handled (and response sent), false if asset not found
- Throws:
IOException
-
-