You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2008/03/28 21:02:46 UTC
svn commit: r642355 - in /tiles/framework/trunk:
tiles-core/src/main/java/org/apache/tiles/awareness/
tiles-core/src/main/java/org/apache/tiles/definition/
tiles-core/src/main/java/org/apache/tiles/factory/
tiles-core/src/main/java/org/apache/tiles/imp...
Author: apetrelli
Date: Fri Mar 28 13:02:36 2008
New Revision: 642355
URL: http://svn.apache.org/viewvc?rev=642355&view=rev
Log:
TILES-162
Moved the initialization of URL sources in UrlDefinitionsFactory.
Created "TilesApplicationContextAware" and modified code accordingly.
Added:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesApplicationContextAware.java (with props)
Modified:
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesContextFactoryAware.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/DefinitionsFactory.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/UrlDefinitionsFactory.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainer.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/AbstractBaseAttributeRenderer.java
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/BasicRendererFactory.java
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestReloadableDefinitionsFactory.java
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java
Added: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesApplicationContextAware.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesApplicationContextAware.java?rev=642355&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesApplicationContextAware.java (added)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesApplicationContextAware.java Fri Mar 28 13:02:36 2008
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tiles.awareness;
+
+import org.apache.tiles.TilesApplicationContext;
+
+/**
+ * It represents an object that can have a reference to the
+ * {@link TilesApplicationContext}.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.1.0
+ */
+public interface TilesApplicationContextAware {
+
+ /**
+ * Sets the Tiles application context.
+ *
+ * @param applicationContext The Tiles application context.
+ * @since 2.1.0
+ */
+ void setApplicationContext(TilesApplicationContext applicationContext);
+}
Propchange: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesApplicationContextAware.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesApplicationContextAware.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesContextFactoryAware.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesContextFactoryAware.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesContextFactoryAware.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/awareness/TilesContextFactoryAware.java Fri Mar 28 13:02:36 2008
@@ -20,12 +20,11 @@
*/
package org.apache.tiles.awareness;
-import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.context.TilesContextFactory;
/**
* It represents an object that can have a reference to the
- * {@link TilesContextFactory} and to the {@link TilesApplicationContext}.
+ * {@link TilesContextFactory}.
*
* @version $Rev$ $Date$
* @since 2.1.0
@@ -39,12 +38,4 @@
* @since 2.1.0
*/
void setContextFactory(TilesContextFactory contextFactory);
-
- /**
- * Sets the Tiles application context.
- *
- * @param applicationContext The Tiles application context.
- * @since 2.1.0
- */
- void setApplicationContext(TilesApplicationContext applicationContext);
}
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/DefinitionsFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/DefinitionsFactory.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/DefinitionsFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/DefinitionsFactory.java Fri Mar 28 13:02:36 2008
@@ -53,6 +53,14 @@
"org.apache.tiles.locale.LocaleResolver";
/**
+ * Constant representing the configuration parameter
+ * used to define the tiles definition resources.
+ *
+ * @since 2.1.0
+ */
+ String DEFINITIONS_CONFIG = "org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG";
+
+ /**
* Initializes the DefinitionsFactory and its subcomponents. <p/>
* Implementations may support configuration properties to be passed in via
* the params Map.
@@ -85,7 +93,9 @@
* on locale.
*
* @param source The configuration source for definitions.
+ * @deprecated Let the Definitions Factory load its sources by itself.
*/
+ @Deprecated
void addSource(Object source);
/**
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/UrlDefinitionsFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/UrlDefinitionsFactory.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/UrlDefinitionsFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/UrlDefinitionsFactory.java Fri Mar 28 13:02:36 2008
@@ -23,8 +23,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tiles.Definition;
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.awareness.TilesApplicationContextAware;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.definition.digester.DigesterDefinitionsReader;
+import org.apache.tiles.impl.BasicTilesContainer;
import org.apache.tiles.locale.LocaleResolver;
import org.apache.tiles.locale.impl.DefaultLocaleResolver;
import org.apache.tiles.util.ClassUtil;
@@ -39,6 +42,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
+import java.util.StringTokenizer;
/**
* {@link DefinitionsFactory DefinitionsFactory} implementation
@@ -50,8 +54,15 @@
*
* @version $Rev$ $Date$
*/
-public class UrlDefinitionsFactory
- implements DefinitionsFactory, ReloadableDefinitionsFactory {
+public class UrlDefinitionsFactory implements DefinitionsFactory,
+ ReloadableDefinitionsFactory, TilesApplicationContextAware {
+
+ /**
+ * Compatibility constant.
+ *
+ * @deprecated use {@link DEFINITIONS_CONFIG} to avoid namespace collisions.
+ */
+ private static final String LEGACY_DEFINITIONS_CONFIG = "definitions-config";
/**
* LOG instance for all UrlDefinitionsFactory instances.
@@ -74,6 +85,13 @@
protected Map<String, Long> lastModifiedDates;
/**
+ * The application context.
+ *
+ * @since 2.1.0
+ */
+ protected TilesApplicationContext applicationContext;
+
+ /**
* Contains a list of locales that have been processed.
*/
private List<Locale> processedLocales;
@@ -98,6 +116,11 @@
processedLocales = new ArrayList<Locale>();
}
+ /** {@inheritDoc} */
+ public void setApplicationContext(TilesApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+
/**
* Initializes the DefinitionsFactory and its subcomponents.
* <p/>
@@ -108,6 +131,7 @@
* @throws DefinitionsFactoryException if an initialization error occurs.
*/
public void init(Map<String, String> params) {
+ identifySources(params);
String readerClassName =
params.get(DefinitionsFactory.READER_IMPL_PROPERTY);
@@ -180,6 +204,8 @@
* @param source The configuration source for definitions.
* @throws DefinitionsFactoryException if an invalid source is passed in or
* an error occurs resolving the source to an actual data store.
+ * @deprecated Do not call it, let the Definitions Factory load the sources
+ * by itself.
*/
public void addSource(Object source) {
if (source == null) {
@@ -449,5 +475,79 @@
return true;
}
return status;
+ }
+
+ /**
+ * Detects the sources to load.
+ *
+ * @param initParameters The initialization parameters.
+ * @since 2.1.0
+ */
+ protected void identifySources(Map<String, String> initParameters) {
+ if (applicationContext == null) {
+ throw new IllegalStateException(
+ "The TilesApplicationContext cannot be null");
+ }
+
+ String resourceString = getResourceString(initParameters);
+ List<String> resources = getResourceNames(resourceString);
+
+ try {
+ for (String resource : resources) {
+ URL resourceUrl = applicationContext.getResource(resource);
+ if (resourceUrl != null) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Adding resource '" + resourceUrl + "' to definitions factory.");
+ }
+ sources.add(resourceUrl);
+ } else {
+ LOG.warn("Unable to find configured definition '" + resource + "'");
+ }
+ }
+ } catch (IOException e) {
+ throw new DefinitionsFactoryException("Unable to parse definitions from "
+ + resourceString, e);
+ }
+ }
+
+ /**
+ * Derive the resource string from the initialization parameters. If no
+ * parameter {@link DefinitionsFactory#DEFINITIONS_CONFIG} is available,
+ * attempts to retrieve {@link BasicTilesContainer#DEFINITIONS_CONFIG} and
+ * {@link UrlDefinitionsFactory#LEGACY_DEFINITIONS_CONFIG}. If neither are
+ * available, returns "/WEB-INF/tiles.xml".
+ *
+ * @param parms The initialization parameters.
+ * @return resource string to be parsed.
+ */
+ @SuppressWarnings("deprecation")
+ protected String getResourceString(Map<String, String> parms) {
+ String resourceStr = parms.get(DefinitionsFactory.DEFINITIONS_CONFIG);
+ if (resourceStr == null) {
+ resourceStr = parms.get(BasicTilesContainer.DEFINITIONS_CONFIG);
+ }
+ if (resourceStr == null) {
+ resourceStr = parms.get(UrlDefinitionsFactory.LEGACY_DEFINITIONS_CONFIG);
+ }
+ if (resourceStr == null) {
+ resourceStr = "/WEB-INF/tiles.xml";
+ }
+ return resourceStr;
+ }
+
+ /**
+ * Parse the resourceString into a list of resource paths
+ * which can be loaded by the application context.
+ *
+ * @param resourceString comma seperated resources
+ * @return parsed resources
+ */
+ protected List<String> getResourceNames(String resourceString) {
+ StringTokenizer tokenizer = new StringTokenizer(resourceString, ",");
+ List<String> filenames = new ArrayList<String>(tokenizer.countTokens());
+ while (tokenizer.hasMoreTokens()) {
+ filenames.add(tokenizer.nextToken().trim());
+ }
+ return filenames;
}
}
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/KeyedDefinitionsFactoryTilesContainerFactory.java Fri Mar 28 13:02:36 2008
@@ -23,13 +23,18 @@
import java.util.HashMap;
import java.util.Map;
+import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
+import org.apache.tiles.awareness.TilesApplicationContextAware;
+import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.definition.DefinitionsFactory;
+import org.apache.tiles.evaluator.AttributeEvaluator;
import org.apache.tiles.impl.BasicTilesContainer;
import org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer;
import org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer.KeyExtractor;
import org.apache.tiles.impl.mgmt.CachingKeyedDefinitionsFactoryTilesContainer;
import org.apache.tiles.mgmt.MutableTilesContainer;
+import org.apache.tiles.renderer.RendererFactory;
import org.apache.tiles.util.ClassUtil;
/**
@@ -54,6 +59,13 @@
public static final String KEY_EXTRACTOR_CLASS_INIT_PARAM =
"org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer.KeyExtractor";
+ /**
+ * The application context.
+ *
+ * @since 2.1.0
+ */
+ protected TilesApplicationContext applicationContext;
+
/** {@inheritDoc} */
@Override
public MutableTilesContainer createMutableTilesContainer(Object context) {
@@ -87,6 +99,10 @@
config.putAll(getInitParameterMap(context));
retValue = (DefinitionsFactory) createFactory(config,
DEFINITIONS_FACTORY_INIT_PARAM);
+ if (retValue instanceof TilesApplicationContextAware) {
+ ((TilesApplicationContextAware) retValue)
+ .setApplicationContext(applicationContext);
+ }
return retValue;
}
@@ -105,28 +121,44 @@
((KeyedDefinitionsFactoryTilesContainer) container).setKeyExtractor(
(KeyExtractor) ClassUtil.instantiate(keyExtractorClassName));
}
+ }
+ /** {@inheritDoc} */
+ @Override
+ protected void postCreationOperations(TilesContextFactory contextFactory,
+ TilesApplicationContext tilesContext,
+ RendererFactory rendererFactory, AttributeEvaluator evaluator,
+ Map<String, String> initParameters,
+ Map<String, String> configuration, BasicTilesContainer container) {
+ super.postCreationOperations(contextFactory, tilesContext,
+ rendererFactory, evaluator, initParameters, configuration,
+ container);
+ this.applicationContext = tilesContext;
String keysString = initParameters.get(CONTAINER_KEYS_INIT_PARAM);
if (keysString != null
&& container instanceof KeyedDefinitionsFactoryTilesContainer) {
String[] keys = keysString.split(",");
- Map<String, String> config = new HashMap<String, String>(defaultConfiguration);
- config.putAll(getInitParameterMap(context));
+ Map<String, String> initParams = new HashMap<String, String>(initParameters);
for (int i = 0; i < keys.length; i++) {
- Map<String, String> initParams = new HashMap<String, String>();
String param = initParameters.get(
KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG_PREFIX + keys[i]);
if (param != null) {
- initParams.put(BasicTilesContainer.DEFINITIONS_CONFIG,
+ initParams.put(DefinitionsFactory.DEFINITIONS_CONFIG,
param);
+ } else {
+ initParams.remove(DefinitionsFactory.DEFINITIONS_CONFIG);
}
DefinitionsFactory defsFactory =
- (DefinitionsFactory) createFactory(config,
+ (DefinitionsFactory) createFactory(configuration,
DEFINITIONS_FACTORY_INIT_PARAM);
+ if (defsFactory instanceof TilesApplicationContextAware) {
+ ((TilesApplicationContextAware) defsFactory).setApplicationContext(tilesContext);
+ }
+
+ defsFactory.init(initParams);
((KeyedDefinitionsFactoryTilesContainer) container)
- .setDefinitionsFactory(keys[i], defsFactory,
- initParams);
+ .setDefinitionsFactory(keys[i], defsFactory);
}
}
}
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java Fri Mar 28 13:02:36 2008
@@ -22,6 +22,7 @@
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
+import org.apache.tiles.awareness.TilesApplicationContextAware;
import org.apache.tiles.awareness.TilesContainerAware;
import org.apache.tiles.awareness.TilesContextFactoryAware;
import org.apache.tiles.context.ChainedTilesContextFactory;
@@ -274,26 +275,25 @@
TilesContextFactory contextFactory =
(TilesContextFactory) createFactory(configuration,
CONTEXT_FACTORY_INIT_PARAM);
+ contextFactory.init(configuration);
- DefinitionsFactory defsFactory =
- (DefinitionsFactory) createFactory(configuration,
- DEFINITIONS_FACTORY_INIT_PARAM);
+ TilesApplicationContext tilesContext =
+ contextFactory.createApplicationContext(context);
RendererFactory rendererFactory =
(RendererFactory) createFactory(configuration,
RENDERER_FACTORY_INIT_PARAM);
- contextFactory.init(configuration);
- TilesApplicationContext tilesContext =
- contextFactory.createApplicationContext(context);
-
AttributeEvaluator evaluator = (AttributeEvaluator) createFactory(
configuration, ATTRIBUTE_EVALUATOR_INIT_PARAM);
if (evaluator instanceof TilesContextFactoryAware) {
((TilesContextFactoryAware) evaluator)
.setContextFactory(contextFactory);
- ((TilesContextFactoryAware) evaluator)
+ }
+
+ if (evaluator instanceof TilesApplicationContextAware) {
+ ((TilesApplicationContextAware) evaluator)
.setApplicationContext(tilesContext);
}
@@ -304,7 +304,10 @@
if (rendererFactory instanceof TilesContextFactoryAware) {
((TilesContextFactoryAware) rendererFactory)
.setContextFactory(contextFactory);
- ((TilesContextFactoryAware) rendererFactory)
+ }
+
+ if (rendererFactory instanceof TilesApplicationContextAware) {
+ ((TilesApplicationContextAware) rendererFactory)
.setApplicationContext(tilesContext);
}
@@ -315,17 +318,52 @@
if (rendererFactory instanceof AttributeEvaluatorAware) {
((AttributeEvaluatorAware) rendererFactory).setEvaluator(evaluator);
}
+ rendererFactory.init(initParameters);
PreparerFactory prepFactory =
(PreparerFactory) createFactory(configuration,
PREPARER_FACTORY_INIT_PARAM);
- container.setDefinitionsFactory(defsFactory);
+ postCreationOperations(contextFactory, tilesContext, rendererFactory,
+ evaluator, initParameters, configuration, container);
+
container.setContextFactory(contextFactory);
container.setPreparerFactory(prepFactory);
container.setApplicationContext(tilesContext);
container.setRendererFactory(rendererFactory);
container.setEvaluator(evaluator);
+ }
+
+ /**
+ * After the creation of the elements, it is possible to do other operations that
+ * will be done after the creation and before the assignment to the container.
+ *
+ * @param contextFactory The Tiles context factory.
+ * @param tilesContext The Tiles application context.
+ * @param rendererFactory The renderer factory.
+ * @param evaluator The attribute evaluator.
+ * @param initParameters The initialization parameters.
+ * @param configuration The merged configuration parameters (both defaults
+ * and context ones).
+ * @param container The container to use.
+ * @since 2.1.0
+ */
+ protected void postCreationOperations(TilesContextFactory contextFactory,
+ TilesApplicationContext tilesContext,
+ RendererFactory rendererFactory, AttributeEvaluator evaluator,
+ Map<String, String> initParameters,
+ Map<String, String> configuration, BasicTilesContainer container) {
+ DefinitionsFactory defsFactory =
+ (DefinitionsFactory) createFactory(configuration,
+ DEFINITIONS_FACTORY_INIT_PARAM);
+ if (defsFactory instanceof TilesApplicationContextAware) {
+ ((TilesApplicationContextAware) defsFactory)
+ .setApplicationContext(tilesContext);
+ }
+
+ defsFactory.init(configuration);
+
+ container.setDefinitionsFactory(defsFactory);
}
/**
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java Fri Mar 28 13:02:36 2008
@@ -42,7 +42,6 @@
import java.io.IOException;
import java.io.Writer;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -63,8 +62,11 @@
public class BasicTilesContainer implements TilesContainer {
/**
- * Constant representing the configuration parameter
- * used to define the tiles definition resources.
+ * Constant representing the configuration parameter used to define the
+ * tiles definition resources.
+ *
+ * @deprecated Use
+ * {@link org.apache.tiles.definition.DefinitionsFactory#DEFINITIONS_CONFIG}.
*/
public static final String DEFINITIONS_CONFIG = "org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG";
@@ -139,16 +141,9 @@
LOG.info("Initializing Tiles2 container. . .");
}
- if (rendererFactory != null) {
- rendererFactory.init(initParameters);
- } else {
+ if (rendererFactory == null) {
throw new IllegalStateException("RendererFactory not specified");
}
-
- //Everything is now initialized. We will populate
- // our definitions
- initializeDefinitionsFactory(definitionsFactory, getResourceString(),
- initParameters);
}
/** {@inheritDoc} */
@@ -415,31 +410,15 @@
* resources.
* @param initParameters A map containing the initialization parameters.
* @throws DefinitionsFactoryException If something goes wrong.
+ * @deprecated Do not use, the Definitions Factory should be initialized by
+ * the Tiles Container Factory.
*/
+ @Deprecated
protected void initializeDefinitionsFactory(
DefinitionsFactory definitionsFactory, String resourceString,
Map<String, String> initParameters) {
if (rendererFactory == null) {
throw new IllegalStateException("No RendererFactory found");
- }
-
- List<String> resources = getResourceNames(resourceString);
-
- try {
- for (String resource : resources) {
- URL resourceUrl = context.getResource(resource);
- if (resourceUrl != null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Adding resource '" + resourceUrl + "' to definitions factory.");
- }
- definitionsFactory.addSource(resourceUrl);
- } else {
- LOG.warn("Unable to find configured definition '" + resource + "'");
- }
- }
- } catch (IOException e) {
- throw new DefinitionsFactoryException("Unable to parse definitions from "
- + resourceString, e);
}
definitionsFactory.init(initParameters);
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainer.java Fri Mar 28 13:02:36 2008
@@ -152,14 +152,31 @@
* @param definitionsFactory the definitions factory for this instance.
* @param initParameters The init parameters to configure the definitions
* factory.
+ * @deprecated Use {@link #setDefinitionsFactory(String, DefinitionsFactory)}.
*/
+ @Deprecated
public void setDefinitionsFactory(String key,
DefinitionsFactory definitionsFactory,
Map<String, String> initParameters) {
+ setDefinitionsFactory(key, definitionsFactory);
if (key != null) {
- key2definitionsFactory.put(key, definitionsFactory);
initializeDefinitionsFactory(definitionsFactory,
getResourceString(initParameters), initParameters);
+ }
+ }
+
+ /**
+ * Set the definitions factory. This method first ensures that the container
+ * has not yet been initialized.
+ *
+ * @param key The key under which the definitions factory is catalogued.
+ * @param definitionsFactory the definitions factory for this instance.
+ * @since 2.1.0
+ */
+ public void setDefinitionsFactory(String key,
+ DefinitionsFactory definitionsFactory) {
+ if (key != null) {
+ key2definitionsFactory.put(key, definitionsFactory);
} else {
setDefinitionsFactory(definitionsFactory);
}
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainer.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainer.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainer.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/impl/mgmt/CachingKeyedDefinitionsFactoryTilesContainer.java Fri Mar 28 13:02:36 2008
@@ -99,6 +99,7 @@
/** {@inheritDoc} */
@Override
+ @Deprecated
public void setDefinitionsFactory(String key, DefinitionsFactory definitionsFactory,
Map<String, String> initParameters) {
if (key != null) {
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/AbstractBaseAttributeRenderer.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/AbstractBaseAttributeRenderer.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/AbstractBaseAttributeRenderer.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/AbstractBaseAttributeRenderer.java Fri Mar 28 13:02:36 2008
@@ -29,6 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.tiles.Attribute;
import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.awareness.TilesApplicationContextAware;
import org.apache.tiles.awareness.TilesContextFactoryAware;
import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
@@ -43,7 +44,8 @@
* @since 2.1.0
*/
public abstract class AbstractBaseAttributeRenderer implements
- AttributeRenderer, TilesContextFactoryAware, AttributeEvaluatorAware {
+ AttributeRenderer, TilesContextFactoryAware,
+ TilesApplicationContextAware, AttributeEvaluatorAware {
/**
* The logging object.
Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/BasicRendererFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/BasicRendererFactory.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/BasicRendererFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/renderer/impl/BasicRendererFactory.java Fri Mar 28 13:02:36 2008
@@ -25,6 +25,7 @@
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
+import org.apache.tiles.awareness.TilesApplicationContextAware;
import org.apache.tiles.awareness.TilesContainerAware;
import org.apache.tiles.awareness.TilesContextFactoryAware;
import org.apache.tiles.context.TilesContextFactory;
@@ -42,7 +43,8 @@
* @since 2.1.0
*/
public class BasicRendererFactory implements RendererFactory,
- TilesContainerAware, TilesContextFactoryAware, AttributeEvaluatorAware {
+ TilesContainerAware, TilesContextFactoryAware,
+ TilesApplicationContextAware, AttributeEvaluatorAware {
/**
* The type renderers init parameter name.
@@ -205,9 +207,12 @@
*/
protected void initializeRenderer(AttributeRenderer renderer) {
if (renderer instanceof TilesContextFactoryAware) {
- TilesContextFactoryAware cfaRenderer = (TilesContextFactoryAware) renderer;
- cfaRenderer.setApplicationContext(applicationContext);
- cfaRenderer.setContextFactory(contextFactory);
+ ((TilesContextFactoryAware) renderer)
+ .setContextFactory(contextFactory);
+ }
+ if (renderer instanceof TilesApplicationContextAware) {
+ ((TilesApplicationContextAware) renderer)
+ .setApplicationContext(applicationContext);
}
if (renderer instanceof TilesContainerAware) {
((TilesContainerAware) renderer).setContainer(container);
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestReloadableDefinitionsFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestReloadableDefinitionsFactory.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestReloadableDefinitionsFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestReloadableDefinitionsFactory.java Fri Mar 28 13:02:36 2008
@@ -29,8 +29,11 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
+import java.util.Map;
import org.apache.tiles.Definition;
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.awareness.TilesApplicationContextAware;
import org.apache.tiles.context.TilesRequestContext;
import org.easymock.EasyMock;
@@ -102,6 +105,13 @@
urlPath = "file:/" + url.getPath();
}
+ TilesApplicationContext applicationContext = EasyMock
+ .createMock(TilesApplicationContext.class);
+ EasyMock.expect(applicationContext.getResource(urlPath)).andReturn(url);
+ EasyMock.replay(applicationContext);
+ ((TilesApplicationContextAware) factory)
+ .setApplicationContext(applicationContext);
+
// The following second madness is necessary b/c sometimes spaces
// are encoded as '%20', sometimes they are not. For example in
// Windows 2000 under Eclipse they are encoded, under the prompt of
@@ -133,8 +143,9 @@
writer.write(xml);
writer.close();
- factory.addSource(url);
- factory.init(new HashMap<String, String>());
+ Map<String, String> params = new HashMap<String, String>();
+ params.put(DefinitionsFactory.DEFINITIONS_CONFIG, urlPath);
+ factory.init(params);
TilesRequestContext context = EasyMock.createMock(TilesRequestContext.class);
EasyMock.expect(context.getSessionScope()).andReturn(
new HashMap<String, Object>()).anyTimes();
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java Fri Mar 28 13:02:36 2008
@@ -22,7 +22,6 @@
package org.apache.tiles.definition;
import java.net.URL;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
@@ -32,9 +31,9 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.context.TilesRequestContext;
+import org.easymock.EasyMock;
/**
* Tests the UrlDefinitionsFactory.
@@ -44,12 +43,6 @@
public class TestUrlDefinitionsFactory extends TestCase {
/**
- * The logging object.
- */
- private static final Log LOG =
- LogFactory.getLog(TestUrlDefinitionsFactory.class);
-
- /**
* The number of foreseen URLs with postfixes.
*/
private static final int POSTFIX_COUNT = 3;
@@ -111,10 +104,25 @@
"org/apache/tiles/config/defs3.xml");
assertNotNull("Could not load defs3 file.", url3);
- factory.addSource(url1);
- factory.addSource(url2);
- factory.addSource(url3);
- factory.init(Collections.EMPTY_MAP);
+ TilesApplicationContext applicationContext = EasyMock
+ .createMock(TilesApplicationContext.class);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs1.xml"))
+ .andReturn(url1);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs2.xml"))
+ .andReturn(url2);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs3.xml"))
+ .andReturn(url3);
+ EasyMock.replay(applicationContext);
+ factory.setApplicationContext(applicationContext);
+
+ Map<String, String> params = new HashMap<String, String>();
+ params.put(DefinitionsFactory.DEFINITIONS_CONFIG,
+ "org/apache/tiles/config/defs1.xml,org/apache/tiles/config/defs2.xml,"
+ + "org/apache/tiles/config/defs3.xml");
+ factory.init(params);
// Parse files.
Definitions definitions = factory.getDefinitions();
@@ -142,10 +150,25 @@
"org/apache/tiles/config/defs3.xml");
assertNotNull("Could not load defs3 file.", url3);
- factory.addSource(url1);
- factory.addSource(url2);
- factory.addSource(url3);
- factory.init(Collections.EMPTY_MAP);
+ TilesApplicationContext applicationContext = EasyMock
+ .createMock(TilesApplicationContext.class);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs1.xml"))
+ .andReturn(url1);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs2.xml"))
+ .andReturn(url2);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs3.xml"))
+ .andReturn(url3);
+ EasyMock.replay(applicationContext);
+ factory.setApplicationContext(applicationContext);
+
+ Map<String, String> params = new HashMap<String, String>();
+ params.put(DefinitionsFactory.DEFINITIONS_CONFIG,
+ "org/apache/tiles/config/defs1.xml,org/apache/tiles/config/defs2.xml,"
+ + "org/apache/tiles/config/defs3.xml");
+ factory.init(params);
TilesRequestContext emptyContext = new MockOnlyLocaleTilesContext(null);
TilesRequestContext usContext = new MockOnlyLocaleTilesContext(Locale.US);
@@ -207,26 +230,6 @@
}
/**
- * Tests addSource with a bad source object type.
- *
- * @throws Exception If something goes wrong.
- */
- @SuppressWarnings("unchecked")
- public void testBadSourceType() throws Exception {
- try {
- factory.init(Collections.EMPTY_MAP);
- factory.addSource("Bad object.");
-
- fail("Should've thrown exception.");
- } catch (DefinitionsFactoryException e) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Bad class name intercepted, it is ok", e);
- }
- // success.
- }
- }
-
- /**
* Tests the addDefinitions method under normal
* circumstances.
*
@@ -245,10 +248,25 @@
"org/apache/tiles/config/defs3.xml");
assertNotNull("Could not load defs3 file.", url3);
- factory.addSource(url1);
- factory.addSource(url2);
- factory.addSource(url3);
- factory.init(Collections.EMPTY_MAP);
+ TilesApplicationContext applicationContext = EasyMock
+ .createMock(TilesApplicationContext.class);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs1.xml"))
+ .andReturn(url1);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs2.xml"))
+ .andReturn(url2);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs3.xml"))
+ .andReturn(url3);
+ EasyMock.replay(applicationContext);
+ factory.setApplicationContext(applicationContext);
+
+ Map<String, String> params = new HashMap<String, String>();
+ params.put(DefinitionsFactory.DEFINITIONS_CONFIG,
+ "org/apache/tiles/config/defs1.xml,org/apache/tiles/config/defs2.xml,"
+ + "org/apache/tiles/config/defs3.xml");
+ factory.init(params);
// Parse files.
Definitions definitions = factory.getDefinitions();
@@ -288,8 +306,18 @@
"org/apache/tiles/config/defs1.xml");
assertNotNull("Could not load defs1 file.", url1);
- factory.addSource(url1);
- factory.init(Collections.EMPTY_MAP);
+ TilesApplicationContext applicationContext = EasyMock
+ .createMock(TilesApplicationContext.class);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs1.xml"))
+ .andReturn(url1);
+ EasyMock.replay(applicationContext);
+ factory.setApplicationContext(applicationContext);
+
+ Map<String, String> params = new HashMap<String, String>();
+ params.put(DefinitionsFactory.DEFINITIONS_CONFIG,
+ "org/apache/tiles/config/defs1.xml");
+ factory.init(params);
// Parse files.
Definitions definitions = factory.getDefinitions();
@@ -315,15 +343,24 @@
int instanceCount = MockDefinitionsReader.getInstanceCount();
- DefinitionsFactory factory = new UrlDefinitionsFactory();
+ UrlDefinitionsFactory factory = new UrlDefinitionsFactory();
// Set up multiple data sources.
URL url1 = this.getClass().getClassLoader().getResource(
"org/apache/tiles/config/defs1.xml");
assertNotNull("Could not load defs1 file.", url1);
+ TilesApplicationContext applicationContext = EasyMock
+ .createMock(TilesApplicationContext.class);
+ EasyMock.expect(applicationContext
+ .getResource("org/apache/tiles/config/defs1.xml"))
+ .andReturn(url1);
+ EasyMock.replay(applicationContext);
+ factory.setApplicationContext(applicationContext);
+
+ params.put(DefinitionsFactory.DEFINITIONS_CONFIG,
+ "org/apache/tiles/config/defs1.xml");
factory.init(params);
- factory.addSource(url1);
assertEquals("MockDefinitionsReader not used.",
instanceCount + 1,
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/ELAttributeEvaluatorTest.java Fri Mar 28 13:02:36 2008
@@ -25,7 +25,6 @@
import org.apache.tiles.Attribute;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
import org.easymock.EasyMock;
@@ -52,8 +51,6 @@
protected void setUp() throws Exception {
super.setUp();
evaluator = new ELAttributeEvaluator();
- TilesContextFactory factory = EasyMock
- .createMock(TilesContextFactory.class);
Map<String, Object> requestScope = new HashMap<String, Object>();
Map<String, Object> sessionScope = new HashMap<String, Object>();
Map<String, Object> applicationScope = new HashMap<String, Object>();
@@ -71,7 +68,6 @@
applicationScope).anyTimes();
EasyMock.replay(request, applicationContext);
- evaluator.setContextFactory(factory);
evaluator.setApplicationContext(applicationContext);
}
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/KeyedDefinitionsFactoryTilesContainerTest.java Fri Mar 28 13:02:36 2008
@@ -121,6 +121,7 @@
* @throws MalformedURLException If sources are not valid (that should not
* happen).
*/
+ @SuppressWarnings("deprecation")
public void testPostponedDefinitionsFactoryInitialization() throws MalformedURLException {
KeyedDefinitionsFactoryTilesContainer container;
ServletContext context = EasyMock.createMock(ServletContext.class);
@@ -131,6 +132,7 @@
EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM)).andReturn(null);
EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM)).andReturn(null);
EasyMock.expect(context.getInitParameter(TilesContainerFactory.DEFINITIONS_FACTORY_INIT_PARAM)).andReturn(null);
+ EasyMock.expect(context.getInitParameter(DefinitionsFactory.DEFINITIONS_CONFIG)).andReturn(null);
EasyMock.expect(context.getInitParameter(BasicTilesContainer.DEFINITIONS_CONFIG)).andReturn(null);
EasyMock.expect(context.getInitParameter("definitions-config")).andReturn(null);
EasyMock.expect(context.getInitParameter(TilesContainerFactory
@@ -157,14 +159,16 @@
assertNull(container.getProperDefinitionsFactory("two"));
Map<String, String> initParams = new HashMap<String, String>();
- initParams.put(BasicTilesContainer.DEFINITIONS_CONFIG,
+ initParams.put(DefinitionsFactory.DEFINITIONS_CONFIG,
"/WEB-INF/tiles-one.xml");
DefinitionsFactory defsFactory = factory.createDefinitionsFactory(context);
- container.setDefinitionsFactory("one", defsFactory, initParams);
- initParams.put(BasicTilesContainer.DEFINITIONS_CONFIG,
+ defsFactory.init(initParams);
+ container.setDefinitionsFactory("one", defsFactory);
+ initParams.put(DefinitionsFactory.DEFINITIONS_CONFIG,
"/WEB-INF/tiles-two.xml");
defsFactory = factory.createDefinitionsFactory(context);
- container.setDefinitionsFactory("two", defsFactory, initParams);
+ defsFactory.init(initParams);
+ container.setDefinitionsFactory("two", defsFactory);
assertNotNull(container.getProperDefinitionsFactory("one"));
assertNotNull(container.getProperDefinitionsFactory("two"));
}
Modified: tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java?rev=642355&r1=642354&r2=642355&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java (original)
+++ tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java Fri Mar 28 13:02:36 2008
@@ -20,22 +20,21 @@
*/
package org.apache.tiles.test.preparer;
-import org.apache.tiles.preparer.PreparerException;
import org.apache.tiles.preparer.ViewPreparer;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.AttributeContext;
import org.apache.tiles.Attribute;
/**
- * A <code>ViewPreparer</code> that stores an attribute
+ * A <code>ViewPreparer</code> that stores an attribute.
*
* @version $Rev$ $Date$
*/
public class AttributeViewPreparer implements ViewPreparer {
/** {@inheritDoc} */
- public void execute(TilesRequestContext tilesContext, AttributeContext attributeContext)
- throws PreparerException {
+ public void execute(TilesRequestContext tilesContext,
+ AttributeContext attributeContext) {
attributeContext.putAttribute(
"body",
new Attribute("This is the value added by the AttributeViewPreparer"));