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/11/06 17:08:06 UTC
svn commit: r711885 [2/3] - in /tiles/framework/trunk:
tiles-core/src/main/java/org/apache/tiles/awareness/
tiles-core/src/main/java/org/apache/tiles/context/
tiles-core/src/main/java/org/apache/tiles/context/enhanced/
tiles-core/src/main/java/org/apac...
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/TilesContainerFactoryTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/TilesContainerFactoryTest.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/TilesContainerFactoryTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/factory/TilesContainerFactoryTest.java Thu Nov 6 08:06:38 2008
@@ -29,8 +29,10 @@
import org.apache.commons.logging.LogFactory;
import org.apache.tiles.TilesContainer;
import org.apache.tiles.TilesException;
-import org.apache.tiles.context.ChainedTilesContextFactory;
-import org.apache.tiles.mock.RepeaterTilesContextFactory;
+import org.apache.tiles.context.ChainedTilesApplicationContextFactory;
+import org.apache.tiles.context.ChainedTilesRequestContextFactory;
+import org.apache.tiles.mock.RepeaterTilesApplicationContextFactory;
+import org.apache.tiles.mock.RepeaterTilesRequestContextFactory;
import java.util.Map;
import java.util.Vector;
@@ -69,7 +71,8 @@
Vector<String> v = new Vector<String>();
Vector<String> emptyVector = new Vector<String>();
v.add(AbstractTilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM);
- v.add(ChainedTilesContextFactory.FACTORY_CLASS_NAMES);
+ v.add(ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES);
+ v.add(ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES);
EasyMock.expect(context.getInitParameterNames()).andReturn(
emptyVector.elements());
@@ -91,8 +94,12 @@
AbstractTilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM))
.andReturn(TestFactory.class.getName());
EasyMock.expect(context.getInitParameter(
- ChainedTilesContextFactory.FACTORY_CLASS_NAMES))
- .andReturn(RepeaterTilesContextFactory.class.getName());
+ ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesApplicationContextFactory.class
+ .getName());
+ EasyMock.expect(context.getInitParameter(
+ ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesRequestContextFactory.class.getName());
EasyMock.replay(context);
factory = AbstractTilesContainerFactory
.getTilesContainerFactory(context);
@@ -106,8 +113,12 @@
AbstractTilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM))
.andReturn(TestFactory.class.getName());
EasyMock.expect(context.getInitParameter(
- ChainedTilesContextFactory.FACTORY_CLASS_NAMES))
- .andReturn(RepeaterTilesContextFactory.class.getName());
+ ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesApplicationContextFactory.class
+ .getName());
+ EasyMock.expect(context.getInitParameter(
+ ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesRequestContextFactory.class.getName());
EasyMock.replay(context);
factory = AbstractTilesContainerFactory
.getTilesContainerFactory(context);
@@ -120,8 +131,12 @@
EasyMock.expect(context.getInitParameter(AbstractTilesContainerFactory
.CONTAINER_FACTORY_INIT_PARAM)).andReturn("org.missing.Class");
EasyMock.expect(context.getInitParameter(
- ChainedTilesContextFactory.FACTORY_CLASS_NAMES))
- .andReturn(RepeaterTilesContextFactory.class.getName());
+ ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesApplicationContextFactory.class
+ .getName());
+ EasyMock.expect(context.getInitParameter(
+ ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesRequestContextFactory.class.getName());
EasyMock.replay(context);
try {
AbstractTilesContainerFactory.getTilesContainerFactory(context);
@@ -143,11 +158,19 @@
public void testCreateContainer() throws MalformedURLException {
URL url = getClass().getResource("test-defs.xml");
Vector<String> enumeration = new Vector<String>();
- enumeration.add(ChainedTilesContextFactory.FACTORY_CLASS_NAMES);
+ enumeration.add(ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES);
+ enumeration.add(ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES);
EasyMock.expect(context.getInitParameter(
- ChainedTilesContextFactory.FACTORY_CLASS_NAMES))
- .andReturn(RepeaterTilesContextFactory.class.getName());
- EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM)).andReturn(null);
+ ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesApplicationContextFactory.class
+ .getName());
+ EasyMock.expect(context.getInitParameter(
+ ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesRequestContextFactory.class.getName());
+ EasyMock.expect(context.getInitParameter(TilesContainerFactory
+ .APPLICATION_CONTEXT_FACTORY_INIT_PARAM)).andReturn(null);
+ EasyMock.expect(context.getInitParameter(TilesContainerFactory
+ .REQUEST_CONTEXT_FACTORY_INIT_PARAM)).andReturn(null);
EasyMock.expect(context.getInitParameter(TilesContainerFactory.DEFINITIONS_FACTORY_INIT_PARAM)).andReturn(null);
EasyMock.expect(context.getInitParameter(EasyMock.isA(String.class))).andReturn(null).anyTimes();
EasyMock.expect(context.getInitParameterNames()).andReturn(enumeration.elements()).anyTimes();
@@ -181,8 +204,12 @@
keys.add("two");
EasyMock.expect(context.getInitParameter(
- ChainedTilesContextFactory.FACTORY_CLASS_NAMES))
- .andReturn(RepeaterTilesContextFactory.class.getName());
+ ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesApplicationContextFactory.class
+ .getName());
+ EasyMock.expect(context.getInitParameter(
+ ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesRequestContextFactory.class.getName());
EasyMock.expect(context.getInitParameterNames()).andReturn(keys.elements());
EasyMock.expect(context.getInitParameterNames()).andReturn(keys.elements());
EasyMock.expect(context.getInitParameter("one")).andReturn("oneValue").anyTimes();
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java Thu Nov 6 08:06:38 2008
@@ -34,11 +34,13 @@
import org.apache.commons.logging.LogFactory;
import org.apache.tiles.Attribute;
import org.apache.tiles.TilesException;
-import org.apache.tiles.context.ChainedTilesContextFactory;
+import org.apache.tiles.context.ChainedTilesApplicationContextFactory;
+import org.apache.tiles.context.ChainedTilesRequestContextFactory;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.factory.AbstractTilesContainerFactory;
import org.apache.tiles.factory.TilesContainerFactory;
-import org.apache.tiles.mock.RepeaterTilesContextFactory;
+import org.apache.tiles.mock.RepeaterTilesApplicationContextFactory;
+import org.apache.tiles.mock.RepeaterTilesRequestContextFactory;
import org.easymock.EasyMock;
@@ -71,11 +73,16 @@
URL url = getClass().getResource("/org/apache/tiles/factory/test-defs.xml");
Vector<String> v = new Vector<String>();
- v.add(ChainedTilesContextFactory.FACTORY_CLASS_NAMES);
+ v.add(ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES);
+ v.add(ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES);
EasyMock.expect(context.getInitParameter(
- ChainedTilesContextFactory.FACTORY_CLASS_NAMES))
- .andReturn(RepeaterTilesContextFactory.class.getName());
+ ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesApplicationContextFactory.class
+ .getName());
+ EasyMock.expect(context.getInitParameter(
+ ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesRequestContextFactory.class.getName());
EasyMock.expect(context.getInitParameter(
AbstractTilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM)).andReturn(null);
EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM)).andReturn(null);
@@ -100,7 +107,7 @@
*/
public void testInitialization() {
assertNotNull(container);
- assertNotNull(container.getContextFactory());
+ assertNotNull(container.getRequestContextFactory());
assertNotNull(container.getPreparerFactory());
assertNotNull(container.getDefinitionsFactory());
}
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=711885&r1=711884&r2=711885&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 Thu Nov 6 08:06:38 2008
@@ -33,14 +33,16 @@
import junit.framework.TestCase;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.context.ChainedTilesContextFactory;
+import org.apache.tiles.context.ChainedTilesApplicationContextFactory;
+import org.apache.tiles.context.ChainedTilesRequestContextFactory;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.definition.DefinitionsFactory;
import org.apache.tiles.factory.AbstractTilesContainerFactory;
import org.apache.tiles.factory.KeyedDefinitionsFactoryTilesContainerFactory;
import org.apache.tiles.factory.TilesContainerFactory;
import org.apache.tiles.impl.KeyedDefinitionsFactoryTilesContainer.DefaultKeyExtractor;
-import org.apache.tiles.mock.RepeaterTilesContextFactory;
+import org.apache.tiles.mock.RepeaterTilesApplicationContextFactory;
+import org.apache.tiles.mock.RepeaterTilesRequestContextFactory;
import org.apache.tiles.util.RollingVectorEnumeration;
import org.easymock.EasyMock;
@@ -73,7 +75,8 @@
+ "one");
v.add(KeyedDefinitionsFactoryTilesContainer.DEFINITIONS_CONFIG_PREFIX
+ "two");
- v.add(ChainedTilesContextFactory.FACTORY_CLASS_NAMES);
+ v.add(ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES);
+ v.add(ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES);
Map<String, String> initParameters = new HashMap<String, String>();
EasyMock.expect(context.getInitParams()).andReturn(initParameters);
@@ -84,10 +87,17 @@
.getName());
EasyMock.expect(context.getInitParameter(TilesContainerFactory
.CONTAINER_FACTORY_MUTABLE_INIT_PARAM)).andReturn(null);
- EasyMock.expect(context.getInitParameter(TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM)).andReturn(null);
+ EasyMock.expect(context.getInitParameter(TilesContainerFactory
+ .APPLICATION_CONTEXT_FACTORY_INIT_PARAM)).andReturn(null);
+ EasyMock.expect(context.getInitParameter(TilesContainerFactory
+ .REQUEST_CONTEXT_FACTORY_INIT_PARAM)).andReturn(null);
+ EasyMock.expect(context.getInitParameter(
+ ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesApplicationContextFactory.class
+ .getName());
EasyMock.expect(context.getInitParameter(
- ChainedTilesContextFactory.FACTORY_CLASS_NAMES))
- .andReturn(RepeaterTilesContextFactory.class.getName());
+ ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesRequestContextFactory.class.getName());
EasyMock.expect(context.getInitParameter(TilesContainerFactory.DEFINITIONS_FACTORY_INIT_PARAM)).andReturn(null);
EasyMock.expect(context.getInitParameter(
KeyedDefinitionsFactoryTilesContainerFactory.CONTAINER_KEYS_INIT_PARAM))
@@ -104,8 +114,11 @@
AbstractTilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM,
KeyedDefinitionsFactoryTilesContainerFactory.class.getName());
initParameters.put(
- ChainedTilesContextFactory.FACTORY_CLASS_NAMES,
- RepeaterTilesContextFactory.class.getName());
+ ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES,
+ RepeaterTilesApplicationContextFactory.class.getName());
+ initParameters.put(
+ ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES,
+ RepeaterTilesRequestContextFactory.class.getName());
initParameters.put(
KeyedDefinitionsFactoryTilesContainerFactory.CONTAINER_KEYS_INIT_PARAM,
"one,two");
@@ -147,7 +160,7 @@
*/
public void testInitialization() {
assertNotNull(container);
- assertNotNull(container.getContextFactory());
+ assertNotNull(container.getRequestContextFactory());
assertNotNull(container.getPreparerFactory());
assertNotNull(container.getDefinitionsFactory());
assertNotNull(container.getProperDefinitionsFactory("one"));
@@ -169,15 +182,20 @@
Vector<String> v = new Vector<String>();
v.add(AbstractTilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM);
- v.add(ChainedTilesContextFactory.FACTORY_CLASS_NAMES);
+ v.add(ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES);
+ v.add(ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES);
EasyMock.expect(context.getInitParameter(
AbstractTilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM))
.andReturn(KeyedDefinitionsFactoryTilesContainerFactory.class.getName())
.anyTimes();
EasyMock.expect(context.getInitParameter(
- ChainedTilesContextFactory.FACTORY_CLASS_NAMES))
- .andReturn(RepeaterTilesContextFactory.class.getName());
+ ChainedTilesApplicationContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesApplicationContextFactory.class
+ .getName());
+ EasyMock.expect(context.getInitParameter(
+ ChainedTilesRequestContextFactory.FACTORY_CLASS_NAMES))
+ .andReturn(RepeaterTilesRequestContextFactory.class.getName());
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);
Added: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesApplicationContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesApplicationContextFactory.java?rev=711885&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesApplicationContextFactory.java (added)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesApplicationContextFactory.java Thu Nov 6 08:06:38 2008
@@ -0,0 +1,107 @@
+/*
+ * $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.mock;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.context.TilesApplicationContextFactory;
+
+/**
+ * "Repeats" (i.e. returns back) the context as a
+ * {@link TilesApplicationContext}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RepeaterTilesApplicationContextFactory implements
+ TilesApplicationContextFactory {
+
+ /**
+ * The application context.
+ */
+ private TilesApplicationContext applicationContext;
+
+ /**
+ * Constructor.
+ */
+ public RepeaterTilesApplicationContextFactory() {
+ applicationContext = new MockTilesApplicationContext();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param applicationContext The application context to use.
+ */
+ public RepeaterTilesApplicationContextFactory(
+ TilesApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+
+ /** {@inheritDoc} */
+ public TilesApplicationContext createApplicationContext(Object context) {
+ if (context instanceof TilesApplicationContext) {
+ return (TilesApplicationContext) context;
+ } else {
+ return applicationContext;
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void init(Map<String, String> configurationParameters) {
+ // Do nothing
+ }
+
+ /**
+ * Empty application context that does nothing.
+ */
+ public class MockTilesApplicationContext implements TilesApplicationContext {
+
+ /** {@inheritDoc} */
+ public Map<String, Object> getApplicationScope() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ public Object getContext() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ public Map<String, String> getInitParams() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ public URL getResource(String path) throws IOException {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ public Set<URL> getResources(String path) throws IOException {
+ return null;
+ }
+
+ }
+}
Propchange: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesRequestContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesRequestContextFactory.java?rev=711885&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesRequestContextFactory.java (added)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesRequestContextFactory.java Thu Nov 6 08:06:38 2008
@@ -0,0 +1,68 @@
+/*
+ * $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.mock;
+
+import java.util.Map;
+
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.awareness.TilesRequestContextFactoryAware;
+import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
+
+/**
+ * "Repeats" (i.e. returns back) the context as a
+ * {@link TilesApplicationContext}, or the request as a
+ * {@link TilesRequestContext}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RepeaterTilesRequestContextFactory implements TilesRequestContextFactory,
+ TilesRequestContextFactoryAware {
+
+ /**
+ * The parent context factory.
+ */
+ private TilesRequestContextFactory parent;
+
+ /** {@inheritDoc} */
+ public void setRequestContextFactory(
+ TilesRequestContextFactory contextFactory) {
+ this.parent = contextFactory;
+ }
+
+ /** {@inheritDoc} */
+ public TilesRequestContext createRequestContext(
+ TilesApplicationContext context, Object... requestItems) {
+ if (parent == null) {
+ throw new RuntimeException("The parent is null");
+ }
+ TilesRequestContext retValue = null;
+ if (requestItems.length > 0) {
+ retValue = (TilesRequestContext) requestItems[0];
+ }
+ return retValue;
+ }
+
+ /** {@inheritDoc} */
+ public void init(Map<String, String> configurationParameters) {
+ // Do nothing
+ }
+}
Propchange: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesRequestContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/mock/RepeaterTilesRequestContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/AbstractBaseAttributeRendererTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/AbstractBaseAttributeRendererTest.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/AbstractBaseAttributeRendererTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/AbstractBaseAttributeRendererTest.java Thu Nov 6 08:06:38 2008
@@ -26,15 +26,15 @@
import java.util.HashSet;
import java.util.Set;
+import junit.framework.TestCase;
+
import org.apache.tiles.Attribute;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.evaluator.impl.DirectAttributeEvaluator;
import org.easymock.EasyMock;
-import junit.framework.TestCase;
-
/**
* Tests {@link AbstractBaseAttributeRenderer}.
*
@@ -59,8 +59,8 @@
* {@link AbstractBaseAttributeRenderer#setContextFactory(TilesContextFactory)}.
*/
public void testSetContextFactory() {
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
EasyMock.replay(contextFactory);
renderer.setRequestContextFactory(contextFactory);
assertNotNull("The context factory is null", renderer.contextFactory);
@@ -89,8 +89,8 @@
StringWriter writer = new StringWriter();
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesRequestContext requestContext = EasyMock
.createMock(TilesRequestContext.class);
EasyMock.expect(contextFactory.createRequestContext(applicationContext))
@@ -109,8 +109,8 @@
public void testGetRequestContext() {
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesRequestContext requestContext = EasyMock
.createMock(TilesRequestContext.class);
EasyMock.expect(contextFactory.createRequestContext(applicationContext))
@@ -129,8 +129,8 @@
public void testIsPermitted() {
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesRequestContext requestContext = EasyMock
.createMock(TilesRequestContext.class);
EasyMock.expect(contextFactory.createRequestContext(applicationContext))
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/BasicRendererFactoryTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/BasicRendererFactoryTest.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/BasicRendererFactoryTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/BasicRendererFactoryTest.java Thu Nov 6 08:06:38 2008
@@ -25,7 +25,7 @@
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
-import org.apache.tiles.context.TilesContextFactory;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.renderer.AttributeRenderer;
import org.easymock.EasyMock;
@@ -50,8 +50,8 @@
rendererFactory = new BasicRendererFactory();
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesContainer container = EasyMock.createMock(TilesContainer.class);
rendererFactory.setApplicationContext(applicationContext);
rendererFactory.setRequestContextFactory(contextFactory);
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/DefinitionAttributeRendererTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/DefinitionAttributeRendererTest.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/DefinitionAttributeRendererTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/DefinitionAttributeRendererTest.java Thu Nov 6 08:06:38 2008
@@ -26,8 +26,8 @@
import org.apache.tiles.Attribute;
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
-import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.evaluator.impl.DirectAttributeEvaluator;
import org.easymock.EasyMock;
@@ -63,8 +63,8 @@
Attribute attribute = new Attribute("my.definition", null, "definition");
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesContainer container = EasyMock.createMock(TilesContainer.class);
TilesRequestContext requestContext = EasyMock
.createMock(TilesRequestContext.class);
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/StringAttributeRendererTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/StringAttributeRendererTest.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/StringAttributeRendererTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/StringAttributeRendererTest.java Thu Nov 6 08:06:38 2008
@@ -25,8 +25,8 @@
import org.apache.tiles.Attribute;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.evaluator.impl.DirectAttributeEvaluator;
import org.easymock.EasyMock;
@@ -62,8 +62,8 @@
Attribute attribute = new Attribute("Result", null, "string");
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesRequestContext requestContext = EasyMock
.createMock(TilesRequestContext.class);
EasyMock.expect(contextFactory.createRequestContext(applicationContext))
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/TemplateAttributeRendererTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/TemplateAttributeRendererTest.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/TemplateAttributeRendererTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/TemplateAttributeRendererTest.java Thu Nov 6 08:06:38 2008
@@ -25,8 +25,8 @@
import org.apache.tiles.Attribute;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.evaluator.impl.DirectAttributeEvaluator;
import org.easymock.EasyMock;
@@ -62,8 +62,8 @@
Attribute attribute = new Attribute("/myTemplate.jsp", null, "template");
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesRequestContext requestContext = EasyMock
.createMock(TilesRequestContext.class);
EasyMock.expect(contextFactory.createRequestContext(applicationContext))
Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/UntypedAttributeRendererTest.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/UntypedAttributeRendererTest.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/UntypedAttributeRendererTest.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/renderer/impl/UntypedAttributeRendererTest.java Thu Nov 6 08:06:38 2008
@@ -26,8 +26,8 @@
import org.apache.tiles.Attribute;
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
-import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.evaluator.impl.DirectAttributeEvaluator;
import org.easymock.EasyMock;
@@ -64,8 +64,8 @@
Attribute attribute = new Attribute("my.definition", null, "definition");
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesContainer container = EasyMock.createMock(TilesContainer.class);
TilesRequestContext requestContext = EasyMock
.createMock(TilesRequestContext.class);
@@ -95,8 +95,8 @@
Attribute attribute = new Attribute("Result", null, "string");
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesContainer container = EasyMock.createMock(TilesContainer.class);
TilesRequestContext requestContext = EasyMock
.createMock(TilesRequestContext.class);
@@ -125,8 +125,8 @@
Attribute attribute = new Attribute("/myTemplate.jsp", null, "template");
TilesApplicationContext applicationContext = EasyMock
.createMock(TilesApplicationContext.class);
- TilesContextFactory contextFactory = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory contextFactory = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesContainer container = EasyMock.createMock(TilesContainer.class);
TilesRequestContext requestContext = EasyMock
.createMock(TilesRequestContext.class);
Modified: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java Thu Nov 6 08:06:38 2008
@@ -21,76 +21,40 @@
package org.apache.tiles.jsp.context;
-import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.awareness.TilesRequestContextFactoryAware;
-import org.apache.tiles.context.TilesContextFactory;
-import org.apache.tiles.context.TilesRequestContext;
-import org.apache.tiles.context.TilesRequestContextFactory;
-import org.apache.tiles.servlet.context.ServletTilesApplicationContext;
-import org.apache.tiles.servlet.context.ServletTilesRequestContext;
import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.PageContext;
-import java.util.Map;
+
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.servlet.context.ServletTilesContextFactory;
/**
* Creates an instance of the appropriate TilesApplicationContext implementation.
*
* @version $Rev$ $Date$
+ * @deprecated Use {@link JspTilesRequestContextFactory}.
*/
-public class JspTilesContextFactory implements TilesContextFactory,
- TilesRequestContextFactoryAware {
+public class JspTilesContextFactory extends ServletTilesContextFactory {
/**
- * Parent Tiles context factory.
+ * The real factory.
*/
- private TilesRequestContextFactory parent;
+ private JspTilesRequestContextFactory factory;
- /** {@inheritDoc} */
- public void init(Map<String, String> configParameters) {
- }
-
- /** {@inheritDoc} */
- public void setRequestContextFactory(
- TilesRequestContextFactory contextFactory) {
- parent = contextFactory;
- }
-
- /** {@inheritDoc} */
+ /**
+ * Constructor.
+ *
+ * @deprecated Do not use! No replacement.
+ */
@Deprecated
- public TilesApplicationContext createApplicationContext(Object context) {
- if (context instanceof ServletContext) {
- ServletContext servletContext = (ServletContext) context;
- return new ServletTilesApplicationContext(servletContext);
- }
-
- return null;
+ public JspTilesContextFactory() {
+ factory = new JspTilesRequestContextFactory();
}
/** {@inheritDoc} */
public TilesRequestContext createRequestContext(TilesApplicationContext context,
Object... requestItems) {
- if (requestItems.length == 1 && requestItems[0] instanceof PageContext) {
- PageContext pageContext = (PageContext) requestItems[0];
- ServletRequest request = pageContext.getRequest();
- ServletResponse response = pageContext.getResponse();
- TilesRequestContext enclosedRequest;
- if (parent != null) {
- enclosedRequest = parent.createRequestContext(context, request,
- response);
- } else {
- enclosedRequest = new ServletTilesRequestContext(context,
- (HttpServletRequest) request,
- (HttpServletResponse) response);
- }
- return new JspTilesRequestContext(enclosedRequest, pageContext);
- }
-
- return null;
+ return factory.createRequestContext(context, requestItems);
}
/**
Added: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactory.java?rev=711885&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactory.java (added)
+++ tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactory.java Thu Nov 6 08:06:38 2008
@@ -0,0 +1,83 @@
+/*
+ * $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.jsp.context;
+
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.awareness.TilesRequestContextFactoryAware;
+import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
+import org.apache.tiles.servlet.context.ServletTilesRequestContext;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.PageContext;
+import java.util.Map;
+
+/**
+ * Creates an instance of the appropriate {@link TilesRequestContext}
+ * implementation under a JSP environment.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.1.1
+ */
+public class JspTilesRequestContextFactory implements TilesRequestContextFactory,
+ TilesRequestContextFactoryAware {
+
+ /**
+ * Parent Tiles context factory.
+ */
+ private TilesRequestContextFactory parent;
+
+ /** {@inheritDoc} */
+ public void init(Map<String, String> configParameters) {
+ }
+
+ /** {@inheritDoc} */
+ public void setRequestContextFactory(
+ TilesRequestContextFactory contextFactory) {
+ parent = contextFactory;
+ }
+
+ /** {@inheritDoc} */
+ public TilesRequestContext createRequestContext(
+ TilesApplicationContext context, Object... requestItems) {
+ if (requestItems.length == 1 && requestItems[0] instanceof PageContext) {
+ PageContext pageContext = (PageContext) requestItems[0];
+ ServletRequest request = pageContext.getRequest();
+ ServletResponse response = pageContext.getResponse();
+ TilesRequestContext enclosedRequest;
+ if (parent != null) {
+ enclosedRequest = parent.createRequestContext(context, request,
+ response);
+ } else {
+ enclosedRequest = new ServletTilesRequestContext(context,
+ (HttpServletRequest) request,
+ (HttpServletResponse) response);
+ }
+ return new JspTilesRequestContext(enclosedRequest, pageContext);
+ }
+
+ return null;
+ }
+}
Propchange: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: tiles/framework/trunk/tiles-jsp/src/test/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactoryTest.java (from r711831, tiles/framework/trunk/tiles-jsp/src/test/java/org/apache/tiles/jsp/context/JspTilesContextFactoryTest.java)
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/test/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactoryTest.java?p2=tiles/framework/trunk/tiles-jsp/src/test/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactoryTest.java&p1=tiles/framework/trunk/tiles-jsp/src/test/java/org/apache/tiles/jsp/context/JspTilesContextFactoryTest.java&r1=711831&r2=711885&rev=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-jsp/src/test/java/org/apache/tiles/jsp/context/JspTilesContextFactoryTest.java (original)
+++ tiles/framework/trunk/tiles-jsp/src/test/java/org/apache/tiles/jsp/context/JspTilesRequestContextFactoryTest.java Thu Nov 6 08:06:38 2008
@@ -26,29 +26,29 @@
import javax.servlet.jsp.PageContext;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.servlet.context.ServletTilesRequestContext;
import org.easymock.classextension.EasyMock;
import junit.framework.TestCase;
/**
- * Tests {@link JspTilesContextFactory}.
+ * Tests {@link JspTilesRequestContextFactory}.
*
* @version $Rev: 657919 $ $Date: 2008-05-19 20:52:49 +0200 (lun, 19 mag 2008) $
*/
-public class JspTilesContextFactoryTest extends TestCase {
+public class JspTilesRequestContextFactoryTest extends TestCase {
/**
* The object under test.
*/
- private JspTilesContextFactory factory;
+ private JspTilesRequestContextFactory factory;
/** {@inheritDoc} */
@Override
protected void setUp() throws Exception {
- factory = new JspTilesContextFactory();
+ factory = new JspTilesRequestContextFactory();
}
/**
@@ -90,8 +90,8 @@
EasyMock.expect(pageContext.getRequest()).andReturn(httpRequest);
EasyMock.expect(pageContext.getResponse()).andReturn(httpResponse);
- TilesContextFactory parent = EasyMock
- .createMock(TilesContextFactory.class);
+ TilesRequestContextFactory parent = EasyMock
+ .createMock(TilesRequestContextFactory.class);
TilesRequestContext enclosedRequest = EasyMock
.createMock(TilesRequestContext.class);
EasyMock.expect(parent.createRequestContext(context, httpRequest,
Added: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContextFactory.java?rev=711885&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContextFactory.java (added)
+++ tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContextFactory.java Thu Nov 6 08:06:38 2008
@@ -0,0 +1,54 @@
+/*
+ * $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.portlet.context;
+
+import java.util.Map;
+
+import javax.portlet.PortletContext;
+
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.context.TilesApplicationContextFactory;
+
+/**
+ * Creates an instance of the appropriate {@link TilesApplicationContext}
+ * implementation under a portlet environment.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.1.1
+ */
+public class PortletTilesApplicationContextFactory implements
+ TilesApplicationContextFactory {
+
+ /** {@inheritDoc} */
+ public void init(Map<String, String> configParameters) {
+ }
+
+ /** {@inheritDoc} */
+ public TilesApplicationContext createApplicationContext(Object context) {
+ if (context instanceof PortletContext) {
+ PortletContext portletContext = (PortletContext) context;
+ return new PortletTilesApplicationContext(portletContext);
+ }
+
+ return null;
+ }
+}
Propchange: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesContextFactory.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesContextFactory.java (original)
+++ tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesContextFactory.java Thu Nov 6 08:06:38 2008
@@ -31,9 +31,12 @@
import java.util.Map;
/**
- * Creates an instance of the appropriate TilesApplicationContext implementation.
+ * Creates an instance of the appropriate TilesApplicationContext
+ * implementation.
*
* @version $Rev$ $Date$
+ * @deprecated Use {@link PortletTilesApplicationContextFactory} or
+ * {@link PortletTilesRequestContextFactory}.
*/
public class PortletTilesContextFactory implements TilesContextFactory {
@@ -71,7 +74,11 @@
*
* @param context The application context.
* @return The original portlet context, if found.
+ * @deprecated Use
+ * {@link PortletTilesRequestContextFactory#getPortletContext(TilesApplicationContext)}
+ * .
*/
+ @Deprecated
protected PortletContext getPortletContext(TilesApplicationContext context) {
if (context instanceof PortletTilesApplicationContext) {
PortletTilesApplicationContext app = (PortletTilesApplicationContext) context;
Added: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContextFactory.java?rev=711885&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContextFactory.java (added)
+++ tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContextFactory.java Thu Nov 6 08:06:38 2008
@@ -0,0 +1,75 @@
+/*
+ * $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.portlet.context;
+
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
+
+import javax.portlet.PortletContext;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import java.util.Map;
+
+/**
+ * Creates an instance of the appropriate {@link TilesRequestContext}
+ * implementation under a portlet environment.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.1.1
+ */
+public class PortletTilesRequestContextFactory implements
+ TilesRequestContextFactory {
+
+ /** {@inheritDoc} */
+ public void init(Map<String, String> configParameters) {
+ }
+
+ /** {@inheritDoc} */
+ public TilesRequestContext createRequestContext(TilesApplicationContext context,
+ Object... requestItems) {
+ if (requestItems.length == 2) {
+ PortletContext portletContext = getPortletContext(context);
+ if (portletContext != null) {
+ return new PortletTilesRequestContext(context, portletContext,
+ (PortletRequest) requestItems[0],
+ (PortletResponse) requestItems[1]);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the original portlet context.
+ *
+ * @param context The application context.
+ * @return The original portlet context, if found.
+ */
+ protected PortletContext getPortletContext(TilesApplicationContext context) {
+ if (context instanceof PortletTilesApplicationContext) {
+ PortletTilesApplicationContext app = (PortletTilesApplicationContext) context;
+ return app.getPortletContext();
+ }
+ return null;
+ }
+}
Propchange: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/PortletTilesRequestContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactory.java (from r701320, tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesContextFactory.java)
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactory.java?p2=tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactory.java&p1=tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesContextFactory.java&r1=701320&r2=711885&rev=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesContextFactory.java (original)
+++ tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactory.java Thu Nov 6 08:06:38 2008
@@ -24,17 +24,17 @@
import javax.portlet.PortletContext;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.portlet.context.PortletTilesContextFactory;
+import org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory;
/**
- * Acts like {@link ServletTilesContextFactory}, except in the
- * {@link #createApplicationContext(Object)} method that creates an instance of
- * {@link WildcardPortletTilesApplicationContext}.
+ * In the {@link #createApplicationContext(Object)} method creates an instance
+ * of {@link WildcardPortletTilesApplicationContext}.
*
* @version $Rev$ $Date$
+ * @since 2.1.1
*/
-public class WildcardPortletTilesContextFactory extends
- PortletTilesContextFactory {
+public class WildcardPortletTilesApplicationContextFactory extends
+ PortletTilesApplicationContextFactory {
/** {@inheritDoc} */
@Override
Propchange: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: tiles/framework/trunk/tiles-portlet/src/main/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactoryTest.java (from r701320, tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesContextFactoryTest.java)
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactoryTest.java?p2=tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactoryTest.java&p1=tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesContextFactoryTest.java&r1=701320&r2=711885&rev=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesContextFactoryTest.java (original)
+++ tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactoryTest.java Thu Nov 6 08:06:38 2008
@@ -29,14 +29,14 @@
import junit.framework.TestCase;
/**
- * Tests {@link WildcardPortletTilesContextFactory}.
+ * Tests {@link WildcardPortletTilesApplicationContextFactory}.
*/
-public class WildcardPortletTilesContextFactoryTest extends TestCase {
+public class WildcardPortletTilesApplicationContextFactoryTest extends TestCase {
/**
* The factory to test.
*/
- private WildcardPortletTilesContextFactory factory;
+ private WildcardPortletTilesApplicationContextFactory factory;
/**
* The servlet context.
@@ -46,13 +46,13 @@
/** {@inheritDoc} */
public void setUp() {
servletContext = EasyMock.createMock(PortletContext.class);
- factory = new WildcardPortletTilesContextFactory();
+ factory = new WildcardPortletTilesApplicationContextFactory();
EasyMock.replay(servletContext);
}
/**
* Test method for
- * {@link org.apache.tiles.servlet.context.wildcard.WildcardPortletTilesContextFactory
+ * {@link org.apache.tiles.servlet.context.wildcard.WildcardPortletTilesApplicationContextFactory
* #createApplicationContext(java.lang.Object)}.
*/
public void testCreateApplicationContext() {
Propchange: tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactoryTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: tiles/framework/trunk/tiles-portlet/src/test/java/org/apache/tiles/portlet/context/wildcard/WildcardPortletTilesApplicationContextFactoryTest.java
------------------------------------------------------------------------------
svn:mergeinfo =
Added: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContextFactory.java?rev=711885&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContextFactory.java (added)
+++ tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContextFactory.java Thu Nov 6 08:06:38 2008
@@ -0,0 +1,52 @@
+/*
+ * $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.servlet.context;
+
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.context.TilesApplicationContextFactory;
+
+import javax.servlet.ServletContext;
+import java.util.Map;
+
+/**
+ * Creates an instance of the appropriate TilesApplicationContext implementation
+ * under a servlet environment.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.1.1
+ */
+public class ServletTilesApplicationContextFactory implements
+ TilesApplicationContextFactory {
+
+ /** {@inheritDoc} */
+ public void init(Map<String, String> configParameters) {
+ }
+
+ /** {@inheritDoc} */
+ public TilesApplicationContext createApplicationContext(Object context) {
+ if (context instanceof ServletContext) {
+ ServletContext servletContext = (ServletContext) context;
+ return new ServletTilesApplicationContext(servletContext);
+ }
+ return null;
+ }
+}
Propchange: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesContextFactory.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesContextFactory.java (original)
+++ tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesContextFactory.java Thu Nov 6 08:06:38 2008
@@ -22,46 +22,74 @@
package org.apache.tiles.servlet.context;
import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.context.TilesApplicationContextFactory;
import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
- * Creates an instance of the appropriate TilesApplicationContext implementation.
+ * Creates an instance of the appropriate TilesApplicationContext
+ * implementation.
*
* @version $Rev$ $Date$
+ * @deprecated Use {@link ServletTilesApplicationContext} or
+ * {@link ServletTilesRequestContext}.
*/
+/**
+ * @author PTRNTN77A26E506O
+ *
+ */
+/**
+ * @author PTRNTN77A26E506O
+ *
+ */
+/**
+ * @author PTRNTN77A26E506O
+ *
+ */
+@Deprecated
public class ServletTilesContextFactory implements TilesContextFactory {
+ /**
+ * The application context factory.
+ */
+ private TilesApplicationContextFactory contextFactory;
+
+ /**
+ * The request context factory.
+ */
+ private TilesRequestContextFactory requestContextFactory;
+
+ /**
+ * Constructor.
+ *
+ * @deprecated Do not use! No replacement.
+ */
+ @Deprecated
+ public ServletTilesContextFactory() {
+ contextFactory = new ServletTilesApplicationContextFactory();
+ requestContextFactory = new ServletTilesRequestContextFactory();
+ }
+
/** {@inheritDoc} */
public void init(Map<String, String> configParameters) {
+ contextFactory.init(configParameters);
+ requestContextFactory.init(configParameters);
}
/** {@inheritDoc} */
public TilesApplicationContext createApplicationContext(Object context) {
- if (context instanceof ServletContext) {
- ServletContext servletContext = (ServletContext) context;
- return new ServletTilesApplicationContext(servletContext);
- }
- return null;
+ return contextFactory.createApplicationContext(context);
}
/** {@inheritDoc} */
public TilesRequestContext createRequestContext(TilesApplicationContext context,
Object... requestItems) {
- if (requestItems.length == 2
- && requestItems[0] instanceof HttpServletRequest
- && requestItems[1] instanceof HttpServletResponse) {
- return new ServletTilesRequestContext(context,
- (HttpServletRequest) requestItems[0],
- (HttpServletResponse) requestItems[1]);
- }
-
- return null;
+ return requestContextFactory
+ .createRequestContext(context, requestItems);
}
/**
@@ -71,6 +99,7 @@
* @return The original servlet context, if found.
* @deprecated Use {@link TilesApplicationContext#getContext()}.
*/
+ @Deprecated
protected ServletContext getServletContext(TilesApplicationContext context) {
if (context instanceof ServletTilesApplicationContext) {
ServletTilesApplicationContext app = (ServletTilesApplicationContext) context;
Added: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContextFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContextFactory.java?rev=711885&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContextFactory.java (added)
+++ tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContextFactory.java Thu Nov 6 08:06:38 2008
@@ -0,0 +1,59 @@
+/*
+ * $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.servlet.context;
+
+import org.apache.tiles.TilesApplicationContext;
+import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.context.TilesRequestContextFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * Creates an instance of the appropriate {@link TilesRequestContext}
+ * implementation in a servlet environment.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.1.1
+ */
+public class ServletTilesRequestContextFactory implements
+ TilesRequestContextFactory {
+
+ /** {@inheritDoc} */
+ public void init(Map<String, String> configParameters) {
+ }
+
+ /** {@inheritDoc} */
+ public TilesRequestContext createRequestContext(TilesApplicationContext context,
+ Object... requestItems) {
+ if (requestItems.length == 2
+ && requestItems[0] instanceof HttpServletRequest
+ && requestItems[1] instanceof HttpServletResponse) {
+ return new ServletTilesRequestContext(context,
+ (HttpServletRequest) requestItems[0],
+ (HttpServletResponse) requestItems[1]);
+ }
+
+ return null;
+ }
+}
Propchange: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/ServletTilesRequestContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactory.java (from r701320, tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesContextFactory.java)
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactory.java?p2=tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactory.java&p1=tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesContextFactory.java&r1=701320&r2=711885&rev=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesContextFactory.java (original)
+++ tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactory.java Thu Nov 6 08:06:38 2008
@@ -21,23 +21,28 @@
package org.apache.tiles.servlet.context.wildcard;
+import java.util.Map;
+
import javax.servlet.ServletContext;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.servlet.context.ServletTilesContextFactory;
+import org.apache.tiles.context.TilesApplicationContextFactory;
/**
- * Acts like {@link ServletTilesContextFactory}, except in the
- * {@link #createApplicationContext(Object)} method that creates an instance of
- * {@link WildcardServletTilesApplicationContext}.
+ * In the {@link #createApplicationContext(Object)} method creates an instance
+ * of {@link WildcardServletTilesApplicationContext}.
*
* @version $Rev$ $Date$
+ * @since 2.1.1
*/
-public class WildcardServletTilesContextFactory extends
- ServletTilesContextFactory {
+public class WildcardServletTilesApplicationContextFactory implements TilesApplicationContextFactory {
+
+ /** {@inheritDoc} */
+ public void init(Map<String, String> params) {
+ // Does nothing.
+ }
/** {@inheritDoc} */
- @Override
public TilesApplicationContext createApplicationContext(Object context) {
if (context instanceof ServletContext) {
ServletContext servletContext = (ServletContext) context;
Propchange: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: tiles/framework/trunk/tiles-servlet/src/main/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactory.java
------------------------------------------------------------------------------
svn:mergeinfo =
Copied: tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactoryTest.java (from r701320, tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesContextFactoryTest.java)
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactoryTest.java?p2=tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactoryTest.java&p1=tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesContextFactoryTest.java&r1=701320&r2=711885&rev=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesContextFactoryTest.java (original)
+++ tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactoryTest.java Thu Nov 6 08:06:38 2008
@@ -29,14 +29,14 @@
import junit.framework.TestCase;
/**
- * Tests {@link WildcardServletTilesContextFactory}.
+ * Tests {@link WildcardServletTilesApplicationContextFactory}.
*/
-public class WildcardServletTilesContextFactoryTest extends TestCase {
+public class WildcardServletTilesApplicationContextFactoryTest extends TestCase {
/**
* The factory to test.
*/
- private WildcardServletTilesContextFactory factory;
+ private WildcardServletTilesApplicationContextFactory factory;
/**
* The servlet context.
@@ -46,13 +46,13 @@
/** {@inheritDoc} */
public void setUp() {
servletContext = EasyMock.createMock(ServletContext.class);
- factory = new WildcardServletTilesContextFactory();
+ factory = new WildcardServletTilesApplicationContextFactory();
EasyMock.replay(servletContext);
}
/**
* Test method for
- * {@link org.apache.tiles.servlet.context.wildcard.WildcardServletTilesContextFactory
+ * {@link org.apache.tiles.servlet.context.wildcard.WildcardServletTilesApplicationContextFactory
* #createApplicationContext(java.lang.Object)}.
*/
public void testCreateApplicationContext() {
Propchange: tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactoryTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: tiles/framework/trunk/tiles-servlet/src/test/java/org/apache/tiles/servlet/context/wildcard/WildcardServletTilesApplicationContextFactoryTest.java
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: tiles/framework/trunk/tiles-test/pom.xml
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/pom.xml?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/pom.xml (original)
+++ tiles/framework/trunk/tiles-test/pom.xml Thu Nov 6 08:06:38 2008
@@ -126,7 +126,7 @@
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
- <version>1.0-20080724.220124-9</version>
+ <version>1.0-beta-1</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
Modified: tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestAlternateTilesContainerFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestAlternateTilesContainerFactory.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestAlternateTilesContainerFactory.java (original)
+++ tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestAlternateTilesContainerFactory.java Thu Nov 6 08:06:38 2008
@@ -27,7 +27,7 @@
import java.util.List;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.context.TilesContextFactory;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.definition.DefinitionsFactoryException;
import org.apache.tiles.definition.LocaleDefinitionsFactory;
import org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO;
@@ -50,7 +50,7 @@
@Override
protected List<URL> getSourceURLs(Object context,
TilesApplicationContext applicationContext,
- TilesContextFactory contextFactory) {
+ TilesRequestContextFactory contextFactory) {
List<URL> urls = new ArrayList<URL>(URL_COUNT);
try {
urls.add(applicationContext.getResource("/WEB-INF/tiles-alt-defs.xml"));
@@ -65,7 +65,7 @@
@Override
protected LocaleDefinitionsFactory instantiateDefinitionsFactory(
Object context, TilesApplicationContext applicationContext,
- TilesContextFactory contextFactory, LocaleResolver resolver) {
+ TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
return new LocaleDefinitionsFactory();
}
@@ -73,7 +73,7 @@
@Override
protected BaseLocaleUrlDefinitionDAO instantiateLocaleDefinitionDao(
Object context, TilesApplicationContext applicationContext,
- TilesContextFactory contextFactory, LocaleResolver resolver) {
+ TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
return new CachingLocaleUrlDefinitionDAO();
}
}
Modified: tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestDbTilesContainerFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestDbTilesContainerFactory.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestDbTilesContainerFactory.java (original)
+++ tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestDbTilesContainerFactory.java Thu Nov 6 08:06:38 2008
@@ -26,7 +26,7 @@
import javax.sql.DataSource;
import org.apache.tiles.TilesApplicationContext;
-import org.apache.tiles.context.TilesContextFactory;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.definition.LocaleDefinitionsFactory;
import org.apache.tiles.definition.dao.DefinitionDAO;
import org.apache.tiles.factory.BasicTilesContainerFactory;
@@ -44,7 +44,7 @@
@Override
protected DefinitionDAO<Locale> createLocaleDefinitionDao(Object context,
TilesApplicationContext applicationContext,
- TilesContextFactory contextFactory, LocaleResolver resolver) {
+ TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
LocaleDbDefinitionDAO definitionDao = new LocaleDbDefinitionDAO();
definitionDao.setDataSource((DataSource) applicationContext
.getApplicationScope().get("dataSource"));
@@ -55,7 +55,7 @@
@Override
protected LocaleDefinitionsFactory instantiateDefinitionsFactory(
Object context, TilesApplicationContext applicationContext,
- TilesContextFactory contextFactory, LocaleResolver resolver) {
+ TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
return new LocaleDefinitionsFactory();
}
}
Modified: tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestTilesContainerFactory.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestTilesContainerFactory.java?rev=711885&r1=711884&r2=711885&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestTilesContainerFactory.java (original)
+++ tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/factory/TestTilesContainerFactory.java Thu Nov 6 08:06:38 2008
@@ -36,8 +36,9 @@
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
import org.apache.tiles.compat.definition.digester.CompatibilityDigesterDefinitionsReader;
-import org.apache.tiles.context.ChainedTilesContextFactory;
-import org.apache.tiles.context.TilesContextFactory;
+import org.apache.tiles.context.ChainedTilesApplicationContextFactory;
+import org.apache.tiles.context.TilesApplicationContextFactory;
+import org.apache.tiles.context.TilesRequestContextFactory;
import org.apache.tiles.definition.DefinitionsFactoryException;
import org.apache.tiles.definition.DefinitionsReader;
import org.apache.tiles.evaluator.AttributeEvaluator;
@@ -47,10 +48,9 @@
import org.apache.tiles.factory.BasicTilesContainerFactory;
import org.apache.tiles.impl.BasicTilesContainer;
import org.apache.tiles.impl.mgmt.CachingTilesContainer;
-import org.apache.tiles.jsp.context.JspTilesContextFactory;
import org.apache.tiles.locale.LocaleResolver;
import org.apache.tiles.renderer.impl.BasicRendererFactory;
-import org.apache.tiles.servlet.context.wildcard.WildcardServletTilesContextFactory;
+import org.apache.tiles.servlet.context.wildcard.WildcardServletTilesApplicationContextFactory;
import org.apache.tiles.test.evaluator.el.MultiversionExpressionFactoryFactory;
import org.apache.tiles.test.renderer.ReverseStringAttributeRenderer;
@@ -79,14 +79,11 @@
/** {@inheritDoc} */
@Override
- protected void registerChainedContextFactories(Object context,
- ChainedTilesContextFactory contextFactory) {
- List<TilesContextFactory> factories = new ArrayList<TilesContextFactory>(
+ protected void registerChainedApplicationContextFactories(Object context,
+ ChainedTilesApplicationContextFactory contextFactory) {
+ List<TilesApplicationContextFactory> factories = new ArrayList<TilesApplicationContextFactory>(
CONTEXT_FACTORY_CHAIN_COUNT);
- factories.add(new WildcardServletTilesContextFactory());
- JspTilesContextFactory factory = new JspTilesContextFactory();
- factory.setRequestContextFactory(contextFactory);
- factories.add(factory);
+ factories.add(new WildcardServletTilesApplicationContextFactory());
contextFactory.setFactories(factories);
}
@@ -95,7 +92,7 @@
protected void registerAttributeRenderers(
BasicRendererFactory rendererFactory, Object context,
TilesApplicationContext applicationContext,
- TilesContextFactory contextFactory, TilesContainer container,
+ TilesRequestContextFactory contextFactory, TilesContainer container,
AttributeEvaluator evaluator) {
super.registerAttributeRenderers(rendererFactory, context, applicationContext,
contextFactory, container, evaluator);
@@ -110,7 +107,7 @@
@Override
protected AttributeEvaluator createEvaluator(Object context,
TilesApplicationContext applicationContext,
- TilesContextFactory contextFactory, LocaleResolver resolver) {
+ TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
ELAttributeEvaluator evaluator = new ELAttributeEvaluator();
evaluator.setApplicationContext(applicationContext);
MultiversionExpressionFactoryFactory efFactory = new MultiversionExpressionFactoryFactory();
@@ -135,7 +132,7 @@
@Override
protected List<URL> getSourceURLs(Object context,
TilesApplicationContext applicationContext,
- TilesContextFactory contextFactory) {
+ TilesRequestContextFactory contextFactory) {
List<URL> urls = new ArrayList<URL>(URL_COUNT);
try {
Set<URL> urlSet = applicationContext
@@ -159,7 +156,7 @@
@Override
protected DefinitionsReader createDefinitionsReader(Object context,
TilesApplicationContext applicationContext,
- TilesContextFactory contextFactory) {
+ TilesRequestContextFactory contextFactory) {
return new CompatibilityDigesterDefinitionsReader();
}
}