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


Commits:
46675e1a by Ard Schrijvers at 2018-03-12T11:50:11+01:00
HSTTWO-4240 Make the javadoc more explicit wrt overlapping header names

- - - - -


4 changed files:

- api/src/main/java/org/hippoecm/hst/configuration/hosting/Mount.java
- api/src/main/java/org/hippoecm/hst/configuration/hosting/VirtualHost.java
- api/src/main/java/org/hippoecm/hst/configuration/sitemap/HstSiteMapItem.java
- commons/src/main/java/org/hippoecm/hst/util/HttpHeaderUtils.java


Changes:

=====================================
api/src/main/java/org/hippoecm/hst/configuration/hosting/Mount.java
=====================================
--- a/api/src/main/java/org/hippoecm/hst/configuration/hosting/Mount.java
+++ b/api/src/main/java/org/hippoecm/hst/configuration/hosting/Mount.java
@@ -508,8 +508,14 @@ public interface Mount {
     List<String> getCmsLocations();
 
     /**
-     * Return a non-null unmodifiable map of the configuration values of HTTP 
Response headers which should be set
-     * in any responses by the requests on this.
+     * <p>
+     *     Return a non-null unmodifiable map of the configuration values of 
HTTP Response headers which should be set
+     *     in any responses by the requests on this. They keys from the 
returned map are the header names.
+     * </p>
+     * <p>
+     *     Note that the header names returned by this method overwrites any 
already set headers during request processing
+     *     with the same name
+     * </p>
      * @return a non-null unmodifiable map of the configuration values of HTTP 
Response headers which should be set
      * in any responses by the requests on this.
      */


=====================================
api/src/main/java/org/hippoecm/hst/configuration/hosting/VirtualHost.java
=====================================
--- a/api/src/main/java/org/hippoecm/hst/configuration/hosting/VirtualHost.java
+++ b/api/src/main/java/org/hippoecm/hst/configuration/hosting/VirtualHost.java
@@ -209,8 +209,14 @@ public interface VirtualHost {
     boolean isCustomHttpsSupported();
 
     /**
-     * Return a non-null unmodifiable map of the configuration values of HTTP 
Response headers which should be set
-     * in any responses by the requests on this.
+     * <p>
+     *     Return a non-null unmodifiable map of the configuration values of 
HTTP Response headers which should be set
+     *     in any responses by the requests on this. They keys from the 
returned map are the header names.
+     * </p>
+     * <p>
+     *     Note that the header names returned by this method overwrites any 
already set headers during request processing
+     *     with the same name
+     * </p>
      * @return a non-null unmodifiable map of the configuration values of HTTP 
Response headers which should be set
      * in any responses by the requests on this.
      */


=====================================
api/src/main/java/org/hippoecm/hst/configuration/sitemap/HstSiteMapItem.java
=====================================
--- 
a/api/src/main/java/org/hippoecm/hst/configuration/sitemap/HstSiteMapItem.java
+++ 
b/api/src/main/java/org/hippoecm/hst/configuration/sitemap/HstSiteMapItem.java
@@ -390,8 +390,14 @@ public interface HstSiteMapItem {
     boolean isMarkedDeleted();
 
     /**
-     * Return a non-null unmodifiable map of the configuration values of HTTP 
Response headers which should be set
-     * in any responses by the requests on this.
+     * <p>
+     *     Return a non-null unmodifiable map of the configuration values of 
HTTP Response headers which should be set
+     *     in any responses by the requests on this. They keys from the 
returned map are the header names.
+     * </p>
+     * <p>
+     *     Note that the header names returned by this method overwrites any 
already set headers during request processing
+     *     with the same name
+     * </p>
      * @return a non-null unmodifiable map of the configuration values of HTTP 
Response headers which should be set
      * in any responses by the requests on this.
      */


=====================================
commons/src/main/java/org/hippoecm/hst/util/HttpHeaderUtils.java
=====================================
--- a/commons/src/main/java/org/hippoecm/hst/util/HttpHeaderUtils.java
+++ b/commons/src/main/java/org/hippoecm/hst/util/HttpHeaderUtils.java
@@ -39,19 +39,19 @@ public class HttpHeaderUtils {
      * @param headerLine single http header line (name and value pair 
separated by ':')
      * @return parsed key value pair
      */
-    public static KeyValue<String, String> parseHeaderLine(String headerLine) {
+    public static KeyValue<String, String> parseHeaderLine(final String 
headerLine) {
         if (headerLine == null) {
             return null;
         }
 
-        String[] pair = StringUtils.split(headerLine, ":", 2);
+        final String[] pair = StringUtils.split(headerLine, ":", 2);
 
         if (pair.length != 2) {
             log.warn("Header line in an invalid form: '{}'.", headerLine);
             return null;
         }
 
-        return new DefaultKeyValue<String, String>(StringUtils.trim(pair[0]), 
StringUtils.trim(pair[1]));
+        return new DefaultKeyValue<>(StringUtils.trim(pair[0]), 
StringUtils.trim(pair[1]));
     }
 
     /**
@@ -62,15 +62,15 @@ public class HttpHeaderUtils {
      * @param headerLines http header lines, each of which is a single http 
header line (name and value pair separated by ':')
      * @return map of parsed key value pairs
      */
-    public static Map<String, String> parseHeaderLines(String[] headerLines) {
+    public static Map<String, String> parseHeaderLines(final String[] 
headerLines) {
         if (headerLines == null) {
             return null;
         }
 
-        Map<String, String> headerMap = new LinkedHashMap<>();
+        final Map<String, String> headerMap = new LinkedHashMap<>();
 
         for (String headerLine : headerLines) {
-            KeyValue<String, String> kv = parseHeaderLine(headerLine);
+            final KeyValue<String, String> kv = parseHeaderLine(headerLine);
 
             if (kv != null) {
                 headerMap.put(kv.getKey(), kv.getValue());



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

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-site-toolkit/commit/46675e1a0e8a082a450f2c7a10e97bb443d1d90f
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