@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//
if (request instanceof WidgetRequest && response instanceof WidgetResponse) {
WidgetRequest widgetRequest = (WidgetRequest) request;
WidgetResponse widgetResponse = (WidgetResponse) response;
//
if ("render".equals(widgetRequest.getRequestType())) {
WidgetConfig widgetConfig = widgetRequest.getWidgetConfig();
WidgetResponse cachedWidgetResponse = (WidgetResponse) widgetCache.get(widgetConfig);
if (cachedWidgetResponse != null) {
FileCopyUtils.copy(cachedWidgetResponse.getResponseAsByteArray(), widgetResponse.getOutputStream());
return false;
}
}
}
return true;