You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2020/01/21 18:00:26 UTC

[isis] 02/02: ISIS-2264: reverts impl in Favicon since Optional is not serializable.

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit d8c7fa77b467cf8f55d20a61b2764891797a6021
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Jan 21 17:58:25 2020 +0000

    ISIS-2264: reverts impl in Favicon since Optional is not serializable.
---
 .../ui/components/widgets/favicon/Favicon.java     | 24 ++++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/favicon/Favicon.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/favicon/Favicon.java
index 998f9e4..7315336 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/favicon/Favicon.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/favicon/Favicon.java
@@ -39,12 +39,11 @@ public class Favicon extends WebComponent {
     @Inject private transient IsisConfiguration isisConfiguration;
     @Inject private transient WebAppContextPath webAppContextPath;
 
-    private Optional<String> url = Optional.empty();
-    private Optional<String> contentType = Optional.empty();
-    
+    private String url = null;
+    private String contentType = null;
+
     public Favicon(String id) {
         super(id);
-
     }
 
     @Override
@@ -55,20 +54,27 @@ public class Favicon extends WebComponent {
 
             url = isisConfiguration.getViewer().getWicket().getApplication().getFaviconUrl()
                     .filter(x -> !Strings.isEmpty(x))
-                    .map(webAppContextPath::prependContextPathIfLocal);
+                    .map(webAppContextPath::prependContextPathIfLocal)
+                    .orElse(null);
 
             contentType = isisConfiguration.getViewer().getWicket().getApplication().getFaviconContentType()
-                    .filter(x -> !Strings.isEmpty(x));
+                    .filter(x -> !Strings.isEmpty(x))
+                    .orElse(null);;
         }
 
-        setVisible(url.isPresent());
+        setVisible(url != null);
     }
 
     @Override
     protected void onComponentTag(ComponentTag tag) {
         super.onComponentTag(tag);
 
-        url.ifPresent(url -> tag.put("href", url));
-        contentType.ifPresent(contentType -> tag.put("type", contentType));
+        if(url != null) {
+            tag.put("href", url);
+        }
+        if(contentType != null) {
+            tag.put("type", contentType);
+        }
+
     }
 }