Package org.jpublish

Examples of org.jpublish.RepositoryWrapper


        BeanModel req = (BeanModel) env.getVariable("request");
        BeanModel jpr = (BeanModel) env.getVariable("pages");

        final HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
        final ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
        final RepositoryWrapper wrapper = (RepositoryWrapper) jpr.getWrappedObject();
        final String contextName = ctx.getServletContextName();
        final long expireTime = this.getExpireTime(args);
        final String include = this.getInclude(args);

        return new Writer(writer) {
            public void write(char cbuf[], int off, int len) throws IOException {
                writer.write(cbuf, off, len);
            }

            public void flush() throws IOException {
                writer.flush();
            }

            public void close() throws IOException {
                Debug.log("Checking for cached content (" + contextName + "." + include + ")", module);
                String content = (String) pageCache.get(contextName + "." + include);
                if (content == null) {
                    content =  wrapper.get(include);
                    pageCache.put(contextName + "." + include, content, expireTime);
                    Debug.log("No content found; cached result for - " + expireTime, module);
                }
                if (content != null) {
                    writer.write(content);
View Full Code Here


        BeanModel req = (BeanModel) env.getVariable("request");
        BeanModel jpr = (BeanModel) env.getVariable("pages");

        final HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
        final ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
        final RepositoryWrapper wrapper = (RepositoryWrapper) jpr.getWrappedObject();
        final String contextName = ctx.getServletContextName();
        final long expireTime = this.getExpireTime(args);
        final String include = this.getInclude(args);

        return new Writer(writer) {
            public void write(char cbuf[], int off, int len) throws IOException {
                writer.write(cbuf, off, len);
            }

            public void flush() throws IOException {
                writer.flush();
            }

            public void close() throws IOException {
                Debug.logInfo("Checking for cached content (" + contextName + "." + include + ")", module);
                String content = (String) pageCache.get(contextName + "." + include);
                if (content == null) {
                    content =  wrapper.get(include);
                    pageCache.put(contextName + "." + include, content, expireTime);
                    Debug.logInfo("No content found; cached result for - " + expireTime, module);
                }
                if (content != null) {
                    writer.write(content);
View Full Code Here

        // add the repositories to the context
        Iterator repositories = siteContext.getRepositories().iterator();
        while (repositories.hasNext()) {
            Repository repository = (Repository) repositories.next();
            context.put(repository.getName(), new RepositoryWrapper(repository, context));
            // add the fs_repository also as the name 'pages' so we can use existing logic in pages
            // note this is a hack and we should look at doing this a different way; but first need
            // to investigate how to get content from different repositories
            if (repository.getName().equals("fs_repository")) {
                context.put("pages", new RepositoryWrapper(repository, context));
            }
        }

        try {
            if (executePreEvaluationActions(request, response, context, path))
View Full Code Here

        BeanModel req = (BeanModel) env.getVariable("request");
        BeanModel jpr = (BeanModel) env.getVariable("pages");

        final HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
        final ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
        final RepositoryWrapper wrapper = (RepositoryWrapper) jpr.getWrappedObject();
        final String contextName = ctx.getServletContextName();
        final long expireTime = this.getExpireTime(args);
        final String include = this.getInclude(args);

        return new Writer(writer) {
            public void write(char cbuf[], int off, int len) throws IOException {
                writer.write(cbuf, off, len);
            }

            public void flush() throws IOException {
                writer.flush();
            }

            public void close() throws IOException {
                Debug.log("Checking for cached content (" + contextName + "." + include + ")", module);
                String content = (String) pageCache.get(contextName + "." + include);
                if (content == null) {
                    content =  wrapper.get(include);
                    pageCache.put(contextName + "." + include, content, expireTime);
                    Debug.log("No content found; cached result for - " + expireTime, module);
                }
                if (content != null) {
                    writer.write(content);
View Full Code Here

        BeanModel req = (BeanModel) env.getVariable("request");
        BeanModel jpr = (BeanModel) env.getVariable("pages");

        final HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
        final ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
        final RepositoryWrapper wrapper = (RepositoryWrapper) jpr.getWrappedObject();
        final String contextName = ctx.getServletContextName();
        final long expireTime = this.getExpireTime(args);
        final String include = this.getInclude(args);

        return new Writer(writer) {
            public void write(char cbuf[], int off, int len) throws IOException {
                writer.write(cbuf, off, len);
            }

            public void flush() throws IOException {
                writer.flush();
            }

            public void close() throws IOException {
                Debug.log("Checking for cached content (" + contextName + "." + include + ")", module);
                String content = (String) pageCache.get(contextName + "." + include);
                if (content == null) {
                    content =  wrapper.get(include);
                    pageCache.put(contextName + "." + include, content, expireTime);
                    Debug.log("No content found; cached result for - " + expireTime, module);
                }
                if (content != null) {
                    writer.write(content);
View Full Code Here

        // add the repositories to the context
        Iterator repositories = siteContext.getRepositories().iterator();
        while (repositories.hasNext()) {
            Repository repository = (Repository) repositories.next();
            context.put(repository.getName(), new RepositoryWrapper(repository, context));
            // add the fs_repository also as the name 'pages' so we can use existing logic in pages
            // note this is a hack and we should look at doing this a different way; but first need
            // to investigate how to get content from different repositories
            if (repository.getName().equals("fs_repository")) {
                context.put("pages", new RepositoryWrapper(repository, context));
            }
        }

        try {
            if (executePreEvaluationActions(request, response, context, path))
View Full Code Here

        // add the repositories to the context
        Iterator repositories = siteContext.getRepositories().iterator();
        while (repositories.hasNext()) {
            Repository repository = (Repository) repositories.next();
            context.put(repository.getName(), new RepositoryWrapper(repository, context));
            // add the fs_repository also as the name 'pages' so we can use existing logic in pages
            // note this is a hack and we should look at doing this a different way; but first need
            // to investigate how to get content from different repositories
            if (repository.getName().equals("fs_repository")) {
                context.put("pages", new RepositoryWrapper(repository, context));
            }
        }

        try {
            if (executePreEvaluationActions(request, response, context, path))
View Full Code Here

TOP

Related Classes of org.jpublish.RepositoryWrapper

Copyright © 2018 www.massapicom. 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.