Browse Source

fix #645 add thumbnail.html.phantomjs.enabled

Shinsuke Sugaya 8 years ago
parent
commit
3b60549ef9

+ 25 - 0
src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java

@@ -609,6 +609,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
     /** The key of the configuration. e.g. 100 */
     String PAGING_SEARCH_PAGE_MAX_SIZE = "paging.search.page.max.size";
 
+    /** The key of the configuration. e.g. true */
+    String THUMBNAIL_HTML_PHANTOMJS_ENABLED = "thumbnail.html.phantomjs.enabled";
+
     /** The key of the configuration. e.g. Administrator */
     String MAIL_FROM_NAME = "mail.from.name";
 
@@ -2938,6 +2941,20 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
      */
     Integer getPagingSearchPageMaxSizeAsInteger();
 
+    /**
+     * Get the value for the key 'thumbnail.html.phantomjs.enabled'. <br>
+     * The value is, e.g. true <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getThumbnailHtmlPhantomjsEnabled();
+
+    /**
+     * Is the property for the key 'thumbnail.html.phantomjs.enabled' true? <br>
+     * The value is, e.g. true <br>
+     * @return The determination, true or false. (if not found, exception but basically no way)
+     */
+    boolean isThumbnailHtmlPhantomjsEnabled();
+
     /**
      * Get the value for the key 'mail.from.name'. <br>
      * The value is, e.g. Administrator <br>
@@ -5101,6 +5118,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             return getAsInteger(FessConfig.PAGING_SEARCH_PAGE_MAX_SIZE);
         }
 
+        public String getThumbnailHtmlPhantomjsEnabled() {
+            return get(FessConfig.THUMBNAIL_HTML_PHANTOMJS_ENABLED);
+        }
+
+        public boolean isThumbnailHtmlPhantomjsEnabled() {
+            return is(FessConfig.THUMBNAIL_HTML_PHANTOMJS_ENABLED);
+        }
+
         public String getMailFromName() {
             return get(FessConfig.MAIL_FROM_NAME);
         }

+ 3 - 1
src/main/java/org/codelibs/fess/thumbnail/impl/WebDriverGenerator.java

@@ -25,6 +25,7 @@ import java.util.Collection;
 import javax.annotation.PostConstruct;
 import javax.imageio.ImageIO;
 
+import org.codelibs.fess.mylasta.direction.FessConfig;
 import org.codelibs.fess.util.ComponentUtil;
 import org.openqa.selenium.Capabilities;
 import org.openqa.selenium.Dimension;
@@ -63,7 +64,8 @@ public class WebDriverGenerator extends BaseThumbnailGenerator {
 
     @PostConstruct
     public void init() {
-        if (super.isAvailable()) {
+        final FessConfig fessConfig = ComponentUtil.getFessConfig();
+        if (fessConfig.isThumbnailHtmlPhantomjsEnabled() && super.isAvailable()) {
             try {
                 if (webDriver == null) {
                     if (webDriverCapabilities == null) {

+ 2 - 0
src/main/resources/fess_config.properties

@@ -334,6 +334,8 @@ paging.search.page.start=0
 paging.search.page.size=20
 paging.search.page.max.size=100
 
+thumbnail.html.phantomjs.enabled=true
+
 # ----------------------------------------------------------
 #                                                       Mail
 #                                                     ------