[java-idp-plugin-thymeleaf] branch main updated: Adjust package name and fix wiring issues.

Scott Cantor cantor.2 at osu.edu
Tue Feb 6 20:06:57 UTC 2024


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-idp-plugin-thymeleaf.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-thymeleaf.git;a=commit;h=3726eeee4eb7281dd8f88256fed793bf24a0d5ea

The following commit(s) were added to refs/heads/main by this push:
     new 3726eee  Adjust package name and fix wiring issues.
3726eee is described below

commit 3726eeee4eb7281dd8f88256fed793bf24a0d5ea
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Feb 6 15:06:54 2024 -0500

    Adjust package name and fix wiring issues.
---
 thymeleaf-impl/pom.xml                             |  2 +-
 .../thymeleaf/{impl => }/ThymeleafModule.java      |  2 +-
 .../thymeleaf/{impl => }/ThymeleafPlugin.java      |  2 +-
 .../idp/plugin/thymeleaf/{impl => }/Version.java   |  2 +-
 .../plugin/thymeleaf/{impl => }/package-info.java  |  2 +-
 .../impl/TemplateResolverSetFactoryBean.java       | 20 +++++++++++---
 .../META-INF/net/shibboleth/idp/mvc/postconfig.xml | 31 +++++++++++-----------
 .../services/net.shibboleth.idp.module.IdPModule   |  2 +-
 .../services/net.shibboleth.idp.plugin.IdPPlugin   |  2 +-
 .../idp/plugin/thymeleaf/module.properties         |  2 +-
 .../idp/plugin/thymeleaf/plugin.properties         |  3 +++
 11 files changed, 43 insertions(+), 27 deletions(-)

diff --git a/thymeleaf-impl/pom.xml b/thymeleaf-impl/pom.xml
index 159e4f3..a7735fd 100644
--- a/thymeleaf-impl/pom.xml
+++ b/thymeleaf-impl/pom.xml
@@ -15,7 +15,7 @@
     
     <properties>
         <checkstyle.configLocation>${project.basedir}/../resources/checkstyle/checkstyle.xml</checkstyle.configLocation>
-        <automatic.module.name>net.shibboleth.idp.plugin.thymeleaf.impl</automatic.module.name>
+        <automatic.module.name>net.shibboleth.idp.plugin.thymeleaf</automatic.module.name>
     </properties>
     
     <dependencies>
diff --git a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/ThymeleafModule.java b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/ThymeleafModule.java
similarity index 95%
rename from thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/ThymeleafModule.java
rename to thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/ThymeleafModule.java
index 18cf62c..6ae0545 100644
--- a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/ThymeleafModule.java
+++ b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/ThymeleafModule.java
@@ -12,7 +12,7 @@
  * limitations under the License.
  */
 
-package net.shibboleth.idp.plugin.thymeleaf.impl;
+package net.shibboleth.idp.plugin.thymeleaf;
 
 import java.io.IOException;
 
diff --git a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/ThymeleafPlugin.java b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/ThymeleafPlugin.java
similarity index 95%
rename from thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/ThymeleafPlugin.java
rename to thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/ThymeleafPlugin.java
index 15b4acc..e5781ea 100644
--- a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/ThymeleafPlugin.java
+++ b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/ThymeleafPlugin.java
@@ -12,7 +12,7 @@
  * limitations under the License.
  */
 
-package net.shibboleth.idp.plugin.thymeleaf.impl;
+package net.shibboleth.idp.plugin.thymeleaf;
 
 import java.io.IOException;
 
diff --git a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/Version.java b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/Version.java
similarity index 96%
rename from thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/Version.java
rename to thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/Version.java
index 20cbbd7..b138e02 100644
--- a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/Version.java
+++ b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/Version.java
@@ -12,7 +12,7 @@
  * limitations under the License.
  */
 
-package net.shibboleth.idp.plugin.thymeleaf.impl;
+package net.shibboleth.idp.plugin.thymeleaf;
 
 import javax.annotation.Nullable;
 
diff --git a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/package-info.java b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/package-info.java
similarity index 92%
rename from thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/package-info.java
rename to thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/package-info.java
index 91a6325..a415f13 100644
--- a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/impl/package-info.java
+++ b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/package-info.java
@@ -15,4 +15,4 @@
 /**
  * Support for Thymeleaf.
  */
-package net.shibboleth.idp.plugin.thymeleaf.impl;
\ No newline at end of file
+package net.shibboleth.idp.plugin.thymeleaf;
\ No newline at end of file
diff --git a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/spring/impl/TemplateResolverSetFactoryBean.java b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/spring/impl/TemplateResolverSetFactoryBean.java
index 8406d95..19b5a7b 100644
--- a/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/spring/impl/TemplateResolverSetFactoryBean.java
+++ b/thymeleaf-impl/src/main/java/net/shibboleth/idp/plugin/thymeleaf/spring/impl/TemplateResolverSetFactoryBean.java
@@ -14,12 +14,15 @@
 
 package net.shibboleth.idp.plugin.thymeleaf.spring.impl;
 
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
 import org.springframework.util.StringUtils;
 import org.thymeleaf.spring6.templateresolver.SpringResourceTemplateResolver;
 
@@ -34,8 +37,12 @@ import net.shibboleth.shared.spring.factory.AbstractFactoryBean;
  * 
  * <p>A "template" object must be supplied to copy other supported properties from.</p>
  */
-public class TemplateResolverSetFactoryBean extends AbstractFactoryBean<Set<SpringResourceTemplateResolver>> {
+public class TemplateResolverSetFactoryBean extends AbstractFactoryBean<Set<SpringResourceTemplateResolver>>
+        implements ApplicationContextAware {
 
+    /** Spring context needed by resolvers. */
+    @Nullable private ApplicationContext applicationContext;
+    
     /** Not to be confused with a template resolver... */
     @Nonnull private final SpringResourceTemplateResolver resolverTemplate;
     
@@ -57,6 +64,11 @@ public class TemplateResolverSetFactoryBean extends AbstractFactoryBean<Set<Spri
         }
     }
     
+    /** {@inheritDoc} */
+    public void setApplicationContext(@Nonnull final ApplicationContext context) throws BeansException {
+        applicationContext = context;
+    }
+    
     /** {@inheritDoc} */
     @Override
     @SuppressWarnings("rawtypes")
@@ -67,13 +79,15 @@ public class TemplateResolverSetFactoryBean extends AbstractFactoryBean<Set<Spri
     /** {@inheritDoc} */
     @Override
     @Nullable protected Set<SpringResourceTemplateResolver> createInstance() throws Exception {
-        final Set<SpringResourceTemplateResolver> results = new HashSet<>();
+        final Set<SpringResourceTemplateResolver> results = new LinkedHashSet<>();
         
         int i = 1;
         for (final String path : pathArray) {
             if (path != null && !path.isBlank()) {
                 final SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
                 
+                resolver.setApplicationContext(applicationContext);
+                
                 resolver.setOrder(i);
                 resolver.setName(resolverTemplate.getName() + Integer.toString(i++));
                 resolver.setCheckExistence(resolverTemplate.getCheckExistence());
diff --git a/thymeleaf-impl/src/main/resources/META-INF/net/shibboleth/idp/mvc/postconfig.xml b/thymeleaf-impl/src/main/resources/META-INF/net/shibboleth/idp/mvc/postconfig.xml
index bd88447..b445d46 100644
--- a/thymeleaf-impl/src/main/resources/META-INF/net/shibboleth/idp/mvc/postconfig.xml
+++ b/thymeleaf-impl/src/main/resources/META-INF/net/shibboleth/idp/mvc/postconfig.xml
@@ -11,28 +11,27 @@
 
     <!-- System beans needed by MVC context for plugin to function. -->
     
-    <bean id="shibboleth.ThymeleafViewResolver" class="net.shibboleth.idp.plugin.thymeleaf.spring.impl.ChainingThymeleafViewResolver">
+    <bean id="shibboleth.ThymeleafViewResolver" class="net.shibboleth.idp.plugin.thymeleaf.spring.impl.ChainingThymeleafViewResolver"
+            c:_0-ref="#{'%{idp.views.thymeleaf.activationCondition:shibboleth.Conditions.TRUE}'.trim()}">
         <property name="templateEngine" ref="thymeleafTemplateEngine" />
-        <property name="order" value="%{idp.views.thymeleaf.order:11}" />
+        <property name="order" value="%{idp.views.thymeleaf.order:5}" />
         <property name="contentType" value="text/html;charset=utf-8" />
     </bean>
     
     <bean id="thymeleafTemplateEngine" class="org.thymeleaf.spring6.SpringTemplateEngine">
         <property name="templateResolvers">
-            <util:set>
-                <bean class="net.shibboleth.idp.plugin.thymeleaf.spring.impl.TemplateResolverSetFactoryBean">
-                    <constructor-arg>
-                        <bean class="org.thymeleaf.spring6.templateresolver.SpringResourceTemplateResolver">
-                            <property name="name" value="ThymeleafResolver" />
-                            <property name="checkExistence" value="true"/>
-                            <property name="cacheable" value="true"/>
-                            <property name="templateMode" value="HTML" />
-                            <property name="prefix" value="#{'%{idp.views:%{idp.home}/views}'.trim()},classpath:/net/shibboleth/idp/views,classpath:/META-INF/net/shibboleth/idp/views"/>
-                            <property name="suffix" value=".html"/>
-                        </bean>
-                    </constructor-arg>
-                </bean>
-            </util:set>
+            <bean class="net.shibboleth.idp.plugin.thymeleaf.spring.impl.TemplateResolverSetFactoryBean">
+                <constructor-arg>
+                    <bean class="org.thymeleaf.spring6.templateresolver.SpringResourceTemplateResolver">
+                        <property name="name" value="ThymeleafResolver" />
+                        <property name="checkExistence" value="true"/>
+                        <property name="cacheable" value="true"/>
+                        <property name="templateMode" value="HTML" />
+                        <property name="prefix" value="#{'%{idp.views:%{idp.home}/views}'.trim()},classpath:/net/shibboleth/idp/views,classpath:/META-INF/net/shibboleth/idp/views"/>
+                        <property name="suffix" value=".html"/>
+                    </bean>
+                </constructor-arg>
+            </bean>
         </property>
         <property name="enableSpringELCompiler" value="true" />
     </bean>
diff --git a/thymeleaf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule b/thymeleaf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
index de4fb06..88b7263 100644
--- a/thymeleaf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
+++ b/thymeleaf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
@@ -1 +1 @@
-net.shibboleth.idp.plugin.thymeleaf.impl.ThymeleafModule
+net.shibboleth.idp.plugin.thymeleaf.ThymeleafModule
diff --git a/thymeleaf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin b/thymeleaf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin
index a59e98f..d28911a 100644
--- a/thymeleaf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin
+++ b/thymeleaf-impl/src/main/resources/META-INF/services/net.shibboleth.idp.plugin.IdPPlugin
@@ -1,2 +1,2 @@
-net.shibboleth.idp.plugin.thymeleaf.impl.ThymeleafPlugin
+net.shibboleth.idp.plugin.thymeleaf.ThymeleafPlugin
   
diff --git a/thymeleaf-impl/src/main/resources/net/shibboleth/idp/plugin/thymeleaf/module.properties b/thymeleaf-impl/src/main/resources/net/shibboleth/idp/plugin/thymeleaf/module.properties
index d7a956b..3b9c14a 100644
--- a/thymeleaf-impl/src/main/resources/net/shibboleth/idp/plugin/thymeleaf/module.properties
+++ b/thymeleaf-impl/src/main/resources/net/shibboleth/idp/plugin/thymeleaf/module.properties
@@ -1,7 +1,7 @@
 # Example Properties defining a module.
 
 # Class to Module ID mappings
-net.shibboleth.idp.plugin.thymeleaf.impl.ThymeleafModule = idp.ui.Thymeleaf
+net.shibboleth.idp.plugin.thymeleaf.ThymeleafModule = idp.ui.Thymeleaf
 
 # Module Owner
 idp.ui.Thymeleaf = net.shibboleth.idp.plugin.thymeleaf
diff --git a/thymeleaf-impl/src/main/resources/net/shibboleth/idp/plugin/thymeleaf/plugin.properties b/thymeleaf-impl/src/main/resources/net/shibboleth/idp/plugin/thymeleaf/plugin.properties
index 82d2871..a4b43db 100644
--- a/thymeleaf-impl/src/main/resources/net/shibboleth/idp/plugin/thymeleaf/plugin.properties
+++ b/thymeleaf-impl/src/main/resources/net/shibboleth/idp/plugin/thymeleaf/plugin.properties
@@ -1 +1,4 @@
 plugin.id = net.shibboleth.idp.plugin.thymeleaf
+
+# Used when package manifest is absent.
+plugin.version = 1.0.0
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list