Search in sources :

Example 1 with IHttpResponseInterceptor

use of org.eclipse.scout.rt.server.commons.servlet.cache.IHttpResponseInterceptor in project scout.rt by eclipse.

the class DynamicResourceLoader method loadResource.

@Override
public HttpCacheObject loadResource(HttpCacheKey cacheKey) {
    DynamicResourceInfo info = createDynamicResourceInfo(cacheKey);
    if (info == null) {
        LOG.warn("invalid dynamic-resource request received.", new Exception("origin"));
        return null;
    }
    IBinaryResourceProvider provider = getBinaryResourceProvider(info.getUiSession(), info.getJsonAdapterId());
    if (provider == null) {
        return null;
    }
    BinaryResourceHolder localResourceHolder = provider.provideBinaryResource(info.getFileName());
    if (localResourceHolder == null || localResourceHolder.get() == null) {
        return null;
    }
    BinaryResource localResource = localResourceHolder.get();
    BinaryResource httpResource = localResource.createAlias(cacheKey.getResourcePath());
    HttpCacheObject httpCacheObject = new HttpCacheObject(cacheKey, httpResource);
    for (IHttpResponseInterceptor interceptor : localResourceHolder.getHttpResponseInterceptors()) {
        httpCacheObject.addHttpResponseInterceptor(interceptor);
    }
    return httpCacheObject;
}
Also used : IBinaryResourceProvider(org.eclipse.scout.rt.ui.html.res.IBinaryResourceProvider) BinaryResource(org.eclipse.scout.rt.platform.resource.BinaryResource) IHttpResponseInterceptor(org.eclipse.scout.rt.server.commons.servlet.cache.IHttpResponseInterceptor) IOException(java.io.IOException) HttpCacheObject(org.eclipse.scout.rt.server.commons.servlet.cache.HttpCacheObject) BinaryResourceHolder(org.eclipse.scout.rt.ui.html.res.BinaryResourceHolder)

Aggregations

IOException (java.io.IOException)1 BinaryResource (org.eclipse.scout.rt.platform.resource.BinaryResource)1 HttpCacheObject (org.eclipse.scout.rt.server.commons.servlet.cache.HttpCacheObject)1 IHttpResponseInterceptor (org.eclipse.scout.rt.server.commons.servlet.cache.IHttpResponseInterceptor)1 BinaryResourceHolder (org.eclipse.scout.rt.ui.html.res.BinaryResourceHolder)1 IBinaryResourceProvider (org.eclipse.scout.rt.ui.html.res.IBinaryResourceProvider)1