Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…adjustments for changed APIs and behaviors
  • Loading branch information...
commit 1a155d195b285d74c0566d480c58654c98ffa180 1 parent bfd1c1b
Howard M. Lewis Ship authored

Showing 12 changed files with 32 additions and 75 deletions. Show diff stats Hide diff stats

  1. +1 1  build.gradle
  2. +16 28 tapx-templating/src/main/java/com/howardlewisship/tapx/templating/TemplateAPI.java
  3. +0 24 tapx-templating/src/main/java/com/howardlewisship/tapx/templating/TemplateConstants.java
  4. +4 5 tapx-templating/src/main/java/com/howardlewisship/tapx/templating/internal/services/CheckForUpdatesAdvice.java
  5. +3 0  tapx-templating/src/main/java/com/howardlewisship/tapx/templating/internal/services/TemplateRequest.java
  6. +2 3 tapx-templating/src/main/java/com/howardlewisship/tapx/templating/services/TemplateModule.java
  7. +1 8 tapx-templating/src/test/java/com/howardlewisship/tapx/templating/base/AbstractTemplatingIntegrationTest.java
  8. +1 1  ...rc/test/resources/com/howardlewisship/tapx/templating/integration/context_asset_from_alternate_location.txt
  9. +1 1  .../src/test/resources/com/howardlewisship/tapx/templating/integration/context_asset_from_default_location.txt
  10. +1 2  tapx-templating/src/test/resources/com/howardlewisship/tapx/templating/integration/global_message_catalog.txt
  11. +1 1  tapx-templating/src/test/resources/com/howardlewisship/tapx/templating/integration/init_before_render.txt
  12. +1 1  tapx-templating/src/test/resources/com/howardlewisship/tapx/templating/integration/simple.txt
2  build.gradle
... ... @@ -1,6 +1,6 @@
1 1 description = "Collection of add-ons for Tapestry 5"
2 2
3   -tapestryVersion = "5.3-beta-19"
  3 +tapestryVersion = "5.3"
4 4
5 5 if (!project.hasProperty('deployUserName')) deployUserName = '*UNSET-USERNAME*'
6 6 if (!project.hasProperty('deployPassword')) deployPassword = '*UNSET-PASSWORD*'
44 tapx-templating/src/main/java/com/howardlewisship/tapx/templating/TemplateAPI.java
... ... @@ -1,4 +1,4 @@
1   -// Copyright 2009, 2010 Howard M. Lewis Ship
  1 +// Copyright 2009, 2010, 2011 Howard M. Lewis Ship
2 2 //
3 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 4 // you may not use this file except in compliance with the License.
@@ -14,9 +14,9 @@
14 14
15 15 package com.howardlewisship.tapx.templating;
16 16
17   -import java.io.File;
18   -import java.io.IOException;
19   -
  17 +import com.howardlewisship.tapx.templating.internal.TemplateContext;
  18 +import com.howardlewisship.tapx.templating.services.TemplateModule;
  19 +import com.howardlewisship.tapx.templating.services.TemplateRendererSource;
20 20 import org.apache.tapestry5.internal.TapestryAppInitializer;
21 21 import org.apache.tapestry5.ioc.Registry;
22 22 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
@@ -25,16 +25,14 @@
25 25 import org.slf4j.Logger;
26 26 import org.slf4j.LoggerFactory;
27 27
28   -import com.howardlewisship.tapx.templating.internal.TemplateContext;
29   -import com.howardlewisship.tapx.templating.services.TemplateModule;
30   -import com.howardlewisship.tapx.templating.services.TemplateRendererSource;
  28 +import java.io.File;
  29 +import java.io.IOException;
31 30
32 31 /**
33 32 * Responsible for starting up the Tapestry Template Library, analagous to how TapestryFilter starts up a Tapestry
34 33 * application.
35 34 */
36   -public class TemplateAPI implements TemplateRendererSource
37   -{
  35 +public class TemplateAPI implements TemplateRendererSource {
38 36 private final Logger logger = LoggerFactory.getLogger(TemplateAPI.class);
39 37
40 38 private final TemplateRendererSource templateRendererSource;
@@ -52,15 +50,13 @@
52 50 * @param applicationPackage root package name to search for pages, components and services
53 51 * @param contextDirectory directory containing static resources and template files
54 52 */
55   - public TemplateAPI(String applicationPackage, File contextDirectory)
56   - {
  53 + public TemplateAPI(String applicationPackage, File contextDirectory) {
57 54 assert InternalUtils.isNonBlank(applicationPackage);
58 55 assert contextDirectory != null;
59 56
60 57 Context context = new TemplateContext(contextDirectory);
61 58
62   - TapestryAppInitializer initializer = new TapestryAppInitializer(logger, applicationPackage, "app",
63   - TemplateConstants.TEMPLATE_MODE);
  59 + TapestryAppInitializer initializer = new TapestryAppInitializer(logger, applicationPackage, "app");
64 60
65 61 initializer.addModules(TemplateModule.class);
66 62
@@ -84,8 +80,7 @@ public TemplateAPI(String applicationPackage, File contextDirectory)
84 80 * This method must be called after rendering content; it ensures that any resources used during rendering are
85 81 * cleaned up (this includes returning page instances to the page pool for later reuse).
86 82 */
87   - public void cleanupThread()
88   - {
  83 + public void cleanupThread() {
89 84 registry.cleanupThread();
90 85 }
91 86
@@ -98,8 +93,7 @@ public void cleanupThread()
98 93 * (it is intended to support location-specific content delivery servers)
99 94 * @return the renderer
100 95 */
101   - public TemplateRenderer createRenderer(String templateName, String localeName, String location)
102   - {
  96 + public TemplateRenderer createRenderer(String templateName, String localeName, String location) {
103 97 return templateRendererSource.createRenderer(templateName, localeName, location);
104 98 }
105 99
@@ -116,16 +110,12 @@ public TemplateRenderer createRenderer(String templateName, String localeName, S
116 110 */
117 111 public void performTemplateRendererOperation(String templateName, String localeName, String location,
118 112 TemplateRendererCallback callback)
119   - throws IOException
120   - {
121   - try
122   - {
  113 + throws IOException {
  114 + try {
123 115 TemplateRenderer renderer = createRenderer(templateName, localeName, location);
124 116
125 117 callback.performOperation(renderer);
126   - }
127   - finally
128   - {
  118 + } finally {
129 119 cleanupThread();
130 120 }
131 121 }
@@ -137,16 +127,14 @@ public void performTemplateRendererOperation(String templateName, String localeN
137 127 *
138 128 * @return the services registry
139 129 */
140   - public Registry getRegistry()
141   - {
  130 + public Registry getRegistry() {
142 131 return registry;
143 132 }
144 133
145 134 /**
146 135 * Shuts down the Registry, which immediately invalidates all services.
147 136 */
148   - public void shutdown()
149   - {
  137 + public void shutdown() {
150 138 registry.shutdown();
151 139 }
152 140 }
24 tapx-templating/src/main/java/com/howardlewisship/tapx/templating/TemplateConstants.java
... ... @@ -1,24 +0,0 @@
1   -// Copyright 2009 Howard M. Lewis Ship
2   -//
3   -// Licensed under the Apache License, Version 2.0 (the "License");
4   -// you may not use this file except in compliance with the License.
5   -// You may obtain a copy of the License at
6   -//
7   -// http://www.apache.org/licenses/LICENSE-2.0
8   -//
9   -// Unless required by applicable law or agreed to in writing, software
10   -// distributed under the License is distributed on an "AS IS" BASIS,
11   -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   -// See the License for the specific language governing permissions and
13   -// limitations under the License.
14   -
15   -package com.howardlewisship.tapx.templating;
16   -
17   -public class TemplateConstants
18   -{
19   - /**
20   - * Mode, used with the {@link org.apache.tapestry5.services.Alias} service, to override certain services when in
21   - * template mode (rather than the default, "servlet", mode).
22   - */
23   - public static final String TEMPLATE_MODE = "template";
24   -}
9 ...emplating/src/main/java/com/howardlewisship/tapx/templating/internal/services/CheckForUpdatesAdvice.java
... ... @@ -1,4 +1,4 @@
1   -// Copyright 2009 Howard M. Lewis Ship
  1 +// Copyright 2009, 2011 Howard M. Lewis Ship
2 2 //
3 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 4 // you may not use this file except in compliance with the License.
@@ -15,12 +15,12 @@
15 15 package com.howardlewisship.tapx.templating.internal.services;
16 16
17 17 import org.apache.tapestry5.SymbolConstants;
18   -import org.apache.tapestry5.ioc.Invocation;
19   -import org.apache.tapestry5.ioc.MethodAdvice;
20 18 import org.apache.tapestry5.ioc.annotations.IntermediateType;
21 19 import org.apache.tapestry5.ioc.annotations.Symbol;
22 20 import org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier;
23 21 import org.apache.tapestry5.ioc.util.TimeInterval;
  22 +import org.apache.tapestry5.plastic.MethodAdvice;
  23 +import org.apache.tapestry5.plastic.MethodInvocation;
24 24 import org.apache.tapestry5.services.UpdateListenerHub;
25 25
26 26 import java.util.concurrent.TimeUnit;
@@ -87,7 +87,7 @@ public CheckForUpdatesAdvice(UpdateListenerHub updateListenerHub,
87 87 }
88 88
89 89
90   - public void advise(final Invocation invocation)
  90 + public void advise(final MethodInvocation invocation)
91 91 {
92 92 Runnable checkAndProceed = new Runnable()
93 93 {
@@ -98,7 +98,6 @@ public void run()
98 98
99 99 // And, now, back to code within the read lock.
100 100
101   -
102 101 invocation.proceed();
103 102 }
104 103 };
3  tapx-templating/src/main/java/com/howardlewisship/tapx/templating/internal/services/TemplateRequest.java
@@ -139,4 +139,7 @@ public int getServerPort()
139 139 return 80;
140 140 }
141 141
  142 + public String getRemoteHost() {
  143 + return null;
  144 + }
142 145 }
5 tapx-templating/src/main/java/com/howardlewisship/tapx/templating/services/TemplateModule.java
... ... @@ -1,4 +1,4 @@
1   -// Copyright 2009, 2010 Howard M. Lewis Ship
  1 +// Copyright 2009, 2010, 2011 Howard M. Lewis Ship
2 2 //
3 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 4 // you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
15 15 package com.howardlewisship.tapx.templating.services;
16 16
17 17 import com.howardlewisship.tapx.templating.internal.services.*;
18   -
19 18 import org.apache.tapestry5.SymbolConstants;
20 19 import org.apache.tapestry5.internal.InternalSymbols;
21 20 import org.apache.tapestry5.ioc.MappedConfiguration;
@@ -53,7 +52,7 @@ public static void contributeFactoryDefaults(MappedConfiguration<String, String>
53 52 */
54 53 public static void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration)
55 54 {
56   - configuration.override("InjectDefaultStyleheet", null);
  55 + configuration.override("InjectDefaultStylesheet", null);
57 56 }
58 57
59 58 /**
9 ...templating/src/test/java/com/howardlewisship/tapx/templating/base/AbstractTemplatingIntegrationTest.java
... ... @@ -1,4 +1,4 @@
1   -// Copyright 2009 Howard M. Lewis Ship
  1 +// Copyright 2009, 2011 Howard M. Lewis Ship
2 2 //
3 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 4 // you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
17 17 import com.howardlewisship.tapx.templating.RenderedStream;
18 18 import com.howardlewisship.tapx.templating.TemplateAPI;
19 19 import com.howardlewisship.tapx.templating.TemplateRenderer;
20   -
21 20 import org.apache.tapestry5.SymbolConstants;
22 21 import org.apache.tapestry5.internal.TapestryInternalUtils;
23 22 import org.apache.tapestry5.ioc.Registry;
@@ -101,12 +100,6 @@ protected void compare(RenderedStream renderedStream, String expectedContentType
101 100 }
102 101 }
103 102
104   - protected void compare(InputStream actualStream, String contentFile)
105   - throws IOException
106   - {
107   - compare(actualStream, getClass().getResourceAsStream(contentFile));
108   - }
109   -
110 103 protected void compare(InputStream actualStream, InputStream expectedStream)
111 104 throws IOException
112 105 {
2  ...test/resources/com/howardlewisship/tapx/templating/integration/context_asset_from_alternate_location.txt
... ... @@ -1,3 +1,3 @@
1   -<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta></head>
  1 +<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/></head>
2 2 <img src="http://eurocdn.foo.com/public/1.1/shared-content/images/ball_fr.png"/>
3 3 </html>
2  ...c/test/resources/com/howardlewisship/tapx/templating/integration/context_asset_from_default_location.txt
... ... @@ -1,5 +1,5 @@
1 1 <html><head>
2   -<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta>
  2 +<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/>
3 3 </head>
4 4 <img src="http://defaultcdn.foo.com/content/1.1/images/ball.png"/>
5 5 </html>
3  ...templating/src/test/resources/com/howardlewisship/tapx/templating/integration/global_message_catalog.txt
... ... @@ -1,7 +1,6 @@
1 1 <html>
2 2 <head>
3   -<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator">
4   -</meta>
  3 +<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/>
5 4 </head>
6 5 <body>
7 6 <dl><dt>Global</dt>
2  tapx-templating/src/test/resources/com/howardlewisship/tapx/templating/integration/init_before_render.txt
... ... @@ -1,3 +1,3 @@
1   -<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta></head><body>
  1 +<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/></head><body>
2 2 The number is: 42
3 3 </body></html>
2  tapx-templating/src/test/resources/com/howardlewisship/tapx/templating/integration/simple.txt
... ... @@ -1,6 +1,6 @@
1 1 <html>
2 2 <head>
3   -<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta>
  3 +<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/>
4 4 </head>
5 5 <h1>Simple Template Test</h1>
6 6 </html>

0 comments on commit 1a155d1

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