Package jetbrick.template.resource

Examples of jetbrick.template.resource.Resource


     *
     * @throws ResourceNotFoundException
     */
    public Resource getResource(String name) throws ResourceNotFoundException {
        name = PathUtils.getStandardizedName(name);
        Resource resource = resourceCache.get(name);
        if (resource == null) {
            throw new ResourceNotFoundException(name);
        }
        return resource;
    }
View Full Code Here


     * <p>返回的对象内部没有缓存,每次都会重新进行解析和编译,如果需要缓存,请在外面直接实现。</p>
     *
     * @since 1.1.0
     */
    public JetTemplate createTemplate(String source) {
        Resource resource = new SourceCodeResource(source);
        return new JetTemplate(this, resource);
    }
View Full Code Here

    }

    private class ConcurrentTemplateCache extends ConcurrentCache<String, JetTemplate> {
        @Override
        protected JetTemplate doGetValue(String name) {
            Resource resource = JetEngine.this.getResource(name);
            return new JetTemplate(JetEngine.this, resource);
        }
View Full Code Here

    public static String asReadContent(JetPageContext ctx, String relativeName, String encoding) {
        if (relativeName == null || relativeName.length() == 0) {
            throw new IllegalArgumentException("argument relativeName is null or empty.");
        }
        String file = ctx.getAbsolutionName(relativeName);
        Resource resource = ctx.getEngine().getResource(file);
        if (encoding == null) {
            encoding = ctx.getEngine().getConfig().getOutputEncoding();
        }
        return new String(resource.getSource(encoding));
    }
View Full Code Here

    }

    @Override
    public Resource load(String name) {
        for (ResourceLoader loader : loaders) {
            Resource resource = loader.load(name);
            if (resource != null) {
                return resource;
            }
        }
        return null;
View Full Code Here

TOP

Related Classes of jetbrick.template.resource.Resource

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.