Skip to content

Commit 12546b6

Browse files
committed
Merge branch 'develop'
2 parents 8822a1e + c92dd39 commit 12546b6

File tree

13 files changed

+110
-54
lines changed

13 files changed

+110
-54
lines changed

changes.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 https://maven.apache.org/xsd/changes-2.0.0.xsd">
2525
<body>
2626

27+
<release version="2.23.2" date="2025-10-14">
28+
<action type="update" dev="sseifert" issue="238">
29+
aemDispatcherFilter Helper: Allow to set empty strings for selectors, extension, suffix.
30+
</action>
31+
</release>
32+
2733
<release version="2.23.0" date="2025-09-25">
2834
<action type="update" dev="sseifert">
2935
Switch to Java 17.

conga-aem-plugin/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.23.0</version>
28+
<version>2.23.2</version>
2929
<relativePath>../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
34-
<version>2.23.0</version>
34+
<version>2.23.2</version>
3535
<packaging>jar</packaging>
3636

3737
<name>CONGA AEM Plugin</name>

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AemDispatcherFilterHelper.java

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,51 @@ protected String generateFilter(Map<String, Object> filterMap, Options options)
4646
DispatcherFilter filter = new DispatcherFilter(filterMap);
4747

4848
StringBuilder sb = new StringBuilder()
49-
.append("{ ")
50-
.append("/type \"").append(filter.getType()).append("\" ");
49+
.append("{ ");
5150

52-
if (StringUtils.isNotEmpty(filter.getMethod())) {
53-
sb.append("/method '").append(filter.getMethod()).append("' ");
54-
}
55-
if (StringUtils.isNotEmpty(filter.getUrl())) {
56-
sb.append("/url '").append(filter.getUrl()).append("' ");
57-
}
58-
if (StringUtils.isNotEmpty(filter.getQuery())) {
59-
sb.append("/query '").append(filter.getQuery()).append("' ");
60-
}
61-
if (StringUtils.isNotEmpty(filter.getProtocol())) {
62-
sb.append("/protocol '").append(filter.getProtocol()).append("' ");
63-
}
51+
applySimpleValue(sb, "type", filter.getType().toString());
6452

65-
if (StringUtils.isNotEmpty(filter.getPath())) {
66-
sb.append("/path '").append(filter.getPath()).append("' ");
67-
}
68-
if (StringUtils.isNotEmpty(filter.getSelectors())) {
69-
sb.append("/selectors '").append(filter.getSelectors()).append("' ");
70-
}
71-
if (StringUtils.isNotEmpty(filter.getExtension())) {
72-
sb.append("/extension '").append(filter.getExtension()).append("' ");
73-
}
74-
if (StringUtils.isNotEmpty(filter.getSuffix())) {
75-
sb.append("/suffix '").append(filter.getSuffix()).append("' ");
76-
}
53+
applyRegexValue(sb, "method", filter.getMethod());
54+
applyRegexValue(sb, "url", filter.getUrl());
55+
applyRegexValue(sb, "query", filter.getQuery());
56+
applyRegexValue(sb, "protocol", filter.getProtocol());
7757

78-
if (StringUtils.isNotEmpty(filter.getGlob())) {
79-
sb.append("/glob '").append(filter.getGlob()).append("' ");
80-
}
58+
applyRegexValue(sb, "path", filter.getPath());
59+
applyRegexValueEmptyStringAllowed(sb, "selectors", filter.getSelectors());
60+
applyRegexValueEmptyStringAllowed(sb, "extension", filter.getExtension());
61+
applyRegexValueEmptyStringAllowed(sb, "suffix", filter.getSuffix());
62+
63+
applyRegexValue(sb, "glob", filter.getGlob());
8164

8265
sb.append("}");
8366
return sb.toString();
8467
}
8568

69+
/**
70+
* Append filter parameter as simple fixed string (enclosed in "").
71+
*/
72+
private void applySimpleValue(StringBuilder sb, String key, String value) {
73+
if (StringUtils.isNotEmpty(value)) {
74+
sb.append("/").append(key).append(" \"").append(value).append("\" ");
75+
}
76+
}
77+
78+
/**
79+
* Append filter parameter as string that may be a regex (enclosed in ''). Empty string are ignored.
80+
*/
81+
private void applyRegexValue(StringBuilder sb, String key, String value) {
82+
if (StringUtils.isNotEmpty(value)) {
83+
sb.append("/").append(key).append(" '").append(value).append("' ");
84+
}
85+
}
86+
87+
/**
88+
* Append filter parameter as string that may be a regex (enclosed in ''). Empty strings are left as-is.
89+
*/
90+
private void applyRegexValueEmptyStringAllowed(StringBuilder sb, String key, String value) {
91+
if (value != null) {
92+
sb.append("/").append(key).append(" '").append(value).append("' ");
93+
}
94+
}
95+
8696
}

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AemDispatcherFilterHelperTest.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,40 @@ void testAll() throws Exception {
6565
helper, map, new MockOptions());
6666
}
6767

68+
@Test
69+
void testSelectorExtensionSuffix() throws Exception {
70+
Map<String, Object> map = new HashMap<>();
71+
map.put("type", "deny");
72+
map.put("path", "path1");
73+
map.put("selectors", "selector1");
74+
map.put("extension", "extension1");
75+
map.put("suffix", "suffix1");
76+
assertHelper("{ /type \"deny\" /path 'path1' /selectors 'selector1' /extension 'extension1' /suffix 'suffix1' }",
77+
helper, map, new MockOptions());
78+
}
79+
80+
@Test
81+
void testSelectorExtensionSuffix_EmptyString() throws Exception {
82+
Map<String, Object> map = new HashMap<>();
83+
map.put("type", "deny");
84+
map.put("path", "path1");
85+
map.put("selectors", "");
86+
map.put("extension", "");
87+
map.put("suffix", "");
88+
assertHelper("{ /type \"deny\" /path 'path1' /selectors '' /extension '' /suffix '' }",
89+
helper, map, new MockOptions());
90+
}
91+
92+
@Test
93+
void testSelectorExtensionSuffix_Null() throws Exception {
94+
Map<String, Object> map = new HashMap<>();
95+
map.put("type", "deny");
96+
map.put("path", "path1");
97+
map.put("selectors", null);
98+
map.put("extension", null);
99+
map.put("suffix", null);
100+
assertHelper("{ /type \"deny\" /path 'path1' }",
101+
helper, map, new MockOptions());
102+
}
103+
68104
}

parent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
34-
<version>2.23.0</version>
34+
<version>2.23.2</version>
3535
<packaging>pom</packaging>
3636

3737
<name>CONGA AEM Plugin</name>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
<parent>
2424
<groupId>io.wcm.devops.conga.plugins</groupId>
2525
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
26-
<version>2.23.0</version>
26+
<version>2.23.2</version>
2727
<relativePath>parent/pom.xml</relativePath>
2828
</parent>
2929

3030
<groupId>io.wcm.devops.conga.plugins</groupId>
3131
<artifactId>io.wcm.devops.conga.plugins.aem.root</artifactId>
32-
<version>2.23.0</version>
32+
<version>2.23.2</version>
3333
<packaging>pom</packaging>
3434

3535
<name>CONGA AEM Plugin</name>

tooling/conga-aem-crypto-cli/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.23.0</version>
28+
<version>2.23.2</version>
2929
<relativePath>../../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>conga-aem-crypto-cli</artifactId>
3434
<packaging>jar</packaging>
35-
<version>2.23.0</version>
35+
<version>2.23.2</version>
3636

3737
<name>CONGA AEM Crypto Command Line Interface</name>
3838
<description>Command line tool to generate Crypto keys for AEM.</description>
@@ -42,7 +42,7 @@
4242
<dependency>
4343
<groupId>io.wcm.devops.conga.plugins</groupId>
4444
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
45-
<version>2.23.0</version>
45+
<version>2.23.2</version>
4646
<scope>compile</scope>
4747
<exclusions>
4848
<!-- Exclude all deps - only crypto util classes are used -->

tooling/conga-aem-maven-plugin/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.23.0</version>
28+
<version>2.23.2</version>
2929
<relativePath>../../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>conga-aem-maven-plugin</artifactId>
3434
<packaging>maven-plugin</packaging>
35-
<version>2.23.0</version>
35+
<version>2.23.2</version>
3636

3737
<name>CONGA AEM Maven Plugin</name>
3838
<description>wcm.io DevOps CONGA - CONfiguration GenerAtor Maven Plugin for AEM</description>
@@ -62,7 +62,7 @@
6262
<dependency>
6363
<groupId>io.wcm.devops.conga.plugins</groupId>
6464
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
65-
<version>2.23.0</version>
65+
<version>2.23.2</version>
6666
<scope>compile</scope>
6767
</dependency>
6868
<dependency>
@@ -112,7 +112,7 @@
112112
<dependency>
113113
<groupId>org.apache.maven</groupId>
114114
<artifactId>maven-archiver</artifactId>
115-
<version>3.6.4</version>
115+
<version>3.6.5</version>
116116
<scope>compile</scope>
117117
</dependency>
118118
<dependency>

tooling/conga-aem-maven-plugin/src/it/example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<parent>
2727
<groupId>io.wcm.maven</groupId>
2828
<artifactId>io.wcm.maven.global-parent</artifactId>
29-
<version>70</version>
29+
<version>71</version>
3030
<relativePath/>
3131
</parent>
3232

tooling/conga-aem-maven-plugin/src/it/mixed-no-package-type/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<parent>
2727
<groupId>io.wcm.maven</groupId>
2828
<artifactId>io.wcm.maven.global-parent</artifactId>
29-
<version>70</version>
29+
<version>71</version>
3030
<relativePath/>
3131
</parent>
3232

0 commit comments

Comments
 (0)