public void load(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res)
    throws IOException, CmsException {

        if (canSendLastModifiedHeader(resource, req, res)) {
            // no further processing required
            return;
        }

        // make sure we have the file contents available
        CmsFile file = cms.readFile(resource);

        // set response status to "200 - OK" (required for static export "on-demand")
        res.setStatus(HttpServletResponse.SC_OK);
        // set content length header
        res.setContentLength(file.getContents().length);

        if (CmsWorkplaceManager.isWorkplaceUser(req)) {
            // prevent caching for Workplace users
            res.setDateHeader(CmsRequestUtil.HEADER_LAST_MODIFIED, System.currentTimeMillis());
            CmsRequestUtil.setNoCacheHeaders(res);
        } else {
            // set date last modified header
            res.setDateHeader(CmsRequestUtil.HEADER_LAST_MODIFIED, file.getDateLastModified());

            // set "Expires" only if cache control is not already set
            if (!res.containsHeader(CmsRequestUtil.HEADER_CACHE_CONTROL)) {
                long expireTime = resource.getDateExpired();
                if (expireTime == CmsResource.DATE_EXPIRED_DEFAULT) {
                    expireTime--;
                    // flex controller will automatically reduce this to a reasonable value
                }
                // now set "Expires" header
                CmsFlexController.setDateExpiresHeader(res, expireTime, m_clientCacheMaxAge);
            }
        }

        service(cms, file, req, res);
    }
public void load ( CmsObject cms , CmsResource resource , HttpServletRequest req , HttpServletResponse res ) throws IOException , CmsException { if ( canSendLastModifiedHeader ( resource , req , res ) ) { return ; } CmsFile file = cms . readFile ( resource ) ; res . setStatus ( HttpServletResponse . SC_OK ) ; res . setContentLength ( file . getContents ( ) . length ) ; if ( CmsWorkplaceManager . isWorkplaceUser ( req ) ) { res . setDateHeader ( CmsRequestUtil . HEADER_LAST_MODIFIED , System . currentTimeMillis ( ) ) ; CmsRequestUtil . setNoCacheHeaders ( res ) ; } else { res . setDateHeader ( CmsRequestUtil . HEADER_LAST_MODIFIED , file . getDateLastModified ( ) ) ; if ( ! res . containsHeader ( CmsRequestUtil . HEADER_CACHE_CONTROL ) ) { long expireTime = resource . getDateExpired ( ) ; if ( expireTime == CmsResource . DATE_EXPIRED_DEFAULT ) { expireTime -- ; } CmsFlexController . setDateExpiresHeader ( res , expireTime , m_clientCacheMaxAge ) ; } } service ( cms , file , req , res ) ; }
@see org.opencms.loader.I_CmsResourceLoader#load(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)