public final void onResourceRequested()
{
try
{
// Get request cycle
final RequestCycle cycle = RequestCycle.get();
// Fetch resource from subclass if necessary
IResourceStream resourceStream = init();
// Get servlet response to use when responding with resource
final WebResponse response = (WebResponse)cycle.getResponse();
// FIXME WICKET-385 Move HTTP caching features out of org.apache.wicket.Resource
if (isCacheable())
{
response.setLastModifiedTime(resourceStream.lastModifiedTime().getMilliseconds());
}
else
{
response.setLastModifiedTime(-1);
}
configureResponse(response);
cycle.scheduleRequestHandlerAfterCurrent(new ResourceStreamRequestHandler(
resourceStream));
}
finally
{
// Really really really make sure parameters are cleared