Examples of FileCache


Examples of com.sun.grizzly.config.dom.FileCache

                    final Http http = protocol.getHttp();
                    if (http != null) {
                        ConfigSupport.apply(new SingleConfigCode<Http>() {
                            @Override
                            public Object run(Http http) throws TransactionFailure {
                                final FileCache cache = http.createChild(FileCache.class);
                                http.setFileCache(cache);
                                cache.setEnabled(httpFileCache.getFileCachingEnabled());
                                cache.setMaxAgeSeconds(httpFileCache.getMaxAgeInSeconds());
                                cache.setMaxCacheSizeBytes(httpFileCache.getMediumFileSpaceInBytes());
                                cache.setMaxFilesCount(httpFileCache.getMaxFilesCount());
                                return null;
                            }
                        }, http);
                    }
                }
View Full Code Here

Examples of de.innovationgate.wgpublisher.cache.FileCache

        if (contentType.startsWith("application/")) {
            response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
        }

        // Look if file is cached - If so, send it and exit
        FileCache fileCache = (FileCache) database.getAttribute(WGACore.DBATTRIB_FILECACHE);
        byte[] data = fileCache.getFile(publishingFile, lastModified);
        if (data != null) {
            try {

                // B000041DA
                ByteArrayDataSource dataIn = new ByteArrayDataSource(data, publishingFile.getFileName(), contentType);
                String designEncoding = (String) database.getAttribute(WGACore.DBATTRIB_DESIGN_ENCODING);

                if (designEncoding != null) {
                    writeData(dataIn, request, response, designEncoding, data.length, database.getDbReference(), true);
                }
                else {
                    writeData(dataIn, request, response, null, data.length, database.getDbReference(), true);
                }

            }
            catch (java.net.SocketException exc) {
                _log.warn("Dispatch of cached file request failed bc. of socket error: " + exc.getMessage());
            }
            catch (java.io.IOException exc) {
                if (!exc.getClass().getName().equals("org.apache.catalina.connector.ClientAbortException")) {
                    _log.warn("Dispatch of cached file request failed bc. of IO error: " + exc.getMessage());
                }
            }
            return;
        }

        // In domino native implementations: Change to Master login to retrieve
        // data (Workaround for Domino API Bug)
        String databaseTypeName = database.getTypeName();
        if (databaseTypeName.equals("domino/wgacontentstore/local") || databaseTypeName.equals("domino/custom/local")) {
            WGFactory.getInstance().closeSessions();
            database = _core.openContentDB(path.getDatabaseKey(), null, true);
        }

        long fileSize = publishingFile.getFileSize();

        // Look if file size is below cache threshold - if so, collect data and
        // put into cache, then serve
        long threshold = fileCache.getThreshold();
        if (fileSize != -1 && threshold >= fileSize) {

            // Put into cache
            InputStream inputStream = publishingFile.getInputStream();
            try {
                ByteArrayOutputStream outCache = new ByteArrayOutputStream((int) fileSize);
                WGUtils.inToOut(inputStream, outCache, 2048);
                data = outCache.toByteArray();
                fileCache.putFile(publishingFile, data, lastModified);
            }
            catch (java.net.SocketException exc) {
                _log.warn("Caching of file request failed bc. of socket error: " + exc.getMessage());
            }
            catch (java.io.IOException exc) {
View Full Code Here

Examples of de.innovationgate.wgpublisher.cache.FileCache

        db.setAttribute(DBATTRIB_ITEM_MAPPINGS, new HashMap());
        db.setAttribute(DBATTRIB_PLUGIN_SHORTCUTS, new HashMap());
               
        // Create a file cache object.
        try {
            db.setAttribute(WGACore.DBATTRIB_FILECACHE, new FileCache(db, this));
        }
        catch (CacheException e) {
            getLog().error("Error initializing file cache for database " + db.getDbReference(), e);
        };
       
View Full Code Here

Examples of org.apache.jetspeed.cache.FileCache

        loadMapping();

        this.scanRate = serviceConf.getLong(CONFIG_SCAN_RATE, this.scanRate);
        this.cacheSize= serviceConf.getInt(CONFIG_CACHE_SIZE, this.cacheSize);

        documents = new FileCache(this.scanRate, this.cacheSize);
        documents.addListener(this);
        documents.startFileScanner();


        //Mark that we are done
View Full Code Here

Examples of org.apache.jetspeed.cache.FileCache

        loadMapping();

        this.scanRate = serviceConf.getLong(CONFIG_SCAN_RATE, this.scanRate);
        this.cacheSize= serviceConf.getInt(CONFIG_CACHE_SIZE, this.cacheSize);

        documents = new FileCache(this.scanRate, this.cacheSize);
        documents.addListener(this);
        documents.startFileScanner();


        //Mark that we are done
View Full Code Here

Examples of org.apache.jetspeed.cache.FileCache

        loadMapping();

        this.scanRate = serviceConf.getLong(CONFIG_SCAN_RATE, this.scanRate);
        this.cacheSize= serviceConf.getInt(CONFIG_CACHE_SIZE, this.cacheSize);

        documents = new FileCache(this.scanRate, this.cacheSize);
        documents.addListener(this);
        documents.startFileScanner();


        //Mark that we are done
View Full Code Here

Examples of org.apache.jetspeed.cache.FileCache

        loadMapping();

        this.scanRate = serviceConf.getLong(CONFIG_SCAN_RATE, this.scanRate);
        this.cacheSize= serviceConf.getInt(CONFIG_CACHE_SIZE, this.cacheSize);

        documents = new FileCache(this.scanRate, this.cacheSize);
        documents.addListener(this);
        documents.startFileScanner();


        //Mark that we are done
View Full Code Here

Examples of org.apache.jetspeed.cache.file.FileCache

            webappDestDirFile = new File("target/testdata/" + pagesDirName+"/webapp-ids");
            dirHelper.setBaseDirectory(webappDestDirFile);
            dirHelper.copyFrom(webappPagesDirFile, noCVSorSVNorBackups);

            IdGenerator idGen = new JetspeedIdGenerator(65536,"P-","");
            FileCache cache = new FileCache(10, 12);
           
            DocumentHandler psmlHandler = new CastorFileSystemDocumentHandler(idGen, "/JETSPEED-INF/castor/page-mapping.xml", Page.DOCUMENT_TYPE, PageImpl.class, "target/testdata/" + pagesDirName, cache);
            DocumentHandler linkHandler = new CastorFileSystemDocumentHandler(idGen, "/JETSPEED-INF/castor/page-mapping.xml", Link.DOCUMENT_TYPE, LinkImpl.class, "target/testdata/" + pagesDirName, cache);
            DocumentHandler folderMetaDataHandler = new CastorFileSystemDocumentHandler(idGen, "/JETSPEED-INF/castor/page-mapping.xml", FolderMetaDataImpl.DOCUMENT_TYPE, FolderMetaDataImpl.class, "target/testdata/" + pagesDirName, cache);
            DocumentHandler pageSecurityHandler = new CastorFileSystemDocumentHandler(idGen, "/JETSPEED-INF/castor/page-mapping.xml", PageSecurityImpl.DOCUMENT_TYPE, PageSecurity.class, "target/testdata/" + pagesDirName, cache);
View Full Code Here

Examples of org.apache.jetspeed.cache.file.FileCache

        folderMetaDataDocumentHandler = new CastorFileSystemDocumentHandler(
            "/JETSPEED-INF/castor/page-mapping.xml",
            "folder.metadata",
            FolderMetaDataImpl.class,
            "testdata/pages",
            new FileCache());
           
        Map handlerMap = new HashMap();
        handlerMap.put("folder.metadata", folderMetaDataDocumentHandler);
        DocumentHandlerFactory handlerFactory = new DocumentHandlerFactoryImpl(handlerMap);
        folderMetaDataDocumentHandler.setHandlerFactory(handlerFactory);
View Full Code Here

Examples of org.apache.jetspeed.cache.file.FileCache

            webappDestDirFile = new File("target/testdata/" + pagesDirName+"/webapp-ids");
            dirHelper.setBaseDirectory(webappDestDirFile);
            dirHelper.copyFrom(webappPagesDirFile, noCVSorSVNorBackups);

            IdGenerator idGen = new JetspeedIdGenerator(65536,"P-","");
            FileCache cache = new FileCache(10, 12);
           
            DocumentHandler psmlHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", Page.DOCUMENT_TYPE, PageImpl.class, "target/testdata/" + pagesDirName, cache);
            DocumentHandler linkHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", Link.DOCUMENT_TYPE, LinkImpl.class, "target/testdata/" + pagesDirName, cache);
            DocumentHandler folderMetaDataHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", FolderMetaDataImpl.DOCUMENT_TYPE, FolderMetaDataImpl.class, "target/testdata/" + pagesDirName, cache);
            DocumentHandler pageSecurityHandler = new CastorFileSystemDocumentHandler("/JETSPEED-INF/castor/page-mapping.xml", PageSecurityImpl.DOCUMENT_TYPE, PageSecurity.class, "target/testdata/" + pagesDirName, cache);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.