You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/04/19 20:33:14 UTC
svn commit: r649837 [1/2] - in /tapestry/tapestry5/trunk/tapestry-core/src:
main/java/org/apache/tapestry/ main/java/org/apache/tapestry/corelib/base/
main/java/org/apache/tapestry/internal/services/
main/java/org/apache/tapestry/services/ main/resourc...
Author: hlship
Date: Sat Apr 19 11:33:09 2008
New Revision: 649837
URL: http://svn.apache.org/viewvc?rev=649837&view=rev
Log:
TAPESTRY-2364: YSlow Recommendation: Write Scripts at bottom of page
Added:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinker.java
- copied, changed from r648325, tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentHeadBuilder.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinkerImpl.java
- copied, changed from r648325, tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentHeadBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/DocumentLinkerImplTest.java
- copied, changed from r648325, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/DocumentHeadBuilderImplTest.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/PageRenderSupport.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryConstants.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Validator.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClientBehaviorSupportImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageRenderSupportImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/FieldValidatorDefaultSource.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js
tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageRenderSupportImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/add_script_links.txt
tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/internal/services/duplicate_script_links_ignored.txt
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/PageRenderSupport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/PageRenderSupport.java?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/PageRenderSupport.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/PageRenderSupport.java Sat Apr 19 11:33:09 2008
@@ -101,11 +101,12 @@
void addInit(String functionName, JSONObject parameter);
/**
- * Alternate version of {@link #addInit(String, org.apache.tapestry.json.JSONArray)} where just a single string is
- * passed.
+ * Alternate version of {@link #addInit(String, org.apache.tapestry.json.JSONArray)} where one or more strings are
+ * passed. A single string is added to the initialization call as itself; otherwise, the parameters are combined to
+ * form a {@link JSONArray}.
*
* @param functionName the name of the function (on the client-side Tapestry object) to invoke.
- * @param parameter the single string to pass to the function
+ * @param parameters
*/
- void addInit(String functionName, String parameter);
+ void addInit(String functionName, String... parameters);
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryConstants.java?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryConstants.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryConstants.java Sat Apr 19 11:33:09 2008
@@ -52,6 +52,22 @@
*/
public static final String PROP_BINDING_PREFIX = "prop";
+ public static final String NULLFIELDSTRATEGY_BINDING_PREFIX = "nullfieldstrategy";
+
+ public static final String COMPONENT_BINDING_PREFIX = "component";
+
+ public static final String MESSAGE_BINDING_PREFIX = "message";
+
+ public static final String VALIDATE_BINDING_PREFIX = "validate";
+
+ public static final String TRANSLATE_BINDING_PREFIX = "translate";
+
+ public static final String BLOCK_BINDING_PREFIX = "block";
+
+ public static final String ASSET_BINDING_PREFIX = "asset";
+
+ public static final String VAR_BINDING_PREFIX = "var";
+
/**
* Meta data key applied to pages that sets the response content type. A factory default provides the value
* "text/html" when not overridden.
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Validator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Validator.java?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Validator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/Validator.java Sat Apr 19 11:33:09 2008
@@ -53,9 +53,9 @@
String getMessageKey();
/**
- * Invoked after the client-submitted value has been {@link Translator translated} to check that the value conforms
- * to expectations (often, in terms of minimum or maximum value). If and only if the value is approved by all
- * Validators is the value applied by the field.
+ * Invoked after the client-submitted value has been {@link org.apache.tapestry.Translator translated} to check that
+ * the value conforms to expectations (often, in terms of minimum or maximum value). If and only if the value is
+ * approved by all Validators is the value applied by the field.
*
* @param field the field for which a client submitted value is being validated
* @param constraintValue the value used to constrain
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java Sat Apr 19 11:33:09 2008
@@ -65,7 +65,7 @@
* The object that will perform input validation (which occurs after translation). The translate binding prefix is
* generally used to provide this object in a declarative fashion.
*/
- @Parameter(defaultPrefix = "validate")
+ @Parameter(defaultPrefix = TapestryConstants.VALIDATE_BINDING_PREFIX)
@SuppressWarnings("unchecked")
private FieldValidator<Object> _validate;
@@ -83,7 +83,7 @@
* replace the nulls with some other value. The default strategy leaves nulls alone. Another built-in strategy,
* zero, replaces nulls with the value 0.
*/
- @Parameter(defaultPrefix = "nullfieldstrategy", value = "default")
+ @Parameter(defaultPrefix = TapestryConstants.NULLFIELDSTRATEGY_BINDING_PREFIX, value = "default")
private NullFieldStrategy _nulls;
@Environmental
@@ -132,7 +132,7 @@
}
/**
- * Computes a default value for the "validate" parameter using {@link FieldValidatorDefaultSource}.
+ * Computes a default value for the "validate" parameter using {@link org.apache.tapestry.services.FieldValidatorDefaultSource}.
*/
final FieldValidator defaultValidate()
{
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClientBehaviorSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClientBehaviorSupportImpl.java?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClientBehaviorSupportImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ClientBehaviorSupportImpl.java Sat Apr 19 11:33:09 2008
@@ -130,7 +130,15 @@
*/
public void commit()
{
- if (_validations.length() > 0)
- _pageRenderSupport.addScript("Tapestry.initValidations(%s);", _validations);
+ for (String field : _validations.keys())
+ {
+ JSONArray specs = _validations.getJSONArray(field);
+
+ JSONArray parameters = new JSONArray();
+ parameters.put(field);
+ parameters.put(specs);
+
+ _pageRenderSupport.addInit("validate", parameters);
+ }
}
}
Copied: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinker.java (from r648325, tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentHeadBuilder.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinker.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinker.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentHeadBuilder.java&r1=648325&r2=649837&rev=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentHeadBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinker.java Sat Apr 19 11:33:09 2008
@@ -15,12 +15,14 @@
package org.apache.tapestry.internal.services;
/**
- * Responsible for injecting script and style links into the <head> element of the rendered HTML document.
+ * Responsible for injecting script and style links into the <head> and <body> element of the rendered HTML
+ * document.
*/
-public interface DocumentHeadBuilder
+public interface DocumentLinker
{
/**
- * Adds a link to load a script. Scripts will be loaded only once.
+ * Adds a link to load a script. Scripts will be loaded only once. The <script> elements will be added at the
+ * bottom of the <body> element.
*/
void addScriptLink(String scriptURL);
Copied: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinkerImpl.java (from r648325, tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentHeadBuilderImpl.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinkerImpl.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinkerImpl.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentHeadBuilderImpl.java&r1=648325&r2=649837&rev=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentHeadBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/DocumentLinkerImpl.java Sat Apr 19 11:33:09 2008
@@ -23,7 +23,7 @@
import java.util.List;
import java.util.Set;
-public class DocumentHeadBuilderImpl implements DocumentHeadBuilder
+public class DocumentLinkerImpl implements DocumentLinker
{
private final List<String> _scripts = newList();
@@ -118,11 +118,11 @@
if (body == null) return;
- for (int i = 0; i < _scripts.size(); i++)
- {
- String scriptURL = _scripts.get(i);
+ // TAPESTRY-2364
- body.elementAt(i, "script", "src", scriptURL, "type", "text/javascript");
+ for (String scriptURL : _scripts)
+ {
+ body.element("script", "src", scriptURL, "type", "text/javascript");
}
if (_scriptBlock.length() > 0)
Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java?rev=649837&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java Sat Apr 19 11:33:09 2008
@@ -0,0 +1,233 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed 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.tapestry.internal.services;
+
+import org.apache.tapestry.TapestryConstants;
+import org.apache.tapestry.internal.structure.PageResourcesSource;
+import org.apache.tapestry.internal.structure.PageResourcesSourceImpl;
+import static org.apache.tapestry.ioc.IOCConstants.PERTHREAD_SCOPE;
+import org.apache.tapestry.ioc.ObjectLocator;
+import org.apache.tapestry.ioc.ServiceBinder;
+import org.apache.tapestry.ioc.ServiceResources;
+import org.apache.tapestry.ioc.annotations.Marker;
+import org.apache.tapestry.ioc.annotations.Scope;
+import org.apache.tapestry.ioc.annotations.Symbol;
+import org.apache.tapestry.ioc.services.Builtin;
+import org.apache.tapestry.ioc.services.ClassFactory;
+import org.apache.tapestry.ioc.services.PerthreadManager;
+import org.apache.tapestry.services.*;
+import org.slf4j.Logger;
+
+import javax.servlet.http.Cookie;
+
+/**
+ * {@link org.apache.tapestry.services.TapestryModule} has gotten too complicated and it is nice to demarkate public
+ * (and stable) from internal (and volatile).
+ */
+@Marker(Core.class)
+public class InternalModule
+{
+ private final UpdateListenerHub _updateListenerHub;
+ private final ComponentInstantiatorSource _componentInstantiatorSource;
+ private final ComponentTemplateSource _componentTemplateSource;
+ private final RequestGlobals _requestGlobals;
+
+ public InternalModule(UpdateListenerHub updateListenerHub, ComponentInstantiatorSource componentInstantiatorSource,
+ ComponentTemplateSource componentTemplateSource, RequestGlobals requestGlobals)
+ {
+ _updateListenerHub = updateListenerHub;
+ _componentInstantiatorSource = componentInstantiatorSource;
+ _componentTemplateSource = componentTemplateSource;
+ _requestGlobals = requestGlobals;
+ }
+
+
+ /**
+ * Bind all the private/internal services of Tapestry.
+ */
+ public static void bind(ServiceBinder binder)
+ {
+ binder.bind(PersistentFieldManager.class, PersistentFieldManagerImpl.class);
+ binder.bind(TemplateParser.class, TemplateParserImpl.class);
+ binder.bind(PageResponseRenderer.class, PageResponseRendererImpl.class);
+ binder.bind(PageMarkupRenderer.class, PageMarkupRendererImpl.class);
+ binder.bind(ComponentInvocationMap.class, NoOpComponentInvocationMap.class);
+ binder.bind(UpdateListenerHub.class, UpdateListenerHubImpl.class);
+ binder.bind(LinkFactory.class, LinkFactoryImpl.class);
+ binder.bind(LocalizationSetter.class, LocalizationSetterImpl.class);
+ binder.bind(PageElementFactory.class, PageElementFactoryImpl.class);
+ binder.bind(ResourceStreamer.class, ResourceStreamerImpl.class);
+ binder.bind(ClientPersistentFieldStorage.class, ClientPersistentFieldStorageImpl.class);
+ binder.bind(RequestEncodingInitializer.class, RequestEncodingInitializerImpl.class);
+ binder.bind(PageRenderQueue.class, PageRenderQueueImpl.class);
+ binder.bind(AjaxPartialResponseRenderer.class, AjaxPartialResponseRendererImpl.class);
+ binder.bind(PageContentTypeAnalyzer.class, PageContentTypeAnalyzerImpl.class);
+ binder.bind(ResponseRenderer.class, ResponseRendererImpl.class);
+ binder.bind(RequestPathOptimizer.class, RequestPathOptimizerImpl.class);
+ binder.bind(PageResourcesSource.class, PageResourcesSourceImpl.class);
+ binder.bind(RequestSecurityManager.class, RequestSecurityManagerImpl.class);
+ binder.bind(InternalRequestGlobals.class, InternalRequestGlobalsImpl.class);
+ }
+
+ /**
+ * Chooses one of two implementations, based on the configured mode.
+ */
+ public static ActionRenderResponseGenerator buildActionRenderResponseGenerator(
+
+ @Symbol(TapestryConstants.SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS_SYMBOL)
+ boolean immediateMode,
+
+ ObjectLocator locator)
+ {
+ if (immediateMode) return locator.autobuild(ImmediateActionRenderResponseGenerator.class);
+
+ return locator.autobuild(ActionRenderResponseGeneratorImpl.class);
+ }
+
+ @Scope(PERTHREAD_SCOPE)
+ public static RequestPageCache buildRequestPageCache(PagePool pagePool, PerthreadManager perthreadManager)
+ {
+ RequestPageCacheImpl service = new RequestPageCacheImpl(pagePool);
+
+ perthreadManager.addThreadCleanupListener(service);
+
+ return service;
+ }
+
+ public static PageTemplateLocator buildPageTemplateLocator(@ContextProvider AssetFactory contextAssetFactory,
+
+ ComponentClassResolver componentClassResolver)
+ {
+ return new PageTemplateLocatorImpl(contextAssetFactory.getRootResource(), componentClassResolver);
+ }
+
+
+ public ComponentInstantiatorSource buildComponentInstantiatorSource(@Builtin ClassFactory classFactory,
+
+ ComponentClassTransformer transformer,
+
+ Logger logger,
+
+ InternalRequestGlobals internalRequestGlobals)
+ {
+ ComponentInstantiatorSourceImpl source = new ComponentInstantiatorSourceImpl(logger, classFactory
+ .getClassLoader(), transformer, internalRequestGlobals);
+
+ _updateListenerHub.addUpdateListener(source);
+
+ return source;
+ }
+
+ public ComponentClassTransformer buildComponentClassTransformer(ServiceResources resources)
+ {
+ ComponentClassTransformerImpl transformer = resources.autobuild(ComponentClassTransformerImpl.class);
+
+ _componentInstantiatorSource.addInvalidationListener(transformer);
+
+ return transformer;
+ }
+
+ public PagePool buildPagePool(PageLoader pageLoader, ComponentMessagesSource componentMessagesSource,
+ ServiceResources resources)
+ {
+ PagePoolImpl service = resources.autobuild(PagePoolImpl.class);
+
+ // This covers invalidations due to changes to classes
+
+ pageLoader.addInvalidationListener(service);
+
+ // This covers invalidation due to changes to message catalogs (properties files)
+
+ componentMessagesSource.addInvalidationListener(service);
+
+ // ... and this covers invalidations due to changes to templates
+
+ _componentTemplateSource.addInvalidationListener(service);
+
+ // Give the service a chance to clean up its own cache periodically as well
+
+ _updateListenerHub.addUpdateListener(service);
+
+ return service;
+ }
+
+ public ComponentClassCache buildComponentClassCache(@ComponentLayer ClassFactory classFactory)
+ {
+ ComponentClassCacheImpl service = new ComponentClassCacheImpl(classFactory);
+
+ _componentInstantiatorSource.addInvalidationListener(service);
+
+ return service;
+ }
+
+ public CookieSource buildCookieSource()
+ {
+ return new CookieSource()
+ {
+
+ public Cookie[] getCookies()
+ {
+ return _requestGlobals.getHTTPServletRequest().getCookies();
+ }
+ };
+ }
+
+
+ public CookieSink buildCookieSink()
+ {
+ return new CookieSink()
+ {
+
+ public void addCookie(Cookie cookie)
+ {
+ _requestGlobals.getHTTPServletResponse().addCookie(cookie);
+ }
+
+ };
+ }
+
+ public ResourceCache buildResourceCache(ResourceDigestGenerator digestGenerator)
+ {
+ ResourceCacheImpl service = new ResourceCacheImpl(digestGenerator);
+
+ _updateListenerHub.addUpdateListener(service);
+
+ return service;
+ }
+
+
+ public ComponentTemplateSource buildComponentTemplateSource(TemplateParser parser, PageTemplateLocator locator)
+ {
+ ComponentTemplateSourceImpl service = new ComponentTemplateSourceImpl(parser, locator);
+
+ _updateListenerHub.addUpdateListener(service);
+
+ return service;
+ }
+
+ public PageLoader buildPageLoader(ServiceResources resources)
+ {
+ PageLoaderImpl service = resources.autobuild(PageLoaderImpl.class);
+
+ // Recieve invalidations when the class loader is discarded (due to a component class
+ // change). The notification is forwarded to the page loader's listeners.
+
+ _componentInstantiatorSource.addInvalidationListener(service);
+
+ return service;
+ }
+
+
+}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageRenderSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageRenderSupportImpl.java?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageRenderSupportImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageRenderSupportImpl.java Sat Apr 19 11:33:09 2008
@@ -33,7 +33,7 @@
{
private final IdAllocator _idAllocator;
- private final DocumentHeadBuilder _builder;
+ private final DocumentLinker _linker;
private final SymbolSource _symbolSource;
@@ -46,21 +46,21 @@
private final JSONObject _init = new JSONObject();
/**
- * @param builder Used to assemble JavaScript includes and snippets
+ * @param linker Used to assemble JavaScript includes and snippets
* @param symbolSource Used to example symbols (in {@linkplain #addClasspathScriptLink(String...) in classpath
* scripts)
* @param assetSource Used to convert classpath scripts to {@link org.apache.tapestry.Asset}s
* @param coreScripts core scripts (evaluated as classpaths scripts) that are added to any page that includes a
* script link or script block
*/
- public PageRenderSupportImpl(DocumentHeadBuilder builder, SymbolSource symbolSource,
+ public PageRenderSupportImpl(DocumentLinker linker, SymbolSource symbolSource,
AssetSource assetSource, String... coreScripts)
{
- this(builder, symbolSource, assetSource, new IdAllocator(), coreScripts);
+ this(linker, symbolSource, assetSource, new IdAllocator(), coreScripts);
}
/**
- * @param builder Used to assemble JavaScript includes and snippets
+ * @param linker Used to assemble JavaScript includes and snippets
* @param symbolSource Used to example symbols (in {@linkplain #addClasspathScriptLink(String...) in classpath
* scripts)
* @param assetSource Used to convert classpath scripts to {@link org.apache.tapestry.Asset}s
@@ -69,11 +69,11 @@
* script link or script block
*/
- public PageRenderSupportImpl(DocumentHeadBuilder builder, SymbolSource symbolSource,
+ public PageRenderSupportImpl(DocumentLinker linker, SymbolSource symbolSource,
AssetSource assetSource, IdAllocator idAllocator, String... coreScripts)
{
- _builder = builder;
+ _linker = linker;
_symbolSource = symbolSource;
_assetSource = assetSource;
_idAllocator = idAllocator;
@@ -99,7 +99,7 @@
{
notNull(asset, "scriptAsset");
- _builder.addScriptLink(asset.toClientURL());
+ _linker.addScriptLink(asset.toClientURL());
}
}
@@ -117,7 +117,7 @@
Asset asset = _assetSource.getAsset(null, expanded, null);
- _builder.addScriptLink(asset.toClientURL());
+ _linker.addScriptLink(asset.toClientURL());
}
public void addScript(String format, Object... arguments)
@@ -128,7 +128,7 @@
String script = format(format, arguments);
- _builder.addScript(script);
+ _linker.addScript(script);
}
public void addInit(String functionName, JSONArray parameterList)
@@ -141,9 +141,22 @@
addInitFunctionInvocation(functionName, parameter);
}
- public void addInit(String functionName, String parameter)
+ public void addInit(String functionName, String... parameters)
{
- addInitFunctionInvocation(functionName, parameter);
+ if (parameters.length == 1)
+ {
+ addInitFunctionInvocation(functionName, parameters[0]);
+ return;
+ }
+
+ JSONArray array = new JSONArray();
+
+ for (String parameter : parameters)
+ {
+ array.put(parameter);
+ }
+
+ addInitFunctionInvocation(functionName, array);
}
private void addInitFunctionInvocation(String functionName, Object parameters)
@@ -177,7 +190,7 @@
{
notNull(stylesheet, "stylesheet");
- _builder.addStylesheetLink(stylesheet.toClientURL(), media);
+ _linker.addStylesheetLink(stylesheet.toClientURL(), media);
}
private void addCore()
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/FieldValidatorDefaultSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/FieldValidatorDefaultSource.java?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/FieldValidatorDefaultSource.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/FieldValidatorDefaultSource.java Sat Apr 19 11:33:09 2008
@@ -29,15 +29,16 @@
{
/**
* Analyzes the property type and property annotations to determine the default set of validations for the property,
- * which are wrapped to form a {@link FieldValidator} for a field.
+ * which are wrapped to form a {@link org.apache.tapestry.FieldValidator} for a field.
*
- * @param field
- * @param overrideId
- * @param overrideMessages
- * @param locale
- * @param propertyType
- * @param propertyAnnotations
- * @return
+ * @param field Field component for which a validator is being created
+ * @param overrideId the id of the component, used to locate related messages for labels and errors
+ * @param overrideMessages where to search for label and error messages
+ * @param locale locale used for locating messages
+ * @param propertyType type of property bound to the editting parameter of the field (typically, the
+ * parameter named "value").
+ * @param propertyAnnotations source of annotations for the property being editted
+ * @return a validator reflecting all default validations for the field
*/
FieldValidator createDefaultValidator(Field field, String overrideId, Messages overrideMessages, Locale locale,
Class propertyType, AnnotationProvider propertyAnnotations);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java Sat Apr 19 11:33:09 2008
@@ -30,13 +30,10 @@
import org.apache.tapestry.internal.grid.NullDataSource;
import org.apache.tapestry.internal.renderers.*;
import org.apache.tapestry.internal.services.*;
-import org.apache.tapestry.internal.structure.PageResourcesSource;
-import org.apache.tapestry.internal.structure.PageResourcesSourceImpl;
import org.apache.tapestry.internal.transform.*;
import org.apache.tapestry.internal.translator.*;
import org.apache.tapestry.internal.util.IntegerRange;
import org.apache.tapestry.ioc.*;
-import static org.apache.tapestry.ioc.IOCConstants.PERTHREAD_SCOPE;
import org.apache.tapestry.ioc.annotations.*;
import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newCaseInsensitiveMap;
@@ -53,7 +50,6 @@
import org.slf4j.Logger;
import javax.servlet.ServletContext;
-import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@@ -68,17 +64,97 @@
*/
@SuppressWarnings({ "JavaDoc" })
@Marker(Core.class)
+@SubModule(InternalModule.class)
public final class TapestryModule
{
+ private final PipelineBuilder _pipelineBuilder;
+
+ private final ApplicationGlobals _applicationGlobals;
+
+ private final PropertyShadowBuilder _shadowBuilder;
+
+ private final Environment _environment;
+
+ private final StrategyBuilder _strategyBuilder;
+
+ private final PropertyAccess _propertyAccess;
+
+ private final ComponentInstantiatorSource _componentInstantiatorSource;
+
+ private final UpdateListenerHub _updateListenerHub;
+
+ private final ChainBuilder _chainBuilder;
+
+ private final Request _request;
+
+ private final Response _response;
+
+ private final ThreadLocale _threadLocale;
+
+ private final RequestGlobals _requestGlobals;
+
+ private final ActionRenderResponseGenerator _actionRenderResponseGenerator;
+
+ private final EnvironmentalShadowBuilder _environmentalBuilder;
+
+ public TapestryModule(PipelineBuilder pipelineBuilder,
+
+ PropertyShadowBuilder shadowBuilder,
+
+ RequestGlobals requestGlobals,
+
+ ApplicationGlobals applicationGlobals,
+
+ ChainBuilder chainBuilder,
+
+ Environment environment,
+
+ StrategyBuilder strategyBuilder,
+
+ ComponentInstantiatorSource componentInstantiatorSource,
+
+ PropertyAccess propertyAccess,
+
+ UpdateListenerHub updateListenerHub,
+
+ Request request,
+
+ Response response,
+
+ ThreadLocale threadLocale,
+
+ ActionRenderResponseGenerator actionRenderResponseGenerator,
+
+ EnvironmentalShadowBuilder environmentalBuilder)
+ {
+ _pipelineBuilder = pipelineBuilder;
+ _shadowBuilder = shadowBuilder;
+ _requestGlobals = requestGlobals;
+ _applicationGlobals = applicationGlobals;
+ _chainBuilder = chainBuilder;
+ _environment = environment;
+ _strategyBuilder = strategyBuilder;
+ _componentInstantiatorSource = componentInstantiatorSource;
+ _propertyAccess = propertyAccess;
+
+ _updateListenerHub = updateListenerHub;
+ _request = request;
+ _response = response;
+ _threadLocale = threadLocale;
+ _actionRenderResponseGenerator = actionRenderResponseGenerator;
+ _environmentalBuilder = environmentalBuilder;
+ }
+
public static void bind(ServiceBinder binder)
{
+ // Public Services
+
binder.bind(ClasspathAssetAliasManager.class, ClasspathAssetAliasManagerImpl.class);
binder.bind(PersistentLocale.class, PersistentLocaleImpl.class);
binder.bind(ApplicationStateManager.class, ApplicationStateManagerImpl.class);
binder.bind(ApplicationStatePersistenceStrategySource.class,
ApplicationStatePersistenceStrategySourceImpl.class);
binder.bind(BindingSource.class, BindingSourceImpl.class);
- binder.bind(PersistentFieldManager.class, PersistentFieldManagerImpl.class);
binder.bind(FieldValidatorSource.class, FieldValidatorSourceImpl.class);
binder.bind(ApplicationGlobals.class, ApplicationGlobalsImpl.class);
binder.bind(AssetSource.class, AssetSourceImpl.class);
@@ -95,37 +171,27 @@
binder.bind(ComponentDefaultProvider.class, ComponentDefaultProviderImpl.class);
binder.bind(MarkupWriterFactory.class, MarkupWriterFactoryImpl.class);
binder.bind(FieldValidationSupport.class, FieldValidationSupportImpl.class);
- binder.bind(TemplateParser.class, TemplateParserImpl.class);
- binder.bind(PageResponseRenderer.class, PageResponseRendererImpl.class);
- binder.bind(PageMarkupRenderer.class, PageMarkupRendererImpl.class);
- binder.bind(ComponentInvocationMap.class, NoOpComponentInvocationMap.class);
binder.bind(ObjectRenderer.class, LocationRenderer.class).withId("LocationRenderer");
- binder.bind(UpdateListenerHub.class, UpdateListenerHubImpl.class);
binder.bind(ObjectProvider.class, AssetObjectProvider.class).withId("AssetObjectProvider");
- binder.bind(LinkFactory.class, LinkFactoryImpl.class);
- binder.bind(LocalizationSetter.class, LocalizationSetterImpl.class);
- binder.bind(PageElementFactory.class, PageElementFactoryImpl.class);
binder.bind(RequestExceptionHandler.class, DefaultRequestExceptionHandler.class);
- binder.bind(ResourceStreamer.class, ResourceStreamerImpl.class);
- binder.bind(ClientPersistentFieldStorage.class, ClientPersistentFieldStorageImpl.class);
- binder.bind(RequestEncodingInitializer.class, RequestEncodingInitializerImpl.class);
binder.bind(ComponentEventResultProcessor.class, ComponentInstanceResultProcessor.class).withId(
"ComponentInstanceResultProcessor");
- binder.bind(PageRenderQueue.class, PageRenderQueueImpl.class);
- binder.bind(AjaxPartialResponseRenderer.class, AjaxPartialResponseRendererImpl.class);
- binder.bind(PageContentTypeAnalyzer.class, PageContentTypeAnalyzerImpl.class);
- binder.bind(ResponseRenderer.class, ResponseRendererImpl.class);
- binder.bind(RequestPathOptimizer.class, RequestPathOptimizerImpl.class);
binder.bind(NullFieldStrategySource.class, NullFieldStrategySourceImpl.class);
binder.bind(HttpServletRequestFilter.class, IgnoredPathsFilter.class).withId("IgnoredPathsFilter");
- binder.bind(PageResourcesSource.class, PageResourcesSourceImpl.class);
binder.bind(ContextValueEncoder.class, ContextValueEncoderImpl.class);
binder.bind(BaseURLSource.class, BaseURLSourceImpl.class);
- binder.bind(RequestSecurityManager.class, RequestSecurityManagerImpl.class);
binder.bind(BeanBlockOverrideSource.class, BeanBlockOverrideSourceImpl.class);
- binder.bind(InternalRequestGlobals.class, InternalRequestGlobalsImpl.class);
+
+ binder.bind(AliasManager.class, AliasManagerImpl.class).withId("AliasOverrides");
}
+ // ========================================================================
+ //
+ // Service Builder Methods (static)
+ //
+ // ========================================================================
+
+
public static Alias build(Logger logger,
@Inject @Symbol(InternalConstants.TAPESTRY_ALIAS_MODE_SYMBOL)
@@ -141,14 +207,11 @@
return new AliasImpl(manager, mode, overridesManager);
}
- /**
- * A companion service to {@linkplain #build(org.slf4j.Logger, String, AliasManager, java.util.Collection)} the
- * Alias service} whose configuration contribution define spot overrides to specific services.
- */
- public static AliasManager buildAliasOverrides(Logger logger, Collection<AliasContribution> configuration)
- {
- return new AliasManagerImpl(logger, configuration);
- }
+ // ========================================================================
+ //
+ // Service Contribution Methods (static)
+ //
+ // ========================================================================
/**
* Contributes the factory for serveral built-in binding prefixes ("asset", "block", "component", "literal", prop",
@@ -164,14 +227,15 @@
configuration.add(TapestryConstants.LITERAL_BINDING_PREFIX, new LiteralBindingFactory());
configuration.add(TapestryConstants.PROP_BINDING_PREFIX, propBindingFactory);
- configuration.add("component", new ComponentBindingFactory());
- configuration.add("message", new MessageBindingFactory());
- configuration.add("validate", locator.autobuild(ValidateBindingFactory.class));
- configuration.add("translate", locator.autobuild(TranslateBindingFactory.class));
- configuration.add("block", new BlockBindingFactory());
- configuration.add("asset", locator.autobuild(AssetBindingFactory.class));
- configuration.add("var", new RenderVariableBindingFactory());
- configuration.add("nullfieldstrategy", locator.autobuild(NullFieldStrategyBindingFactory.class));
+ configuration.add(TapestryConstants.COMPONENT_BINDING_PREFIX, new ComponentBindingFactory());
+ configuration.add(TapestryConstants.MESSAGE_BINDING_PREFIX, new MessageBindingFactory());
+ configuration.add(TapestryConstants.VALIDATE_BINDING_PREFIX, locator.autobuild(ValidateBindingFactory.class));
+ configuration.add(TapestryConstants.TRANSLATE_BINDING_PREFIX, locator.autobuild(TranslateBindingFactory.class));
+ configuration.add(TapestryConstants.BLOCK_BINDING_PREFIX, new BlockBindingFactory());
+ configuration.add(TapestryConstants.ASSET_BINDING_PREFIX, locator.autobuild(AssetBindingFactory.class));
+ configuration.add(TapestryConstants.VAR_BINDING_PREFIX, new RenderVariableBindingFactory());
+ configuration.add(TapestryConstants.NULLFIELDSTRATEGY_BINDING_PREFIX,
+ locator.autobuild(NullFieldStrategyBindingFactory.class));
}
public static void contributeClasspathAssetAliasManager(MappedConfiguration<String, String> configuration,
@@ -710,127 +774,74 @@
configuration.add(name, new ComponentLifecycleMethodWorker(signature, annotationClass, reverse));
}
- private final PipelineBuilder _pipelineBuilder;
-
- private final ApplicationGlobals _applicationGlobals;
-
- private final PropertyShadowBuilder _shadowBuilder;
-
- private final RequestPageCache _requestPageCache;
-
- private final Environment _environment;
-
- private final StrategyBuilder _strategyBuilder;
-
- private final PropertyAccess _propertyAccess;
-
- private final ClassFactory _componentClassFactory;
-
- private final ComponentInstantiatorSource _componentInstantiatorSource;
-
- private final ComponentTemplateSource _componentTemplateSource;
-
- private final UpdateListenerHub _updateListenerHub;
-
- private final PerthreadManager _perthreadManager;
-
- private final ChainBuilder _chainBuilder;
-
- private final Request _request;
-
- private final Response _response;
-
- private final ThreadLocale _threadLocale;
-
- private final RequestGlobals _requestGlobals;
-
- private final ActionRenderResponseGenerator _actionRenderResponseGenerator;
-
- public TapestryModule(PipelineBuilder pipelineBuilder,
-
- PropertyShadowBuilder shadowBuilder,
-
- RequestGlobals requestGlobals,
-
- ApplicationGlobals applicationGlobals,
-
- ChainBuilder chainBuilder,
-
- RequestPageCache requestPageCache,
-
- Environment environment,
-
- StrategyBuilder strategyBuilder,
-
- ComponentInstantiatorSource componentInstantiatorSource,
-
- PropertyAccess propertyAccess,
-
- @ComponentLayer ClassFactory componentClassFactory,
-
- UpdateListenerHub updateListenerHub,
+ // ========================================================================
+ //
+ // Service Builder Methods (instance)
+ //
+ // ========================================================================
- PerthreadManager perthreadManager,
+ public Context buildContext(ApplicationGlobals globals)
+ {
+ return _shadowBuilder.build(globals, "context", Context.class);
+ }
- ComponentTemplateSource componentTemplateSource,
+ public ComponentClassResolver buildComponentClassResolver(ServiceResources resources)
+ {
+ ComponentClassResolverImpl service = resources.autobuild(ComponentClassResolverImpl.class);
- Request request,
+ // Allow the resolver to clean its cache when the source is invalidated
- Response response,
+ _componentInstantiatorSource.addInvalidationListener(service);
- ThreadLocale threadLocale,
+ return service;
+ }
- ActionRenderResponseGenerator actionRenderResponseGenerator)
+ @Marker(ClasspathProvider.class)
+ public AssetFactory buildClasspathAssetFactory(ResourceCache resourceCache, ClasspathAssetAliasManager aliasManager)
{
- _pipelineBuilder = pipelineBuilder;
- _shadowBuilder = shadowBuilder;
- _requestGlobals = requestGlobals;
- _applicationGlobals = applicationGlobals;
- _chainBuilder = chainBuilder;
- _requestPageCache = requestPageCache;
- _environment = environment;
- _strategyBuilder = strategyBuilder;
- _componentInstantiatorSource = componentInstantiatorSource;
- _propertyAccess = propertyAccess;
- _componentClassFactory = componentClassFactory;
+ ClasspathAssetFactory factory = new ClasspathAssetFactory(resourceCache, aliasManager);
- _updateListenerHub = updateListenerHub;
- _perthreadManager = perthreadManager;
- _componentTemplateSource = componentTemplateSource;
- _request = request;
- _response = response;
- _threadLocale = threadLocale;
- _actionRenderResponseGenerator = actionRenderResponseGenerator;
+ resourceCache.addInvalidationListener(factory);
+
+ return factory;
}
- public Context build(ApplicationGlobals globals)
+ @Marker(ContextProvider.class)
+ public AssetFactory buildContextAssetFactory(ApplicationGlobals globals, RequestPathOptimizer optimizer)
{
- return _shadowBuilder.build(globals, "context", Context.class);
+ return new ContextAssetFactory(_request, globals.getContext(), optimizer);
}
- public ComponentClassResolver buildComponentClassResolver(ServiceResources resources)
+ /**
+ * Builds the PropBindingFactory as a chain of command. The terminator of the chain is responsible for ordinary
+ * property names (and property paths). Contributions to the service cover additional special cases, such as simple
+ * literal values.
+ *
+ * @param configuration contributions of special factories for some constants, each contributed factory may return a
+ * binding if applicable, or null otherwise
+ */
+ public BindingFactory buildPropBindingFactory(List<BindingFactory> configuration,
+ PropertyConduitSource propertyConduitSource)
{
- ComponentClassResolverImpl service = resources.autobuild(ComponentClassResolverImpl.class);
-
- // Allow the resolver to clean its cache when the source is invalidated
+ PropBindingFactory service = new PropBindingFactory(propertyConduitSource);
- _componentInstantiatorSource.addInvalidationListener(service);
+ configuration.add(service);
- return service;
+ return _chainBuilder.build(BindingFactory.class, configuration);
}
/**
* Builds the source of {@link Messages} containing validation messages. The contributions are paths to message
* bundles (resource paths within the classpath); the default contribution is "org/apache/tapestry/internal/ValidationMessages".
*/
- public ValidationMessagesSource build(Collection<String> configuration, UpdateListenerHub updateListenerHub,
+ public ValidationMessagesSource buildValidationMessagesSource(Collection<String> configuration,
- @ClasspathProvider AssetFactory classpathAssetFactory)
+ @ClasspathProvider AssetFactory classpathAssetFactory)
{
ValidationMessagesSourceImpl service = new ValidationMessagesSourceImpl(configuration,
classpathAssetFactory.getRootResource());
- updateListenerHub.addUpdateListener(service);
+ _updateListenerHub.addUpdateListener(service);
return service;
}
@@ -844,28 +855,39 @@
return service;
}
+ public PersistentFieldStrategy buildClientPersistentFieldStrategy(LinkFactory linkFactory,
+ ServiceResources resources)
+ {
+ ClientPersistentFieldStrategy service = resources.autobuild(ClientPersistentFieldStrategy.class);
+
+ linkFactory.addListener(service);
+
+ return service;
+ }
+
/**
* Builds a proxy to the current {@link org.apache.tapestry.PageRenderSupport} inside this thread's {@link
* Environment}.
*/
- public PageRenderSupport buildPageRenderSupport(EnvironmentalShadowBuilder builder)
+ public PageRenderSupport buildPageRenderSupport()
{
- return builder.build(PageRenderSupport.class);
+ return _environmentalBuilder.build(PageRenderSupport.class);
}
/**
* Builds a proxy to the current {@link org.apache.tapestry.services.FormSupport} inside this thread's {@link
* org.apache.tapestry.services.Environment}.
*/
- public FormSupport buildFormSupport(EnvironmentalShadowBuilder builder)
+ public FormSupport buildFormSupport()
{
- return builder.build(FormSupport.class);
+ return _environmentalBuilder.build(FormSupport.class);
}
/**
* Allows the exact steps in the component class transformation process to be defined.
*/
- public ComponentClassTransformWorker build(List<ComponentClassTransformWorker> configuration)
+ public ComponentClassTransformWorker buildComponentClassTransformWorker(
+ List<ComponentClassTransformWorker> configuration)
{
return _chainBuilder.build(ComponentClassTransformWorker.class, configuration);
}
@@ -876,7 +898,7 @@
* org.apache.tapestry.beaneditor.DataType} annotation before deriving the data type from the property type.
*/
@Marker(Primary.class)
- public DataTypeAnalyzer build(List<DataTypeAnalyzer> configuration)
+ public DataTypeAnalyzer buildDataTypeAnalyzer(List<DataTypeAnalyzer> configuration)
{
return _chainBuilder.build(DataTypeAnalyzer.class, configuration);
}
@@ -887,7 +909,7 @@
* type and field name).
*/
- public InjectionProvider build(List<InjectionProvider> configuration)
+ public InjectionProvider buildInjectionProvider(List<InjectionProvider> configuration)
{
return _chainBuilder.build(InjectionProvider.class, configuration);
}
@@ -897,7 +919,8 @@
* Initializes the application.
*/
@Marker(Primary.class)
- public ApplicationInitializer build(Logger logger, List<ApplicationInitializerFilter> configuration)
+ public ApplicationInitializer buildApplicationInitializer(Logger logger,
+ List<ApplicationInitializerFilter> configuration)
{
ApplicationInitializer terminator = new ApplicationInitializer()
{
@@ -911,10 +934,11 @@
configuration, terminator);
}
- public HttpServletRequestHandler build(Logger logger, List<HttpServletRequestFilter> configuration,
+ public HttpServletRequestHandler buildHttpServletRequestHandler(Logger logger,
+ List<HttpServletRequestFilter> configuration,
- @Primary
- final RequestHandler handler)
+ @Primary
+ final RequestHandler handler)
{
HttpServletRequestHandler terminator = new HttpServletRequestHandler()
{
@@ -937,10 +961,10 @@
}
@Marker(Primary.class)
- public RequestHandler build(Logger logger, List<RequestFilter> configuration,
+ public RequestHandler buildRequestHandler(Logger logger, List<RequestFilter> configuration,
- @Primary
- final Dispatcher masterDispatcher)
+ @Primary
+ final Dispatcher masterDispatcher)
{
RequestHandler terminator = new RequestHandler()
{
@@ -955,10 +979,11 @@
return _pipelineBuilder.build(logger, RequestHandler.class, RequestFilter.class, configuration, terminator);
}
- public ServletApplicationInitializer build(Logger logger, List<ServletApplicationInitializerFilter> configuration,
+ public ServletApplicationInitializer buildServletApplicationInitializer(Logger logger,
+ List<ServletApplicationInitializerFilter> configuration,
- @Primary
- final ApplicationInitializer initializer)
+ @Primary
+ final ApplicationInitializer initializer)
{
ServletApplicationInitializer terminator = new ServletApplicationInitializer()
{
@@ -1027,8 +1052,7 @@
public TranslatorSource buildTranslatorSource(ServiceResources resources)
{
- TranslatorSourceImpl service = resources
- .autobuild(TranslatorSourceImpl.class);
+ TranslatorSourceImpl service = resources.autobuild(TranslatorSourceImpl.class);
_componentInstantiatorSource.addInvalidationListener(service);
@@ -1036,34 +1060,35 @@
}
@Marker(Primary.class)
- public ObjectRenderer build(Map<Class, ObjectRenderer> configuration)
+ public ObjectRenderer buildObjectRenderer(Map<Class, ObjectRenderer> configuration)
{
StrategyRegistry<ObjectRenderer> registry = StrategyRegistry.newInstance(ObjectRenderer.class, configuration);
return _strategyBuilder.build(registry);
}
- public static ComponentMessagesSource build(UpdateListenerHub updateListenerHub,
-
- @ContextProvider AssetFactory contextAssetFactory,
-
- @Inject @Value("WEB-INF/${tapestry.app-name}.properties")
- String appCatalog)
+ public ComponentMessagesSource buildComponentMessagesSource(
+ @ContextProvider
+ AssetFactory contextAssetFactory,
+
+ @Inject
+ @Value("WEB-INF/${tapestry.app-name}.properties")
+ String appCatalog)
{
ComponentMessagesSourceImpl service = new ComponentMessagesSourceImpl(contextAssetFactory
.getRootResource(), appCatalog);
- updateListenerHub.addUpdateListener(service);
+ _updateListenerHub.addUpdateListener(service);
return service;
}
/**
- * Returns a {@link ClassFactory} that can be used to create extra classes around component classes. This
- * ClassFactory will be cleared whenever an underlying component class is discovered to have changed. Use of this
- * class factory implies that your code will become aware of this (if necessary) to discard any cached object (alas,
- * this currently involves dipping into the internals side to register for the correct notifications). Failure to
- * properly clean up can result in really nasty PermGen space memory leaks.
+ * Returns a {@link org.apache.tapestry.ioc.services.ClassFactory} that can be used to create extra classes around
+ * component classes. This ClassFactory will be cleared whenever an underlying component class is discovered to have
+ * changed. Use of this class factory implies that your code will become aware of this (if necessary) to discard any
+ * cached object (alas, this currently involves dipping into the internals side to register for the correct
+ * notifications). Failure to properly clean up can result in really nasty PermGen space memory leaks.
*/
@Marker(ComponentLayer.class)
public ClassFactory buildComponentClassFactory()
@@ -1081,9 +1106,9 @@
return _chainBuilder.build(Dispatcher.class, configuration);
}
- public PropertyConduitSource buildPropertyConduitSource()
+ public PropertyConduitSource buildPropertyConduitSource(@ComponentLayer ClassFactory componentClassFactory)
{
- PropertyConduitSourceImpl service = new PropertyConduitSourceImpl(_propertyAccess, _componentClassFactory);
+ PropertyConduitSourceImpl service = new PropertyConduitSourceImpl(_propertyAccess, componentClassFactory);
_componentInstantiatorSource.addInvalidationListener(service);
@@ -1117,43 +1142,141 @@
return _shadowBuilder.build(_requestGlobals, "response", Response.class);
}
+
/**
- * Contributes the default "session" strategy.
+ * The MarkupRenderer service is used to render a full page as markup. Supports an ordered configuration of {@link
+ * org.apache.tapestry.services.MarkupRendererFilter}s.
+ *
+ * @param pageRenderQueue handles the bulk of the work
+ * @param logger used to log errors building the pipeline
+ * @param configuration filters on this service
+ * @return the service
+ * @see #contributeMarkupRenderer(org.apache.tapestry.ioc.OrderedConfiguration, org.apache.tapestry.Asset,
+ * org.apache.tapestry.Asset, ValidationMessagesSource, org.apache.tapestry.ioc.services.SymbolSource,
+ * AssetSource)
*/
- public void contributeApplicationStatePersistenceStrategySource(
- MappedConfiguration<String, ApplicationStatePersistenceStrategy> configuration,
-
- Request request)
+ public MarkupRenderer buildMarkupRenderer(final PageRenderQueue pageRenderQueue, Logger logger,
+ List<MarkupRendererFilter> configuration)
{
- configuration.add("session", new SessionApplicationStatePersistenceStrategy(request));
- }
-
- public void contributeAssetSource(MappedConfiguration<String, AssetFactory> configuration,
- @ContextProvider AssetFactory contextAssetFactory,
+ MarkupRenderer terminator = new MarkupRenderer()
+ {
+ public void renderMarkup(MarkupWriter writer)
+ {
+ pageRenderQueue.render(writer);
+ }
+ };
- @ClasspathProvider AssetFactory classpathAssetFactory)
- {
- configuration.add("context", contextAssetFactory);
- configuration.add("classpath", classpathAssetFactory);
+ return _pipelineBuilder.build(logger, MarkupRenderer.class, MarkupRendererFilter.class, configuration,
+ terminator);
}
/**
- * Contributes handlers for the following types: <dl> <dt>Object</dt> <dd>Failure case, added to provide a more
- * useful exception message</dd> <dt>{@link Link}</dt> <dd>Sends a redirect to the link (which is typically a page
- * render link)</dd> <dt>String</dt> <dd>Sends a page render redirect</dd> <dt>Class</dt> <dd>Interpreted as the
- * class name of a page, sends a page render render redirect (this is more refactoring safe than the page name)</dd>
- * <dt>{@link Component}</dt> <dd>A page's root component (though a non-root component will work, but will generate
- * a warning). A direct to the containing page is sent.</dd> <dt>{@link org.apache.tapestry.StreamResponse}</dt>
- * <dd>The stream response is sent as the actual reply.</dd> <dt>URL</dt> <dd>Sends a redirect to a (presumably)
- * external URL</dd> </dl>
- */
- public void contributeComponentEventResultProcessor(
-
- @InjectService("ComponentInstanceResultProcessor")
- ComponentEventResultProcessor componentInstanceProcessor,
-
- ComponentClassResolver componentClassResolver,
-
+ * A wrapper around {@link org.apache.tapestry.internal.services.PageRenderQueue} used for partial page renders.
+ * Supports an ordered configuration of {@link org.apache.tapestry.services.PartialMarkupRendererFilter}s.
+ *
+ * @param logger used to log warnings creating the pipeline
+ * @param configuration filters for the service
+ * @param renderQueue does most of the work
+ * @return the service
+ * @see #contributePartialMarkupRenderer(org.apache.tapestry.ioc.OrderedConfiguration, org.apache.tapestry.Asset,
+ * org.apache.tapestry.ioc.services.SymbolSource, AssetSource, ValidationMessagesSource)
+ */
+ public PartialMarkupRenderer buildPartialMarkupRenderer(Logger logger,
+ List<PartialMarkupRendererFilter> configuration,
+ final PageRenderQueue renderQueue)
+ {
+
+ PartialMarkupRenderer terminator = new PartialMarkupRenderer()
+ {
+ public void renderMarkup(MarkupWriter writer, JSONObject reply)
+ {
+ renderQueue.renderPartial(writer, reply);
+ }
+ };
+
+ return _pipelineBuilder.build(logger, PartialMarkupRenderer.class, PartialMarkupRendererFilter.class,
+ configuration, terminator);
+ }
+
+ public PageRenderRequestHandler buildPageRenderRequestHandler(List<PageRenderRequestFilter> configuration,
+ Logger logger, ServiceResources resources)
+ {
+ return _pipelineBuilder.build(logger, PageRenderRequestHandler.class, PageRenderRequestFilter.class,
+ configuration, resources.autobuild(PageRenderRequestHandlerImpl.class));
+ }
+
+
+ /**
+ * Builds the component action request handler for traditional (non-Ajax) requests. These typically result in a
+ * redirect to a Tapestry render URL.
+ *
+ * @see org.apache.tapestry.internal.services.ComponentEventRequestHandlerImpl
+ */
+ @Marker(Traditional.class)
+ public ComponentEventRequestHandler buildComponentEventRequestHandler(
+ List<ComponentEventRequestFilter> configuration, Logger logger, ServiceResources resources)
+ {
+ return _pipelineBuilder.build(logger, ComponentEventRequestHandler.class, ComponentEventRequestFilter.class,
+ configuration, resources.autobuild(ComponentEventRequestHandlerImpl.class));
+ }
+
+ /**
+ * Builds the action request handler for Ajax requests, based on {@link org.apache.tapestry.internal.services.AjaxComponentEventRequestHandler}.
+ * Filters on the request handler are supported here as well.
+ */
+ @Marker(Ajax.class)
+ public ComponentEventRequestHandler buildAjaxComponentEventRequestHandler(
+ List<ComponentEventRequestFilter> configuration, Logger logger, ServiceResources resources)
+ {
+ return _pipelineBuilder.build(logger, ComponentEventRequestHandler.class, ComponentEventRequestFilter.class,
+ configuration, resources.autobuild(AjaxComponentEventRequestHandler.class));
+ }
+
+ // ========================================================================
+ //
+ // Service Contribution Methods (instance)
+ //
+ // ========================================================================
+
+ /**
+ * Contributes the default "session" strategy.
+ */
+ public void contributeApplicationStatePersistenceStrategySource(
+ MappedConfiguration<String, ApplicationStatePersistenceStrategy> configuration,
+
+ Request request)
+ {
+ configuration.add("session", new SessionApplicationStatePersistenceStrategy(request));
+ }
+
+ public void contributeAssetSource(MappedConfiguration<String, AssetFactory> configuration,
+ @ContextProvider AssetFactory contextAssetFactory,
+
+ @ClasspathProvider AssetFactory classpathAssetFactory)
+ {
+ configuration.add("context", contextAssetFactory);
+ configuration.add("classpath", classpathAssetFactory);
+ }
+
+ /**
+ * Contributes handlers for the following types: <dl> <dt>Object</dt> <dd>Failure case, added to provide a more
+ * useful exception message</dd> <dt>{@link Link}</dt> <dd>Sends a redirect to the link (which is typically a page
+ * render link)</dd> <dt>String</dt> <dd>Sends a page render redirect</dd> <dt>Class</dt> <dd>Interpreted as the
+ * class name of a page, sends a page render render redirect (this is more refactoring safe than the page name)</dd>
+ * <dt>{@link Component}</dt> <dd>A page's root component (though a non-root component will work, but will generate
+ * a warning). A direct to the containing page is sent.</dd> <dt>{@link org.apache.tapestry.StreamResponse}</dt>
+ * <dd>The stream response is sent as the actual reply.</dd> <dt>URL</dt> <dd>Sends a redirect to a (presumably)
+ * external URL</dd> </dl>
+ */
+ public void contributeComponentEventResultProcessor(
+
+ @InjectService("ComponentInstanceResultProcessor")
+ ComponentEventResultProcessor componentInstanceProcessor,
+
+ ComponentClassResolver componentClassResolver,
+
+ final RequestPageCache requestPageCache,
+
MappedConfiguration<Class, ComponentEventResultProcessor> configuration)
{
configuration.add(Link.class, new ComponentEventResultProcessor<Link>()
@@ -1172,9 +1295,9 @@
}
});
- configuration.add(String.class, new StringResultProcessor(_requestPageCache, _actionRenderResponseGenerator));
+ configuration.add(String.class, new StringResultProcessor(requestPageCache, _actionRenderResponseGenerator));
- configuration.add(Class.class, new ClassResultProcessor(componentClassResolver, _requestPageCache,
+ configuration.add(Class.class, new ClassResultProcessor(componentClassResolver, requestPageCache,
_actionRenderResponseGenerator));
configuration.add(Component.class, componentInstanceProcessor);
@@ -1279,34 +1402,6 @@
/**
- * The MarkupRenderer service is used to render a full page as markup. Supports an ordered configuration of {@link
- * org.apache.tapestry.services.MarkupRendererFilter}s.
- *
- * @param pageRenderQueue handles the bulk of the work
- * @param logger used to log errors building the pipeline
- * @param configuration filters on this service
- * @return the service
- * @see #contributeMarkupRenderer(org.apache.tapestry.ioc.OrderedConfiguration, org.apache.tapestry.Asset,
- * org.apache.tapestry.Asset, ValidationMessagesSource, org.apache.tapestry.ioc.services.SymbolSource,
- * AssetSource)
- */
- public MarkupRenderer buildMarkupRenderer(final PageRenderQueue pageRenderQueue, Logger logger,
- List<MarkupRendererFilter> configuration)
- {
- MarkupRenderer terminator = new MarkupRenderer()
- {
- public void renderMarkup(MarkupWriter writer)
- {
- pageRenderQueue.render(writer);
- }
- };
-
- return _pipelineBuilder.build(logger, MarkupRenderer.class, MarkupRendererFilter.class, configuration,
- terminator);
- }
-
-
- /**
* Adds page render filters, each of which provides an {@link org.apache.tapestry.annotations.Environmental}
* service. Filters often provide {@link Environmental} services needed by components as they render. <dl>
* <dt>PageRenderSupport</dt> <dd>Provides {@link PageRenderSupport}</dd> <dt>ClientBehaviorSupport</dt>
@@ -1333,9 +1428,9 @@
{
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer)
{
- DocumentHeadBuilderImpl builder = new DocumentHeadBuilderImpl();
+ DocumentLinkerImpl linker = new DocumentLinkerImpl();
- PageRenderSupportImpl support = new PageRenderSupportImpl(builder, symbolSource, assetSource,
+ PageRenderSupportImpl support = new PageRenderSupportImpl(linker, symbolSource, assetSource,
// Core scripts added to any page that uses scripting
@@ -1355,7 +1450,7 @@
support.commit();
- builder.updateDocument(writer.getDocument());
+ linker.updateDocument(writer.getDocument());
_environment.pop(PageRenderSupport.class);
}
@@ -1423,34 +1518,6 @@
/**
- * A wrapper around {@link org.apache.tapestry.internal.services.PageRenderQueue} used for partial page renders.
- * Supports an ordered configuration of {@link org.apache.tapestry.services.PartialMarkupRendererFilter}s.
- *
- * @param logger used to log warnings creating the pipeline
- * @param configuration filters for the service
- * @param renderQueue does most of the work
- * @return the service
- * @see #contributePartialMarkupRenderer(org.apache.tapestry.ioc.OrderedConfiguration, org.apache.tapestry.Asset,
- * org.apache.tapestry.ioc.services.SymbolSource, AssetSource, ValidationMessagesSource)
- */
- public PartialMarkupRenderer buildPartialMarkupRenderer(Logger logger,
- List<PartialMarkupRendererFilter> configuration,
- final PageRenderQueue renderQueue)
- {
-
- PartialMarkupRenderer terminator = new PartialMarkupRenderer()
- {
- public void renderMarkup(MarkupWriter writer, JSONObject reply)
- {
- renderQueue.renderPartial(writer, reply);
- }
- };
-
- return _pipelineBuilder.build(logger, PartialMarkupRenderer.class, PartialMarkupRendererFilter.class,
- configuration, terminator);
- }
-
- /**
* Contributes {@link PartialMarkupRendererFilter}s used when rendering a partial Ajax response. This is an analog
* to {@link #contributeMarkupRenderer(org.apache.tapestry.ioc.OrderedConfiguration, org.apache.tapestry.Asset,
* org.apache.tapestry.Asset, ValidationMessagesSource, org.apache.tapestry.ioc.services.SymbolSource, AssetSource)}
@@ -1484,7 +1551,7 @@
IdAllocator idAllocator = new IdAllocator(namespace);
- DocumentHeadBuilder builder = new DocumentHeadBuilder()
+ DocumentLinker builder = new DocumentLinker()
{
public void addScriptLink(String scriptURL)
{
@@ -1600,7 +1667,7 @@
configuration.add("org/apache/tapestry/internal/ValidationMessages");
}
- public ValueEncoderSource build(Map<Class, ValueEncoderFactory> configuration)
+ public ValueEncoderSource buildValueEncoderSource(Map<Class, ValueEncoderFactory> configuration)
{
ValueEncoderSourceImpl service = new ValueEncoderSourceImpl(configuration);
@@ -1621,12 +1688,6 @@
configuration.add(Enum.class, new EnumValueEncoderFactory());
}
- public PageRenderRequestHandler buildPageRenderRequestHandler(List<PageRenderRequestFilter> configuration,
- Logger logger, ServiceResources resources)
- {
- return _pipelineBuilder.build(logger, PageRenderRequestHandler.class, PageRenderRequestFilter.class,
- configuration, resources.autobuild(PageRenderRequestHandlerImpl.class));
- }
/**
* Contributes a single filter, "Secure", which checks for non-secure requests that access secure pages.
@@ -1649,31 +1710,6 @@
configuration.add("Secure", secureFilter);
}
- /**
- * Builds the component action request handler for traditional (non-Ajax) requests. These typically result in a
- * redirect to a Tapestry render URL.
- *
- * @see org.apache.tapestry.internal.services.ComponentEventRequestHandlerImpl
- */
- @Marker(Traditional.class)
- public ComponentEventRequestHandler buildComponentEventRequestHandler(
- List<ComponentEventRequestFilter> configuration, Logger logger, ServiceResources resources)
- {
- return _pipelineBuilder.build(logger, ComponentEventRequestHandler.class, ComponentEventRequestFilter.class,
- configuration, resources.autobuild(ComponentEventRequestHandlerImpl.class));
- }
-
- /**
- * Builds the action request handler for Ajax requests, based on {@link org.apache.tapestry.internal.services.AjaxComponentEventRequestHandler}.
- * Filters on the request handler are supported here as well.
- */
- @Marker(Ajax.class)
- public ComponentEventRequestHandler buildAjaxComponentEventRequestHandler(
- List<ComponentEventRequestFilter> configuration, Logger logger, ServiceResources resources)
- {
- return _pipelineBuilder.build(logger, ComponentEventRequestHandler.class, ComponentEventRequestFilter.class,
- configuration, resources.autobuild(AjaxComponentEventRequestHandler.class));
- }
/**
* Configures the extensions that will require a digest to be downloaded via the asset dispatcher. Most resources
@@ -1773,162 +1809,6 @@
configuration.add(TapestryConstants.RESPONSE_ENCODING, "UTF-8");
}
- public PageTemplateLocator build(@ContextProvider AssetFactory contextAssetFactory,
-
- ComponentClassResolver componentClassResolver)
- {
- return new PageTemplateLocatorImpl(contextAssetFactory.getRootResource(), componentClassResolver);
- }
-
- public ComponentInstantiatorSource build(@Builtin ClassFactory classFactory,
-
- ComponentClassTransformer transformer,
-
- Logger logger,
-
- InternalRequestGlobals internalRequestGlobals)
- {
- ComponentInstantiatorSourceImpl source = new ComponentInstantiatorSourceImpl(logger, classFactory
- .getClassLoader(), transformer, internalRequestGlobals);
-
- _updateListenerHub.addUpdateListener(source);
-
- return source;
- }
-
- public ComponentClassTransformer buildComponentClassTransformer(ServiceResources resources)
- {
- ComponentClassTransformerImpl transformer = resources
- .autobuild(ComponentClassTransformerImpl.class);
-
- _componentInstantiatorSource.addInvalidationListener(transformer);
-
- return transformer;
- }
-
- public PagePool build(PageLoader pageLoader, ComponentMessagesSource componentMessagesSource,
- ServiceResources resources)
- {
- PagePoolImpl service = resources.autobuild(PagePoolImpl.class);
-
- // This covers invalidations due to changes to classes
-
- pageLoader.addInvalidationListener(service);
-
- // This covers invalidation due to changes to message catalogs (properties files)
-
- componentMessagesSource.addInvalidationListener(service);
-
- // ... and this covers invalidations due to changes to templates
-
- _componentTemplateSource.addInvalidationListener(service);
-
- // Give the service a chance to clean up its own cache periodically as well
-
- _updateListenerHub.addUpdateListener(service);
-
- return service;
- }
-
- public PageLoader buildPageLoader(ServiceResources resources)
- {
- PageLoaderImpl service = resources.autobuild(PageLoaderImpl.class);
-
-// Recieve invalidations when the class loader is discarded (due to a component class
-// change). The notification is forwarded to the page loader's listeners.
-
- _componentInstantiatorSource.addInvalidationListener(service);
-
- return service;
- }
-
- @Scope(PERTHREAD_SCOPE)
- public RequestPageCache build(PagePool pagePool)
- {
- RequestPageCacheImpl service = new RequestPageCacheImpl(pagePool);
-
- _perthreadManager.addThreadCleanupListener(service);
-
- return service;
- }
-
- public ResourceCache build(ResourceDigestGenerator digestGenerator)
- {
- ResourceCacheImpl service = new ResourceCacheImpl(digestGenerator);
-
- _updateListenerHub.addUpdateListener(service);
-
- return service;
- }
-
- public ComponentTemplateSource build(TemplateParser parser, PageTemplateLocator locator)
- {
- ComponentTemplateSourceImpl service = new ComponentTemplateSourceImpl(parser, locator);
-
- _updateListenerHub.addUpdateListener(service);
-
- return service;
- }
-
- @Marker(ClasspathProvider.class)
- public AssetFactory buildClasspathAssetFactory(ResourceCache resourceCache, ClasspathAssetAliasManager aliasManager)
- {
- ClasspathAssetFactory factory = new ClasspathAssetFactory(resourceCache, aliasManager);
-
- resourceCache.addInvalidationListener(factory);
-
- return factory;
- }
-
- @Marker(ContextProvider.class)
- public AssetFactory buildContextAssetFactory(ApplicationGlobals globals, RequestPathOptimizer optimizer)
- {
- return new ContextAssetFactory(_request, globals.getContext(), optimizer);
- }
-
- public CookieSink buildCookieSink()
- {
- return new CookieSink()
- {
-
- public void addCookie(Cookie cookie)
- {
- _requestGlobals.getHTTPServletResponse().addCookie(cookie);
- }
-
- };
- }
-
- public CookieSource buildCookieSource()
- {
- return new CookieSource()
- {
-
- public Cookie[] getCookies()
- {
- return _requestGlobals.getHTTPServletRequest().getCookies();
- }
-
- };
- }
-
- /**
- * Builds the PropBindingFactory as a chain of command. The terminator of the chain is responsible for ordinary
- * property names (and property paths). Contributions to the service cover additional special cases, such as simple
- * literal values.
- *
- * @param configuration contributions of special factories for some constants, each contributed factory may return a
- * binding if applicable, or null otherwise
- */
- public BindingFactory buildPropBindingFactory(List<BindingFactory> configuration,
- PropertyConduitSource propertyConduitSource)
- {
- PropBindingFactory service = new PropBindingFactory(propertyConduitSource);
-
- configuration.add(service);
-
- return _chainBuilder.build(BindingFactory.class, configuration);
- }
/**
* Adds content types for "css" and "js" file extensions. <dl> <dt>css</dt> <dd>test/css</dd> <dt>js</dt>
@@ -1947,14 +1827,15 @@
* realization of {@link ComponentClassResolver} at startup.
*/
public void contributeApplicationInitializer(OrderedConfiguration<ApplicationInitializerFilter> configuration,
- final PropertyAccess propertyAccess, final TypeCoercer typeCoercer,
+ final TypeCoercer typeCoercer,
final ComponentClassResolver componentClassResolver)
{
final InvalidationListener listener = new InvalidationListener()
{
public void objectWasInvalidated()
{
- propertyAccess.clearCache();
+ _propertyAccess.clearCache();
+
typeCoercer.clearCache();
}
};
@@ -2084,7 +1965,7 @@
BindingFactory stringFactory = new BindingFactory()
{
-// This will match embedded single quotes as-is, no escaping necessary.
+ // This will match embedded single quotes as-is, no escaping necessary.
private final Pattern _pattern = Pattern.compile("^\\s*'(.*)'\\s*$");
@@ -2104,7 +1985,7 @@
}
};
-// To be honest, order probably doesn't matter.
+ // To be honest, order probably doesn't matter.
configuration.add("Keyword", keywordFactory);
configuration.add("This", thisFactory);
@@ -2114,18 +1995,6 @@
configuration.add("StringLiteral", stringFactory);
}
-
- public PersistentFieldStrategy buildClientPersistentFieldStrategy(LinkFactory linkFactory,
- ServiceResources resources)
- {
- ClientPersistentFieldStrategy service = resources
- .autobuild(ClientPersistentFieldStrategy.class);
-
- linkFactory.addListener(service);
-
- return service;
- }
-
/**
* Contributes filters: <dl> <dt>Ajax</dt> <dd>Determines if the request is Ajax oriented, and redirects to an
* alternative handler if so</dd> <dt>ImmediateRender</dt> <dd>When {@linkplain
@@ -2156,29 +2025,6 @@
configuration.add("Secure", secureFilter, "before:Ajax");
}
- public ComponentClassCache buildComponentClassCache(@ComponentLayer ClassFactory classFactory)
- {
- ComponentClassCacheImpl service = new ComponentClassCacheImpl(classFactory);
-
- _componentInstantiatorSource.addInvalidationListener(service);
-
- return service;
- }
-
- /**
- * Chooses one of two implementations, based on the configured mode.
- */
- public ActionRenderResponseGenerator buildActionRenderResponseGenerator(
-
- @Symbol(TapestryConstants.SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS_SYMBOL)
- boolean immediateMode,
-
- ObjectLocator locator)
- {
- if (immediateMode) return locator.autobuild(ImmediateActionRenderResponseGenerator.class);
-
- return locator.autobuild(ActionRenderResponseGeneratorImpl.class);
- }
/**
* Contributes strategies accessible via the {@link NullFieldStrategySource} service.
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/tapestry.js Sat Apr 19 11:33:09 2008
@@ -136,38 +136,6 @@
return manager;
},
- initValidations : function(clientValidations)
- {
- $H(clientValidations).each(function(pair)
- {
- var field = $(pair.key);
-
- Tapestry.getFormEventManager(field.form);
-
- var specs = pair.value;
-
- specs.each(function(spec)
- {
- // spec is a 2 or 3 element array.
- // validator function name, message, optional constraint
-
- var name = spec[0];
- var message = spec[1];
- var constraint = spec[2];
-
- var vfunc = Tapestry.Validator[name];
-
- if (vfunc == undefined)
- {
- Tapestry.logError("Function Tapestry.Validator.#{name}() does not exist for field '#{fieldName}'.", {name:name, fieldName:pair.key});
- return;
- }
-
- vfunc.call(this, field, message, constraint);
- });
- });
- },
-
/**
* Passed the JSON content of a Tapestry partial markup response, extracts
* the script key (if present) and evals it, then uses the DOM loaded callback
@@ -263,6 +231,33 @@
};
element.onclick = handler;
+ },
+
+ validate : function (field, specs)
+ {
+ field = $(field);
+
+ Tapestry.getFormEventManager(field.form);
+
+ specs.each(function(spec)
+ {
+ // spec is a 2 or 3 element array.
+ // validator function name, message, optional constraint
+
+ var name = spec[0];
+ var message = spec[1];
+ var constraint = spec[2];
+
+ var vfunc = Tapestry.Validator[name];
+
+ if (vfunc == undefined)
+ {
+ Tapestry.logError("Function Tapestry.Validator.#{name}() does not exist for field '#{fieldName}'.", {name:name, fieldName:pair.key});
+ return;
+ }
+
+ vfunc.call(this, field, message, constraint);
+ });
},
zone : function(spec)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt?rev=649837&r1=649836&r2=649837&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt Sat Apr 19 11:33:09 2008
@@ -14,6 +14,12 @@
Release 5.0.12
+* TapestryModule
+
+ Many of the internal services of Tapestry have been split off into their own module,
+ {{{../apidocs/org/apache/tapestry/internal/services/InternalModule.html}InternalModule}}.
+ This should not affect any user code.
+
* Form component
The default {{{../apidocs/org/apache/tapestry/ValidationTracker.html}ValidationTracker}}