diff --git a/pom.xml b/pom.xml
index 0ec9e8e32..950cd9308 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,7 @@
${packaging.fess.home.dir}/app
${packaging.fess.home.dir}/bin
/etc/fess
+ /var/lib/fess
${packaging.fess.home.dir}/lib
/var/log/fess
/var/tmp/fess
@@ -456,6 +457,12 @@
+
+ ${packaging.fess.var.dir}
+ 755
+ ${packaging.fess.user}
+ ${packaging.fess.group}
+
${packaging.fess.bin.dir}
diff --git a/src/main/assemblies/files/fess.in.sh b/src/main/assemblies/files/fess.in.sh
index ec1aa5bd4..642c7a90a 100755
--- a/src/main/assemblies/files/fess.in.sh
+++ b/src/main/assemblies/files/fess.in.sh
@@ -88,6 +88,9 @@ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dtomcat.config.path=tomcat_config.properties"
if [ "x$FESS_CONF_PATH" != "x" ]; then
FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dfess.conf.path=$FESS_CONF_PATH"
fi
+if [ "x$FESS_VAR_PATH" != "x" ]; then
+ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dfess.var.path=$FESS_VAR_PATH"
+fi
if [ "x$ES_HTTP_URL" != "x" ]; then
FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dfess.es.http_address=$ES_HTTP_URL"
fi
diff --git a/src/main/java/org/codelibs/fess/Constants.java b/src/main/java/org/codelibs/fess/Constants.java
index e0fb2f5bd..c8615749d 100644
--- a/src/main/java/org/codelibs/fess/Constants.java
+++ b/src/main/java/org/codelibs/fess/Constants.java
@@ -129,8 +129,6 @@ public class Constants extends CoreLibConstants {
public static final String SEARCH_FILE_PROXY_PROPERTY = "search.file.proxy";
- public static final String SEARCH_DESKTOP_PROPERTY = "search.desktop";
-
public static final String NOTIFICATION_TO_PROPERTY = "notification.to";
public static final String USE_BROWSER_LOCALE_FOR_SEARCH_PROPERTY = "search.use.browser.locale";
diff --git a/src/main/java/org/codelibs/fess/app/web/cache/CacheAction.java b/src/main/java/org/codelibs/fess/app/web/cache/CacheAction.java
index e29ac238a..2e6acfee7 100644
--- a/src/main/java/org/codelibs/fess/app/web/cache/CacheAction.java
+++ b/src/main/java/org/codelibs/fess/app/web/cache/CacheAction.java
@@ -19,6 +19,7 @@ import java.util.Map;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.web.base.FessSearchAction;
+import org.codelibs.fess.app.web.error.ErrorAction;
import org.codelibs.fess.util.DocumentUtil;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermQueryBuilder;
@@ -65,16 +66,14 @@ public class CacheAction extends FessSearchAction {
logger.warn("Failed to request: " + form.docId, e);
}
if (doc == null) {
- throwValidationError(messages -> {
- messages.addErrorsDocidNotFound(GLOBAL, form.docId);
- }, () -> asHtml(path_ErrorJsp));
+ saveError(messages -> messages.addErrorsDocidNotFound(GLOBAL, form.docId));
+ return redirect(ErrorAction.class);
}
final String content = viewHelper.createCacheContent(doc, form.hq);
if (content == null) {
- throwValidationError(messages -> {
- messages.addErrorsDocidNotFound(GLOBAL, form.docId);
- }, () -> asHtml(path_ErrorJsp));
+ saveError(messages -> messages.addErrorsDocidNotFound(GLOBAL, form.docId));
+ return redirect(ErrorAction.class);
}
return asStream(DocumentUtil.getValue(doc, fessConfig.getIndexFieldDocId(), String.class)).contentType("text/html; charset=UTF-8")
diff --git a/src/main/java/org/codelibs/fess/app/web/error/ErrorAction.java b/src/main/java/org/codelibs/fess/app/web/error/ErrorAction.java
index 7d041145c..7f07b8913 100644
--- a/src/main/java/org/codelibs/fess/app/web/error/ErrorAction.java
+++ b/src/main/java/org/codelibs/fess/app/web/error/ErrorAction.java
@@ -34,22 +34,6 @@ public class ErrorAction extends FessSearchAction {
// ==============
@Execute
public HtmlResponse index(final ErrorForm form) {
- return asHtml(path_Error_NotFoundJsp);
+ return asHtml(path_Error_ErrorJsp);
}
-
- @Execute
- public HtmlResponse systemError(final ErrorForm form) {
- return asHtml(path_Error_SystemJsp);
- }
-
- @Execute
- public HtmlResponse badRequest(final ErrorForm form) {
- return asHtml(path_Error_BadRequestJsp);
- }
-
- @Execute
- public HtmlResponse notFound(final ErrorForm form) {
- return asHtml(path_Error_NotFoundJsp);
- }
-
}
\ No newline at end of file
diff --git a/src/main/java/org/codelibs/fess/app/web/error/ErrorBadrequrestAction.java b/src/main/java/org/codelibs/fess/app/web/error/ErrorBadrequrestAction.java
new file mode 100644
index 000000000..90da98f59
--- /dev/null
+++ b/src/main/java/org/codelibs/fess/app/web/error/ErrorBadrequrestAction.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2012-2015 CodeLibs Project and the Others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.codelibs.fess.app.web.error;
+
+import org.codelibs.fess.app.web.base.FessSearchAction;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.response.HtmlResponse;
+
+public class ErrorBadrequrestAction extends FessSearchAction {
+
+ // ===================================================================================
+ // Constant
+ //
+
+ // ===================================================================================
+ // Attribute
+ //
+
+ // ===================================================================================
+ // Search Execute
+ // ==============
+
+ @Execute
+ public HtmlResponse index(final ErrorForm form) {
+ return asHtml(path_Error_BadRequestJsp);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/codelibs/fess/app/web/error/ErrorNotfoundAction.java b/src/main/java/org/codelibs/fess/app/web/error/ErrorNotfoundAction.java
new file mode 100644
index 000000000..c9703cf32
--- /dev/null
+++ b/src/main/java/org/codelibs/fess/app/web/error/ErrorNotfoundAction.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2012-2015 CodeLibs Project and the Others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.codelibs.fess.app.web.error;
+
+import org.codelibs.fess.app.web.base.FessSearchAction;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.response.HtmlResponse;
+
+public class ErrorNotfoundAction extends FessSearchAction {
+
+ // ===================================================================================
+ // Constant
+ //
+
+ // ===================================================================================
+ // Attribute
+ //
+
+ // ===================================================================================
+ // Search Execute
+ // ==============
+
+ @Execute
+ public HtmlResponse index(final ErrorForm form) {
+ return asHtml(path_Error_NotFoundJsp);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/codelibs/fess/app/web/error/ErrorSystemerrorAction.java b/src/main/java/org/codelibs/fess/app/web/error/ErrorSystemerrorAction.java
new file mode 100644
index 000000000..fc37d9ae8
--- /dev/null
+++ b/src/main/java/org/codelibs/fess/app/web/error/ErrorSystemerrorAction.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2012-2015 CodeLibs Project and the Others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.codelibs.fess.app.web.error;
+
+import org.codelibs.fess.app.web.base.FessSearchAction;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.response.HtmlResponse;
+
+public class ErrorSystemerrorAction extends FessSearchAction {
+
+ // ===================================================================================
+ // Constant
+ //
+
+ // ===================================================================================
+ // Attribute
+ //
+
+ // ===================================================================================
+ // Search Execute
+ // ==============
+
+ @Execute
+ public HtmlResponse index(final ErrorForm form) {
+ return asHtml(path_Error_SystemJsp);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/codelibs/fess/app/web/go/GoAction.java b/src/main/java/org/codelibs/fess/app/web/go/GoAction.java
index d6cb2a2ce..e6f6bc8be 100644
--- a/src/main/java/org/codelibs/fess/app/web/go/GoAction.java
+++ b/src/main/java/org/codelibs/fess/app/web/go/GoAction.java
@@ -15,19 +15,16 @@
*/
package org.codelibs.fess.app.web.go;
-import java.awt.Desktop;
-import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;
-import javax.servlet.http.HttpServletResponse;
-
import org.codelibs.core.lang.StringUtil;
import org.codelibs.core.net.URLUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.web.base.FessSearchAction;
+import org.codelibs.fess.app.web.error.ErrorAction;
import org.codelibs.fess.crawler.util.CharUtil;
import org.codelibs.fess.es.log.exentity.ClickLog;
import org.codelibs.fess.helper.SearchLogHelper;
@@ -66,7 +63,7 @@ public class GoAction extends FessSearchAction {
if (isLoginRequired()) {
return redirectToLogin();
}
- validate(form, messages -> {}, () -> asHtml(path_ErrorJsp));
+ validate(form, messages -> {}, () -> asHtml(path_Error_ErrorJsp));
Map doc = null;
try {
@@ -75,22 +72,20 @@ public class GoAction extends FessSearchAction {
queryRequestBuilder -> {
final TermQueryBuilder termQuery = QueryBuilders.termQuery(fessConfig.getIndexFieldDocId(), form.docId);
queryRequestBuilder.setQuery(termQuery);
- queryRequestBuilder.addFields(fessConfig.getIndexFieldUrl());
+ queryRequestBuilder.addFields(fessConfig.getIndexFieldUrl(), fessConfig.getIndexFieldConfigId());
return true;
}).get();
} catch (final Exception e) {
logger.warn("Failed to request: " + form.docId, e);
}
if (doc == null) {
- throwValidationError(messages -> {
- messages.addErrorsDocidNotFound(GLOBAL, form.docId);
- }, () -> asHtml(path_ErrorJsp));
+ saveError(messages -> messages.addErrorsDocidNotFound(GLOBAL, form.docId));
+ return redirect(ErrorAction.class);
}
final String url = DocumentUtil.getValue(doc, fessConfig.getIndexFieldUrl(), String.class);
if (url == null) {
- throwValidationError(messages -> {
- messages.addErrorsDocumentNotFound(GLOBAL, form.docId);
- }, () -> asHtml(path_ErrorJsp));
+ saveError(messages -> messages.addErrorsDocumentNotFound(GLOBAL, form.docId));
+ return redirect(ErrorAction.class);
}
if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE))) {
@@ -137,31 +132,10 @@ public class GoAction extends FessSearchAction {
try {
return viewHelper.asContentResponse(doc);
} catch (final Exception e) {
- logger.error("Failed to load: " + doc, e);
- throwValidationError(messages -> {
- messages.addErrorsNotLoadFromServer(GLOBAL, url);
- }, () -> asHtml(path_ErrorJsp));
- return null; // workaround
+ logger.debug("Failed to load: " + doc, e);
+ saveError(messages -> messages.addErrorsNotLoadFromServer(GLOBAL, url));
+ return redirect(ErrorAction.class);
}
- } else if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_DESKTOP_PROPERTY, Constants.FALSE))) {
- final String path = url.replaceFirst("file:/+", "//");
- final File file = new File(path);
- if (!file.exists()) {
- throwValidationError(messages -> {
- messages.addErrorsNotFoundOnFileSystem(GLOBAL, url);
- }, () -> asHtml(path_ErrorJsp));
- }
- final Desktop desktop = Desktop.getDesktop();
- try {
- desktop.open(file);
- } catch (final Exception e) {
- logger.warn("Could not open " + path, e);
- throwValidationError(messages -> {
- messages.addErrorsCouldNotOpenOnSystem(GLOBAL, url);
- }, () -> asHtml(path_ErrorJsp));
- }
-
- return HtmlResponse.asEmptyBody().httpStatus(HttpServletResponse.SC_NO_CONTENT);
} else {
return HtmlResponse.fromRedirectPathAsIs(url + hash);
}
diff --git a/src/main/java/org/codelibs/fess/app/web/screenshot/ScreenshotAction.java b/src/main/java/org/codelibs/fess/app/web/screenshot/ScreenshotAction.java
index 918eed59c..d75c59e26 100644
--- a/src/main/java/org/codelibs/fess/app/web/screenshot/ScreenshotAction.java
+++ b/src/main/java/org/codelibs/fess/app/web/screenshot/ScreenshotAction.java
@@ -18,32 +18,21 @@ package org.codelibs.fess.app.web.screenshot;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.OutputStream;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.io.IOUtils;
-import org.codelibs.core.io.CopyUtil;
-import org.codelibs.core.io.OutputStreamUtil;
import org.codelibs.core.lang.StringUtil;
import org.codelibs.fess.app.web.base.FessSearchAction;
import org.codelibs.fess.util.DocumentUtil;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermQueryBuilder;
import org.lastaflute.web.Execute;
-import org.lastaflute.web.response.HtmlResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.lastaflute.web.response.ActionResponse;
public class ScreenshotAction extends FessSearchAction {
- // ===================================================================================
- // Constant
- //
- private static final Logger logger = LoggerFactory.getLogger(ScreenshotAction.class);
-
// ===================================================================================
// Attribute
//
@@ -58,51 +47,39 @@ public class ScreenshotAction extends FessSearchAction {
// Search Execute
// ==============
@Execute
- public HtmlResponse index(final ScreenshotForm form) {
+ public ActionResponse index(final ScreenshotForm form) {
if (isLoginRequired()) {
return redirectToLogin();
}
- OutputStream out = null;
- BufferedInputStream in = null;
- try {
- final Map doc =
- fessEsClient.getDocument(fessConfig.getIndexDocumentSearchIndex(), fessConfig.getIndexDocumentType(),
- queryRequestBuilder -> {
- final TermQueryBuilder termQuery = QueryBuilders.termQuery(fessConfig.getIndexFieldDocId(), form.docId);
- queryRequestBuilder.setQuery(termQuery);
- queryRequestBuilder.addFields(queryHelper.getResponseFields());
- return true;
- }).get();
- final String url = DocumentUtil.getValue(doc, fessConfig.getIndexFieldUrl(), String.class);
- if (StringUtil.isBlank(form.queryId) || StringUtil.isBlank(url) || screenShotManager == null) {
- // 404
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return null;
- }
-
- final File screenShotFile = screenShotManager.getScreenShotFile(form.queryId, form.docId);
- if (screenShotFile == null) {
- // 404
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- screenShotManager.generate(doc);
- return null;
- }
-
- response.setContentType(getImageMimeType(screenShotFile));
-
- out = response.getOutputStream();
- in = new BufferedInputStream(new FileInputStream(screenShotFile));
- CopyUtil.copy(in, out);
- OutputStreamUtil.flush(out);
- } catch (final Exception e) {
- logger.error("Failed to response: " + form.docId, e);
- } finally {
- IOUtils.closeQuietly(in);
- IOUtils.closeQuietly(out);
+ final Map doc =
+ fessEsClient.getDocument(fessConfig.getIndexDocumentSearchIndex(), fessConfig.getIndexDocumentType(),
+ queryRequestBuilder -> {
+ final TermQueryBuilder termQuery = QueryBuilders.termQuery(fessConfig.getIndexFieldDocId(), form.docId);
+ queryRequestBuilder.setQuery(termQuery);
+ queryRequestBuilder.addFields(queryHelper.getResponseFields());
+ return true;
+ }).get();
+ final String url = DocumentUtil.getValue(doc, fessConfig.getIndexFieldUrl(), String.class);
+ if (StringUtil.isBlank(form.queryId) || StringUtil.isBlank(url) || screenShotManager == null) {
+ // 404
+ throw404("Screenshot for " + form.docId + " is not found.");
+ return null;
}
- return null;
+ final File screenShotFile = screenShotManager.getScreenShotFile(form.queryId, form.docId);
+ if (screenShotFile == null) {
+ // 404
+ throw404("Screenshot for " + form.docId + " is under generating.");
+ screenShotManager.generate(doc);
+ return null;
+ }
+
+ return asStream(form.docId).contentType(getImageMimeType(screenShotFile)).stream(out -> {
+ try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(screenShotFile))) {
+ out.write(in);
+ }
+ });
}
protected String getImageMimeType(final File imageFile) {
diff --git a/src/main/java/org/codelibs/fess/helper/ViewHelper.java b/src/main/java/org/codelibs/fess/helper/ViewHelper.java
index 229e1c7ae..3de46746f 100644
--- a/src/main/java/org/codelibs/fess/helper/ViewHelper.java
+++ b/src/main/java/org/codelibs/fess/helper/ViewHelper.java
@@ -489,13 +489,12 @@ public class ViewHelper implements Serializable {
}
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final CrawlingConfigHelper crawlingConfigHelper = ComponentUtil.getCrawlingConfigHelper();
- final Object configIdObj = doc.get(fessConfig.getIndexFieldConfigId());
- if (configIdObj == null) {
+ final String configId = DocumentUtil.getValue(doc, fessConfig.getIndexFieldConfigId(), String.class);
+ if (configId == null) {
throw new FessSystemException("configId is null.");
}
- final String configId = configIdObj.toString();
if (configId.length() < 2) {
- throw new FessSystemException("Invalid configId: " + configIdObj);
+ throw new FessSystemException("Invalid configId: " + configId);
}
final ConfigType configType = crawlingConfigHelper.getConfigType(configId);
CrawlingConfig config = null;
@@ -513,14 +512,14 @@ public class ViewHelper implements Serializable {
config = dataConfigService.getDataConfig(crawlingConfigHelper.getId(configId)).get();
}
if (config == null) {
- throw new FessSystemException("No crawlingConfig: " + configIdObj);
+ throw new FessSystemException("No crawlingConfig: " + configId);
}
- final String url = (String) doc.get(fessConfig.getIndexFieldUrl());
+ final String url = DocumentUtil.getValue(doc, fessConfig.getIndexFieldUrl(), String.class);
final CrawlerClientFactory crawlerClientFactory = SingletonLaContainer.getComponent(CrawlerClientFactory.class);
config.initializeClientFactory(crawlerClientFactory);
final CrawlerClient client = crawlerClientFactory.getClient(url);
if (client == null) {
- throw new FessSystemException("No CrawlerClient: " + configIdObj + ", url: " + url);
+ throw new FessSystemException("No CrawlerClient: " + configId + ", url: " + url);
}
final ResponseData responseData = client.execute(RequestDataBuilder.newRequestData().get().url(url).build());
final StreamResponse response = new StreamResponse(StringUtil.EMPTY);
@@ -532,7 +531,7 @@ public class ViewHelper implements Serializable {
out.write(is);
} catch (final IOException e) {
if (!"ClientAbortException".equals(e.getClass().getSimpleName())) {
- throw new FessSystemException("Failed to write a content. configId: " + configIdObj + ", url: " + url, e);
+ throw new FessSystemException("Failed to write a content. configId: " + configId + ", url: " + url, e);
}
}
if (logger.isDebugEnabled()) {
diff --git a/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java b/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java
index 92dd33fa1..8dc8d4b18 100644
--- a/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java
+++ b/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java
@@ -284,6 +284,9 @@ public interface FessHtmlPath {
/** The path of the HTML: /error/badRequest.jsp */
HtmlNext path_Error_BadRequestJsp = new HtmlNext("/error/badRequest.jsp");
+ /** The path of the HTML: /error/error.jsp */
+ HtmlNext path_Error_ErrorJsp = new HtmlNext("/error/error.jsp");
+
/** The path of the HTML: /error/footer.jsp */
HtmlNext path_Error_FooterJsp = new HtmlNext("/error/footer.jsp");
@@ -299,9 +302,6 @@ public interface FessHtmlPath {
/** The path of the HTML: /error/system.jsp */
HtmlNext path_Error_SystemJsp = new HtmlNext("/error/system.jsp");
- /** The path of the HTML: /error.jsp */
- HtmlNext path_ErrorJsp = new HtmlNext("/error.jsp");
-
/** The path of the HTML: /footer.jsp */
HtmlNext path_FooterJsp = new HtmlNext("/footer.jsp");
diff --git a/src/main/java/org/codelibs/fess/screenshot/ScreenShotManager.java b/src/main/java/org/codelibs/fess/screenshot/ScreenShotManager.java
index 85265dcfe..f6bc6c2e7 100644
--- a/src/main/java/org/codelibs/fess/screenshot/ScreenShotManager.java
+++ b/src/main/java/org/codelibs/fess/screenshot/ScreenShotManager.java
@@ -48,7 +48,7 @@ public class ScreenShotManager {
@Resource
protected ServletContext application;
- public File baseDir;
+ protected File baseDir;
public long shutdownTimeout = 5 * 60 * 1000; // 5min
@@ -68,16 +68,19 @@ public class ScreenShotManager {
@PostConstruct
public void init() {
- if (baseDir == null) {
+ final String varPath = System.getProperty("fess.var.path");
+ if (varPath != null) {
+ baseDir = new File(varPath, "screenshots");
+ } else {
final String path = application.getRealPath(DEFAULT_SCREENSHOT_DIR);
if (StringUtil.isNotBlank(path)) {
baseDir = new File(path);
} else {
baseDir = new File("." + DEFAULT_SCREENSHOT_DIR);
}
- if (baseDir.mkdirs()) {
- logger.info("Created: " + baseDir.getAbsolutePath());
- }
+ }
+ if (baseDir.mkdirs()) {
+ logger.info("Created: " + baseDir.getAbsolutePath());
}
if (!baseDir.isDirectory()) {
throw new FessSystemException("Not found: " + baseDir.getAbsolutePath());
diff --git a/src/main/webapp/WEB-INF/view/error.jsp b/src/main/webapp/WEB-INF/view/error/error.jsp
similarity index 63%
rename from src/main/webapp/WEB-INF/view/error.jsp
rename to src/main/webapp/WEB-INF/view/error/error.jsp
index a86996fd2..6cc37dafa 100644
--- a/src/main/webapp/WEB-INF/view/error.jsp
+++ b/src/main/webapp/WEB-INF/view/error/error.jsp
@@ -1,12 +1,11 @@
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
-
+
-
-
-
-
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/view/error/redirect.jsp b/src/main/webapp/WEB-INF/view/error/redirect.jsp
index 8555fc7e3..b1e720f10 100644
--- a/src/main/webapp/WEB-INF/view/error/redirect.jsp
+++ b/src/main/webapp/WEB-INF/view/error/redirect.jsp
@@ -7,7 +7,7 @@ StringBuilder redirectPage = new StringBuilder();
redirectPage.append(((javax.servlet.http.HttpServletRequest)request).getContextPath());
if("systemError".equals(type)) {
if(requestUri != null && !requestUri.endsWith("systemError")) {
- redirectPage.append("/error/systemError");
+ redirectPage.append("/error/systemerror");
response.sendRedirect(redirectPage.toString());
} else {
response.sendError(statusCode);
@@ -16,10 +16,10 @@ if("systemError".equals(type)) {
redirectPage.append("/login/index?type=logout");
response.sendRedirect(redirectPage.toString());
} else if("badRequest".equals(type)) {
- redirectPage.append("/error/badRequest");
+ redirectPage.append("/error/badrequest");
response.sendRedirect(redirectPage.toString());
} else {
- redirectPage.append("/error/notFound?url=");
+ redirectPage.append("/error/notfound?url=");
redirectPage.append(java.net.URLEncoder.encode(requestUri , "UTF-8"));
response.sendRedirect(redirectPage.toString());
}
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 3d75bb3fb..950203d67 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -72,25 +72,6 @@
org.lastaflute.web.servlet.filter.LastaToActionFilter
-
-
diff --git a/src/main/webapp/js/search.js b/src/main/webapp/js/search.js
index b8a0dfbc1..fd5b3dcc0 100644
--- a/src/main/webapp/js/search.js
+++ b/src/main/webapp/js/search.js
@@ -2,7 +2,6 @@ $(function() {
var $result = $('#result');
var $queryId = $('#queryId');
var $favorites = $('.favorite', $result);
- var $screenshot = $('#screenshot', $result);
var $searchButton = $('#searchButton');
var contextPath = $('#contextPath').val();
@@ -56,38 +55,20 @@ $(function() {
});
$result.on('mouseover', 'a.link', function(e) {
- if ($screenshot.size() > 0) {
- var docId = $(this).attr('data-id'), rt = $('#rt').val(), url = $(
- this).attr('href'), queryId = $queryId.val(), buf = [];
- buf.push(contextPath);
- buf.push('/go/?rt=');
- buf.push(rt);
- buf.push('&docId=');
- buf.push(docId);
+ var docId = $(this).attr('data-id'), rt = $('#rt').val(), url = $(
+ this).attr('href'), queryId = $queryId.val(), buf = [];
+ buf.push(contextPath);
+ buf.push('/go/?rt=');
+ buf.push(rt);
+ buf.push('&docId=');
+ buf.push(docId);
- var hashIndex = url.indexOf('#');
- if (hashIndex >= 0) {
- var hashStr = url.substring(hashIndex);
- buf.push('&hash=');
- buf.push(encodeURIComponent(hashStr));
- buf.push(hashStr);
- }
-
- $screenshot.children().remove();
-
- var content = '
';
- $screenshot.append(content);
- $('img', $screenshot).error(function() {
- $screenshot.children().remove();
- });
- }
- });
-
- $result.on('mouseout', 'a.link', function(e) {
- if ($screenshot.size() > 0) {
- $screenshot.children().remove();
+ var hashIndex = url.indexOf('#');
+ if (hashIndex >= 0) {
+ var hashStr = url.substring(hashIndex);
+ buf.push('&hash=');
+ buf.push(encodeURIComponent(hashStr));
+ buf.push(hashStr);
}
});
diff --git a/src/packaging/common/env/fess b/src/packaging/common/env/fess
index 1372435b0..d952f0791 100644
--- a/src/packaging/common/env/fess
+++ b/src/packaging/common/env/fess
@@ -6,6 +6,7 @@
FESS_TEMP_PATH=${packaging.fess.temp.dir}
FESS_LOG_PATH=${packaging.fess.log.dir}
FESS_CONF_PATH=${packaging.fess.conf.dir}
+FESS_VAR_PATH=${packaging.fess.var.dir}
FESS_DICTIONARY_PATH=/var/lib/elasticsearch/config/
diff --git a/src/packaging/rpm/init.d/fess b/src/packaging/rpm/init.d/fess
index db12a48a5..dc95fb9f6 100644
--- a/src/packaging/rpm/init.d/fess
+++ b/src/packaging/rpm/init.d/fess
@@ -51,6 +51,7 @@ pidfile="$PID_DIR/${prog}.pid"
export FESS_TEMP_PATH
export FESS_LOG_PATH
export FESS_CONF_PATH
+export FESS_VAR_PATH
export FESS_DICTIONARY_PATH
export FESS_HEAP_SIZE
export ES_HOME