@Override protected List<ApplicationResource> getSources(ApplicationContext applicationContext) { if (definitions != null) { List<ApplicationResource> result = new LinkedList<>(); for (String definition : definitions) { Collection<ApplicationResource> resources = applicationContext.getResources(definition); if (resources != null) { result.addAll(resources); } } return result; } else { return super.getSources(applicationContext); } }
/** {@inheritDoc} */ @Override protected List<ApplicationResource> getSources(ApplicationContext applicationContext) { List<ApplicationResource> urls = new ArrayList<ApplicationResource>(); urls.addAll(applicationContext .getResources("/WEB-INF/**/tiles-defs*.xml")); urls.add(applicationContext.getResource( "classpath:/org/apache/tiles/classpath-defs.xml")); urls.add(applicationContext.getResource( "classpath:/org/apache/tiles/freemarker-classpath-defs.xml")); urls.add(applicationContext.getResource( "classpath:/org/apache/tiles/velocity-classpath-defs.xml")); return urls; } }
/** {@inheritDoc} */ public Object getContext() { return context.getContext(); }
@Override protected List<ApplicationResource> getSources(ApplicationContext applicationContext) { Collection<ApplicationResource> resources = new ArrayList<>(); Set<String> definitions = getTilesDefinitions(applicationContext.getInitParams()); for (String definition : definitions) { resources.addAll(applicationContext.getResources(definition)); } if (resources.contains(null)) { LOG.warn("Some resources were not found. Definitions: {}. Found resources: {}", definitions, resources); } List<ApplicationResource> filteredResources = new ArrayList<>(); for (ApplicationResource resource : resources) { if (resource != null && Locale.ROOT.equals(resource.getLocale())) { filteredResources.add(resource); } } return filteredResources; }
/** {@inheritDoc} */ public ApplicationResource getResource(String localePath) { return context.getResource(localePath); }
/** * Returns the application scope. * * @return The application scope. */ public Map<String, Object> getApplicationScope() { return applicationContext.getApplicationScope(); }
/** {@inheritDoc} */ public Map<String, String> getInitParams() { return context.getInitParams(); }
try { Collection<ApplicationResource> resources = applicationContext .getResources("classpath*:META-INF/MANIFEST.MF"); ApplicationResource mainResource = applicationContext.getResource("/META-INF/MANIFEST.MF"); if (mainResource != null) { resources.add(mainResource);
/** {@inheritDoc} */ public void setApplicationContext(ApplicationContext applicationContext) { Object context = applicationContext.getContext(); if (context instanceof ServletContext) { this.servletContext = (ServletContext) context; } else { throw new IllegalArgumentException( "The application context does not hold an instance of " + "ServletContext, consider using JuelExpressionFactoryFactory"); } }
/** {@inheritDoc} */ public ApplicationResource getResource(ApplicationResource base, Locale locale) { return context.getResource(base, locale); }
/** {@inheritDoc} */ public Map<String, Object> getApplicationScope() { return context.getApplicationScope(); }
super.registerAttributeRenderers(rendererFactory, applicationContext, container, attributeEvaluatorFactory); Map<String, String> parameters = new HashMap<>(); parameters.putAll(applicationContext.getInitParams()); parameters.putAll(getFreemarkerServletInitParameters(applicationContext)); parameters.put("NoCache", "true");
@Override protected List<ApplicationResource> getSources(ApplicationContext applicationContext) { if (definitions != null) { List<ApplicationResource> result = new LinkedList<>(); for (String definition : definitions) { Collection<ApplicationResource> resources = applicationContext.getResources(definition); if (resources != null) { result.addAll(resources); } } return result; } else { return super.getSources(applicationContext); } }
/** {@inheritDoc} */ @Override protected ApplicationContext createTilesApplicationContext( ApplicationContext preliminaryContext) { return new WildcardServletApplicationContext( (ServletContext) preliminaryContext.getContext()); } }
/** {@inheritDoc} */ @Override protected List<ApplicationResource> getSources(ApplicationContext applicationContext) { List<ApplicationResource> urls = new ArrayList<ApplicationResource>(URL_COUNT); urls.add(applicationContext.getResource("classpath:/org/apache/tiles/test/alt/defs/tiles-alt-defs.xml")); urls.add(applicationContext.getResource("classpath:/org/apache/tiles/test/alt/defs/tiles-alt-freemarker-defs.xml")); urls.add(applicationContext.getResource("classpath:/org/apache/tiles/test/alt/defs/tiles-alt-velocity-defs.xml")); return urls; }
/** * Registers an application context. It will be registered into itself as an * attribute, using the {@link #APPLICATION_CONTEXT_ATTRIBUTE} name. * * @param applicationContext The application context to register. */ public static void register(ApplicationContext applicationContext) { applicationContext.getApplicationScope().put( APPLICATION_CONTEXT_ATTRIBUTE, applicationContext); }
/** {@inheritDoc} */ public Collection<ApplicationResource> getResources(String path) { return context.getResources(path); } }
/** {@inheritDoc} */ @Override protected ApplicationContext createTilesApplicationContext( ApplicationContext preliminaryContext) { return new WildcardServletApplicationContext( (ServletContext) preliminaryContext.getContext()); }
/** * Returns a list containing the resources to be parsed. By default, it returns a * list containing the resource at "/WEB-INF/tiles.xml". * @param applicationContext The Tiles application context. * @return The resources. * @since 2.1.1 */ protected List<ApplicationResource> getSources(ApplicationContext applicationContext) { List<ApplicationResource> retValue = new ArrayList<ApplicationResource>(1); retValue.add(applicationContext.getResource("/WEB-INF/tiles.xml")); return retValue; }
/** * Returns the container to be used in the application registered under a specific key. * * @param context The Tiles application context object to use. * @param key The key under which the container will be stored. * @return The container object. * @since 3.0.0 */ public static TilesContainer getContainer(ApplicationContext context, String key) { if (key == null) { key = CONTAINER_ATTRIBUTE; } return (TilesContainer) context.getApplicationScope().get(key); }