Ard Schrijvers pushed to branch feature/spaplus at cms-community / 
hippo-site-toolkit


Commits:
9ce815b4 by Ard Schrijvers at 2018-03-12T11:55:22+01:00
HSTTWO-4240 Use general property name for sitemapitem, mount and host

Instead of creating a new constant per nodetype, easier to use one generic
property. Otherwise mistakes are made easily, for example before this commit
the HstSiteMapItemService already used the constant for the Mount headers

- - - - -


4 changed files:

- api/src/main/java/org/hippoecm/hst/configuration/HstNodeTypes.java
- 
components/core/src/main/java/org/hippoecm/hst/configuration/hosting/MountService.java
- 
components/core/src/main/java/org/hippoecm/hst/configuration/hosting/VirtualHostService.java
- 
components/core/src/main/java/org/hippoecm/hst/configuration/sitemap/HstSiteMapItemService.java


Changes:

=====================================
api/src/main/java/org/hippoecm/hst/configuration/HstNodeTypes.java
=====================================
--- a/api/src/main/java/org/hippoecm/hst/configuration/HstNodeTypes.java
+++ b/api/src/main/java/org/hippoecm/hst/configuration/HstNodeTypes.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2008-2017 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2008-2018 Hippo B.V. (http://www.onehippo.com)
  * 
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -91,6 +91,8 @@ public interface HstNodeTypes {
     String GENERAL_PROPERTY_DEFAULT_RESOURCE_BUNDLE_ID = 
"hst:defaultresourcebundleid";
     String GENERAL_PROPERTY_SCHEME_NOT_MATCH_RESPONSE_CODE = 
"hst:schemenotmatchresponsecode";
     String GENERAL_PROEPRTY_SCHEME_AGNOSTIC = "hst:schemeagnostic";
+    String GENERAL_PROPERTY_RESPONSE_HEADERS = "hst:responseheaders";
+
     String VIRTUALHOST_PROPERTY_CUSTOM_HTTPS_SUPPORT = 
"hst:customhttpssupport";
 
     String COMPONENT_PROPERTY_COMPONENT_CONTEXTNAME = 
"hst:componentcontextname";
@@ -136,7 +138,6 @@ public interface HstNodeTypes {
     String SITEMAPITEM_PAGE_TITLE = "hst:pagetitle";
     String SITEMAPITEM_PROPERTY_CONTAINER_RESOURCE = "hst:containerresource";
     String SITEMAPITEM_PROPERTY_HIDDEN_IN_CHANNEL_MANAGER = 
"hst:hiddeninchannelmanager";
-    String SITEMAPITEM_PROPERTY_RESPONSE_HEADERS = "hst:responseheaders";
 
     String SITEMENUITEM_PROPERTY_REFERENCESITEMAPITEM = 
"hst:referencesitemapitem";
     String SITEMENUITEM_PROPERTY_EXTERNALLINK = "hst:externallink";
@@ -196,7 +197,6 @@ public interface HstNodeTypes {
     String VIRTUALHOST_PROPERTY_CONTEXTPATH = "hst:contextpath";
     String VIRTUALHOST_PROPERTY_SHOWPORT = "hst:showport";
     String VIRTUALHOST_PROPERTY_CDN_HOST = "hst:cdnhost";
-    String VIRTUALHOST_PROPERTY_RESPONSE_HEADERS = "hst:responseheaders";
 
     String MOUNT_HST_ROOTNAME = "hst:root";
     String MOUNT_PROPERTY_SHOWCONTEXTPATH = "hst:showcontextpath";
@@ -235,7 +235,6 @@ public interface HstNodeTypes {
     @Deprecated
     String MOUNT_PROPERTY_CHANNELPATH = "hst:channelpath";
     String MOUNT_PROPERTY_NOCHANNELINFO = "hst:nochannelinfo";
-    String MOUNT_PROPERTY_RESPONSE_HEADERS = "hst:responseheaders";
 
     String CHANNEL_PROPERTY_NAME = "hst:name";
     String CHANNEL_PROPERTY_TYPE = "hst:type";


=====================================
components/core/src/main/java/org/hippoecm/hst/configuration/hosting/MountService.java
=====================================
--- 
a/components/core/src/main/java/org/hippoecm/hst/configuration/hosting/MountService.java
+++ 
b/components/core/src/main/java/org/hippoecm/hst/configuration/hosting/MountService.java
@@ -55,6 +55,7 @@ import com.google.common.collect.ImmutableList;
 import static 
org.hippoecm.hst.configuration.ConfigurationUtils.isSupportedSchemeNotMatchingResponseCode;
 import static 
org.hippoecm.hst.configuration.ConfigurationUtils.isValidContextPath;
 import static 
org.hippoecm.hst.configuration.ConfigurationUtils.supportedSchemeNotMatchingResponseCodesAsString;
+import static 
org.hippoecm.hst.configuration.HstNodeTypes.GENERAL_PROPERTY_RESPONSE_HEADERS;
 import static 
org.hippoecm.hst.configuration.HstNodeTypes.MOUNT_PROPERTY_CHANNELPATH;
 import static 
org.hippoecm.hst.configuration.HstNodeTypes.MOUNT_PROPERTY_IS_SITE;
 import static 
org.hippoecm.hst.configuration.HstNodeTypes.MOUNT_PROPERTY_NOCHANNELINFO;
@@ -527,8 +528,8 @@ public class MountService implements ContextualizableMount, 
MutableMount {
             defaultSiteMapItemHandlerIds = 
parent.getDefaultSiteMapItemHandlerIds();
         }
 
-        if 
(mount.getValueProvider().hasProperty(HstNodeTypes.MOUNT_PROPERTY_RESPONSE_HEADERS))
 {
-            String[] resHeaders = 
mount.getValueProvider().getStrings(HstNodeTypes.MOUNT_PROPERTY_RESPONSE_HEADERS);
+        if 
(mount.getValueProvider().hasProperty(GENERAL_PROPERTY_RESPONSE_HEADERS)) {
+            String[] resHeaders = 
mount.getValueProvider().getStrings(GENERAL_PROPERTY_RESPONSE_HEADERS);
             if (resHeaders.length != 0) {
                 responseHeaders = HttpHeaderUtils.parseHeaderLines(resHeaders);
             }


=====================================
components/core/src/main/java/org/hippoecm/hst/configuration/hosting/VirtualHostService.java
=====================================
--- 
a/components/core/src/main/java/org/hippoecm/hst/configuration/hosting/VirtualHostService.java
+++ 
b/components/core/src/main/java/org/hippoecm/hst/configuration/hosting/VirtualHostService.java
@@ -41,6 +41,7 @@ import com.google.common.net.InetAddresses;
 import static 
org.hippoecm.hst.configuration.ConfigurationUtils.isSupportedSchemeNotMatchingResponseCode;
 import static 
org.hippoecm.hst.configuration.ConfigurationUtils.isValidContextPath;
 import static 
org.hippoecm.hst.configuration.ConfigurationUtils.supportedSchemeNotMatchingResponseCodesAsString;
+import static 
org.hippoecm.hst.configuration.HstNodeTypes.GENERAL_PROPERTY_RESPONSE_HEADERS;
 
 public class VirtualHostService implements MutableVirtualHost {
 
@@ -282,8 +283,8 @@ public class VirtualHostService implements 
MutableVirtualHost {
             cdnHost = null;
         }
 
-        if 
(virtualHostNode.getValueProvider().hasProperty(HstNodeTypes.VIRTUALHOST_PROPERTY_RESPONSE_HEADERS))
 {
-            String[] resHeaders = 
virtualHostNode.getValueProvider().getStrings(HstNodeTypes.VIRTUALHOST_PROPERTY_RESPONSE_HEADERS);
+        if 
(virtualHostNode.getValueProvider().hasProperty(GENERAL_PROPERTY_RESPONSE_HEADERS))
 {
+            String[] resHeaders = 
virtualHostNode.getValueProvider().getStrings(GENERAL_PROPERTY_RESPONSE_HEADERS);
             if (resHeaders.length != 0) {
                 responseHeaders = HttpHeaderUtils.parseHeaderLines(resHeaders);
             }


=====================================
components/core/src/main/java/org/hippoecm/hst/configuration/sitemap/HstSiteMapItemService.java
=====================================
--- 
a/components/core/src/main/java/org/hippoecm/hst/configuration/sitemap/HstSiteMapItemService.java
+++ 
b/components/core/src/main/java/org/hippoecm/hst/configuration/sitemap/HstSiteMapItemService.java
@@ -61,6 +61,7 @@ import static 
org.hippoecm.hst.configuration.HstNodeTypes.GENERAL_PROPERTY_LOCKE
 import static 
org.hippoecm.hst.configuration.HstNodeTypes.GENERAL_PROPERTY_LOCKED_ON;
 import static 
org.hippoecm.hst.configuration.HstNodeTypes.GENERAL_PROPERTY_PARAMETER_NAMES;
 import static 
org.hippoecm.hst.configuration.HstNodeTypes.GENERAL_PROPERTY_PARAMETER_VALUES;
+import static 
org.hippoecm.hst.configuration.HstNodeTypes.GENERAL_PROPERTY_RESPONSE_HEADERS;
 import static 
org.hippoecm.hst.configuration.HstNodeTypes.GENERAL_PROPERTY_SCHEME_NOT_MATCH_RESPONSE_CODE;
 import static 
org.hippoecm.hst.configuration.HstNodeTypes.NODENAME_HST_ABSTRACTPAGES;
 import static 
org.hippoecm.hst.configuration.HstNodeTypes.NODETYPE_HST_SITEMAPITEM;
@@ -446,8 +447,8 @@ public class HstSiteMapItemService implements 
HstSiteMapItem, CanonicalInfo, Con
             users = new HashSet<>();
         }
 
-        if 
(node.getValueProvider().hasProperty(HstNodeTypes.MOUNT_PROPERTY_RESPONSE_HEADERS))
 {
-            String[] resHeaders = 
node.getValueProvider().getStrings(HstNodeTypes.MOUNT_PROPERTY_RESPONSE_HEADERS);
+        if 
(node.getValueProvider().hasProperty(GENERAL_PROPERTY_RESPONSE_HEADERS)) {
+            String[] resHeaders = 
node.getValueProvider().getStrings(GENERAL_PROPERTY_RESPONSE_HEADERS);
             if (resHeaders.length != 0) {
                 responseHeaders = HttpHeaderUtils.parseHeaderLines(resHeaders);
             }



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-site-toolkit/commit/9ce815b43eb788ae7e95a269eb9ca96790c0ea01

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-site-toolkit/commit/9ce815b43eb788ae7e95a269eb9ca96790c0ea01
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to