Skip to content
Browse files

Update Tapestry dependency to the newly released 5.3, and make minor …

…adjustments for changed APIs and behaviors
  • Loading branch information...
1 parent bfd1c1b commit 1a155d195b285d74c0566d480c58654c98ffa180 @hlship committed Nov 22, 2011
View
2 build.gradle
@@ -1,6 +1,6 @@
description = "Collection of add-ons for Tapestry 5"
-tapestryVersion = "5.3-beta-19"
+tapestryVersion = "5.3"
if (!project.hasProperty('deployUserName')) deployUserName = '*UNSET-USERNAME*'
if (!project.hasProperty('deployPassword')) deployPassword = '*UNSET-PASSWORD*'
View
44 tapx-templating/src/main/java/com/howardlewisship/tapx/templating/TemplateAPI.java
@@ -1,4 +1,4 @@
-// Copyright 2009, 2010 Howard M. Lewis Ship
+// Copyright 2009, 2010, 2011 Howard M. Lewis Ship
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,9 +14,9 @@
package com.howardlewisship.tapx.templating;
-import java.io.File;
-import java.io.IOException;
-
+import com.howardlewisship.tapx.templating.internal.TemplateContext;
+import com.howardlewisship.tapx.templating.services.TemplateModule;
+import com.howardlewisship.tapx.templating.services.TemplateRendererSource;
import org.apache.tapestry5.internal.TapestryAppInitializer;
import org.apache.tapestry5.ioc.Registry;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
@@ -25,16 +25,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.howardlewisship.tapx.templating.internal.TemplateContext;
-import com.howardlewisship.tapx.templating.services.TemplateModule;
-import com.howardlewisship.tapx.templating.services.TemplateRendererSource;
+import java.io.File;
+import java.io.IOException;
/**
* Responsible for starting up the Tapestry Template Library, analagous to how TapestryFilter starts up a Tapestry
* application.
*/
-public class TemplateAPI implements TemplateRendererSource
-{
+public class TemplateAPI implements TemplateRendererSource {
private final Logger logger = LoggerFactory.getLogger(TemplateAPI.class);
private final TemplateRendererSource templateRendererSource;
@@ -52,15 +50,13 @@
* @param applicationPackage root package name to search for pages, components and services
* @param contextDirectory directory containing static resources and template files
*/
- public TemplateAPI(String applicationPackage, File contextDirectory)
- {
+ public TemplateAPI(String applicationPackage, File contextDirectory) {
assert InternalUtils.isNonBlank(applicationPackage);
assert contextDirectory != null;
Context context = new TemplateContext(contextDirectory);
- TapestryAppInitializer initializer = new TapestryAppInitializer(logger, applicationPackage, "app",
- TemplateConstants.TEMPLATE_MODE);
+ TapestryAppInitializer initializer = new TapestryAppInitializer(logger, applicationPackage, "app");
initializer.addModules(TemplateModule.class);
@@ -84,8 +80,7 @@ public TemplateAPI(String applicationPackage, File contextDirectory)
* This method must be called after rendering content; it ensures that any resources used during rendering are
* cleaned up (this includes returning page instances to the page pool for later reuse).
*/
- public void cleanupThread()
- {
+ public void cleanupThread() {
registry.cleanupThread();
}
@@ -98,8 +93,7 @@ public void cleanupThread()
* (it is intended to support location-specific content delivery servers)
* @return the renderer
*/
- public TemplateRenderer createRenderer(String templateName, String localeName, String location)
- {
+ public TemplateRenderer createRenderer(String templateName, String localeName, String location) {
return templateRendererSource.createRenderer(templateName, localeName, location);
}
@@ -116,16 +110,12 @@ public TemplateRenderer createRenderer(String templateName, String localeName, S
*/
public void performTemplateRendererOperation(String templateName, String localeName, String location,
TemplateRendererCallback callback)
- throws IOException
- {
- try
- {
+ throws IOException {
+ try {
TemplateRenderer renderer = createRenderer(templateName, localeName, location);
callback.performOperation(renderer);
- }
- finally
- {
+ } finally {
cleanupThread();
}
}
@@ -137,16 +127,14 @@ public void performTemplateRendererOperation(String templateName, String localeN
*
* @return the services registry
*/
- public Registry getRegistry()
- {
+ public Registry getRegistry() {
return registry;
}
/**
* Shuts down the Registry, which immediately invalidates all services.
*/
- public void shutdown()
- {
+ public void shutdown() {
registry.shutdown();
}
}
View
24 tapx-templating/src/main/java/com/howardlewisship/tapx/templating/TemplateConstants.java
@@ -1,24 +0,0 @@
-// Copyright 2009 Howard M. Lewis Ship
-//
-// 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 com.howardlewisship.tapx.templating;
-
-public class TemplateConstants
-{
- /**
- * Mode, used with the {@link org.apache.tapestry5.services.Alias} service, to override certain services when in
- * template mode (rather than the default, "servlet", mode).
- */
- public static final String TEMPLATE_MODE = "template";
-}
View
9 ...ain/java/com/howardlewisship/tapx/templating/internal/services/CheckForUpdatesAdvice.java
@@ -1,4 +1,4 @@
-// Copyright 2009 Howard M. Lewis Ship
+// Copyright 2009, 2011 Howard M. Lewis Ship
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -15,12 +15,12 @@
package com.howardlewisship.tapx.templating.internal.services;
import org.apache.tapestry5.SymbolConstants;
-import org.apache.tapestry5.ioc.Invocation;
-import org.apache.tapestry5.ioc.MethodAdvice;
import org.apache.tapestry5.ioc.annotations.IntermediateType;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier;
import org.apache.tapestry5.ioc.util.TimeInterval;
+import org.apache.tapestry5.plastic.MethodAdvice;
+import org.apache.tapestry5.plastic.MethodInvocation;
import org.apache.tapestry5.services.UpdateListenerHub;
import java.util.concurrent.TimeUnit;
@@ -87,7 +87,7 @@ public CheckForUpdatesAdvice(UpdateListenerHub updateListenerHub,
}
- public void advise(final Invocation invocation)
+ public void advise(final MethodInvocation invocation)
{
Runnable checkAndProceed = new Runnable()
{
@@ -98,7 +98,6 @@ public void run()
// And, now, back to code within the read lock.
-
invocation.proceed();
}
};
View
3 .../src/main/java/com/howardlewisship/tapx/templating/internal/services/TemplateRequest.java
@@ -139,4 +139,7 @@ public int getServerPort()
return 80;
}
+ public String getRemoteHost() {
+ return null;
+ }
}
View
5 ...templating/src/main/java/com/howardlewisship/tapx/templating/services/TemplateModule.java
@@ -1,4 +1,4 @@
-// Copyright 2009, 2010 Howard M. Lewis Ship
+// Copyright 2009, 2010, 2011 Howard M. Lewis Ship
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
package com.howardlewisship.tapx.templating.services;
import com.howardlewisship.tapx.templating.internal.services.*;
-
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.InternalSymbols;
import org.apache.tapestry5.ioc.MappedConfiguration;
@@ -53,7 +52,7 @@ public static void contributeFactoryDefaults(MappedConfiguration<String, String>
*/
public static void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration)
{
- configuration.override("InjectDefaultStyleheet", null);
+ configuration.override("InjectDefaultStylesheet", null);
}
/**
View
9 ...test/java/com/howardlewisship/tapx/templating/base/AbstractTemplatingIntegrationTest.java
@@ -1,4 +1,4 @@
-// Copyright 2009 Howard M. Lewis Ship
+// Copyright 2009, 2011 Howard M. Lewis Ship
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
import com.howardlewisship.tapx.templating.RenderedStream;
import com.howardlewisship.tapx.templating.TemplateAPI;
import com.howardlewisship.tapx.templating.TemplateRenderer;
-
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.TapestryInternalUtils;
import org.apache.tapestry5.ioc.Registry;
@@ -101,12 +100,6 @@ protected void compare(RenderedStream renderedStream, String expectedContentType
}
}
- protected void compare(InputStream actualStream, String contentFile)
- throws IOException
- {
- compare(actualStream, getClass().getResourceAsStream(contentFile));
- }
-
protected void compare(InputStream actualStream, InputStream expectedStream)
throws IOException
{
View
2 ...com/howardlewisship/tapx/templating/integration/context_asset_from_alternate_location.txt
@@ -1,3 +1,3 @@
-<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta></head>
+<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/></head>
<img src="http://eurocdn.foo.com/public/1.1/shared-content/images/ball_fr.png"/>
</html>
View
2 ...s/com/howardlewisship/tapx/templating/integration/context_asset_from_default_location.txt
@@ -1,5 +1,5 @@
<html><head>
-<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta>
+<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/>
</head>
<img src="http://defaultcdn.foo.com/content/1.1/images/ball.png"/>
</html>
View
3 ...test/resources/com/howardlewisship/tapx/templating/integration/global_message_catalog.txt
@@ -1,7 +1,6 @@
<html>
<head>
-<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator">
-</meta>
+<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/>
</head>
<body>
<dl><dt>Global</dt>
View
2 ...src/test/resources/com/howardlewisship/tapx/templating/integration/init_before_render.txt
@@ -1,3 +1,3 @@
-<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta></head><body>
+<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/></head><body>
The number is: 42
</body></html>
View
2 ...-templating/src/test/resources/com/howardlewisship/tapx/templating/integration/simple.txt
@@ -1,6 +1,6 @@
<html>
<head>
-<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta>
+<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/>
</head>
<h1>Simple Template Test</h1>
</html>

0 comments on commit 1a155d1

Please sign in to comment.
Something went wrong with that request. Please try again.