improve screenshot processing, modify error pages, add fess.var.path
This commit is contained in:
parent
29315338df
commit
6c546159ae
19 changed files with 222 additions and 195 deletions
7
pom.xml
7
pom.xml
|
@ -76,6 +76,7 @@
|
|||
<packaging.fess.app.dir>${packaging.fess.home.dir}/app</packaging.fess.app.dir>
|
||||
<packaging.fess.bin.dir>${packaging.fess.home.dir}/bin</packaging.fess.bin.dir>
|
||||
<packaging.fess.conf.dir>/etc/fess</packaging.fess.conf.dir>
|
||||
<packaging.fess.var.dir>/var/lib/fess</packaging.fess.var.dir>
|
||||
<packaging.fess.lib.dir>${packaging.fess.home.dir}/lib</packaging.fess.lib.dir>
|
||||
<packaging.fess.log.dir>/var/log/fess</packaging.fess.log.dir>
|
||||
<packaging.fess.temp.dir>/var/tmp/fess</packaging.fess.temp.dir>
|
||||
|
@ -456,6 +457,12 @@
|
|||
</source>
|
||||
</sources>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<directory>${packaging.fess.var.dir}</directory>
|
||||
<filemode>755</filemode>
|
||||
<username>${packaging.fess.user}</username>
|
||||
<groupname>${packaging.fess.group}</groupname>
|
||||
</mapping>
|
||||
<!-- bin -->
|
||||
<mapping>
|
||||
<directory>${packaging.fess.bin.dir}</directory>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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<String, Object> 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);
|
||||
}
|
||||
|
|
|
@ -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<String, Object> 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<String, Object> 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) {
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<head profile="http://a9.com/-/spec/opensearch/1.1/">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="content-style-type" content="text/css" />
|
||||
<meta http-equiv="content-script-type" content="text/javascript" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><la:message key="labels.error_title" /></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title><la:message key="labels.system_error_title" /></title>
|
||||
<link href="${f:url('/css/style-base.css')}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="${f:url('/css/style.css')}" rel="stylesheet"
|
||||
|
@ -17,16 +16,22 @@
|
|||
<div class="container">
|
||||
<div class="content">
|
||||
<div class="center row">
|
||||
<div class="span10">
|
||||
<div class="col-md-12">
|
||||
<h2>
|
||||
<la:message key="labels.error_title" />
|
||||
</h2>
|
||||
<div class="errormessage">${errorMessage}</div>
|
||||
<div>
|
||||
<la:info id="msg" message="true">
|
||||
<div class="alert alert-info">${msg}</div>
|
||||
</la:info>
|
||||
<la:errors styleClass="list-unstyled"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<jsp:include page="footer.jsp" />
|
||||
</div>
|
||||
<input type="hidden" id="contextPath" value="<%=request.getContextPath()%>" />
|
||||
<script type="text/javascript"
|
||||
src="${f:url('/js/jquery-2.1.4.min.js')}"></script>
|
||||
<script type="text/javascript" src="${f:url('/js/bootstrap.js')}"></script>
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -72,25 +72,6 @@
|
|||
<filter-class>org.lastaflute.web.servlet.filter.LastaToActionFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<!--
|
||||
<filter>
|
||||
<filter-name>adLoginInfoFilter</filter-name>
|
||||
<filter-class>org.codelibs.fess.filter.AdLoginInfoFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>redirectLoginError</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>useTestUser</param-name>
|
||||
<param-value>false</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>testUserName</param-name>
|
||||
<param-value>testUser</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
-->
|
||||
|
||||
<!-- SPNEGO -->
|
||||
<!--
|
||||
<filter>
|
||||
|
@ -202,12 +183,6 @@
|
|||
<filter-name>SpnegoHttpFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<filter-mapping>
|
||||
<filter-name>adLoginInfoFilter</filter-name>
|
||||
<url-pattern>*.do</url-pattern>
|
||||
<dispatcher>REQUEST</dispatcher>
|
||||
<dispatcher>FORWARD</dispatcher>
|
||||
</filter-mapping>
|
||||
-->
|
||||
|
||||
<!-- ================================================================================= -->
|
||||
|
|
|
@ -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 = '<a href="' + buf.join('')
|
||||
+ '"><img src="screenshot?queryId=' + queryId + '&docId='
|
||||
+ docId + '"></a>';
|
||||
$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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
1
src/packaging/common/env/fess
vendored
1
src/packaging/common/env/fess
vendored
|
@ -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/
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue