Sfoglia il codice sorgente

Merge pull request #297 from jflute/lastaflute

Lastaflute: migrating AdminDesignAtion
Shinsuke Sugaya 10 anni fa
parent
commit
2e08f731e1

+ 38 - 0
dbflute_fess/output/lasta/fess-lastadoc.html

@@ -17,5 +17,43 @@ body {
 	</style>
 	</style>
 </head>
 </head>
 <body>
 <body>
+/error/ :: ErrorAction <br>
+/login/ :: LoginAction <br>
+/ :: RootAction <br>
+/admin/design/ :: AdminDesignAction <br>
+/boost/document/rule/ :: BoostDocumentRuleAction <br>
+/crawl/ :: CrawlAction <br>
+/crawling/session/ :: CrawlingSessionAction <br>
+/data/ :: DataAction <br>
+/data/config/ :: DataConfigAction <br>
+/dict/ :: DictAction <br>
+/document/ :: DocumentAction <br>
+/failure/url/ :: FailureUrlAction <br>
+/file/authentication/ :: FileAuthenticationAction <br>
+/file/config/ :: FileConfigAction <br>
+/index/ :: IndexAction <br>
+/job/log/ :: JobLogAction <br>
+/key/match/ :: KeyMatchAction <br>
+/label/type/ :: LabelTypeAction <br>
+/log/ :: LogAction <br>
+/overlapping/host/ :: OverlappingHostAction <br>
+/path/mapping/ :: PathMappingAction <br>
+/request/header/ :: RequestHeaderAction <br>
+/role/type/ :: RoleTypeAction <br>
+/scheduled/job/ :: ScheduledJobAction <br>
+/search/list/ :: SearchListAction <br>
+/suggest/bad/word/ :: SuggestBadWordAction <br>
+/suggest/elevate/word/ :: SuggestElevateWordAction <br>
+/system/ :: SystemAction <br>
+/system/info/ :: SystemInfoAction <br>
+/web/authentication/ :: WebAuthenticationAction <br>
+/web/config/ :: WebConfigAction <br>
+/wizard/ :: WizardAction <br>
+/synonym/ :: SynonymAction <br>
+/user/dict/ :: UserDictAction <br>
+/abstract/login/ :: AbstractLoginAction <br>
+/fess/admin/ :: FessAdminAction <br>
+/fess/base/ :: FessBaseAction <br>
+/fess/search/ :: FessSearchAction <br>
 </body>
 </body>
 </html>
 </html>

+ 0 - 1185
src/main/java/org/codelibs/fess/app/web/IndexAction.java

@@ -1,1185 +0,0 @@
-/*
- * Copyright 2009-2015 the 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;
-
-import java.awt.Desktop;
-import java.beans.Beans;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.text.NumberFormat;
-import java.time.Clock;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.commons.io.IOUtils;
-import org.codelibs.core.beans.util.BeanUtil;
-import org.codelibs.core.io.InputStreamUtil;
-import org.codelibs.core.io.OutputStreamUtil;
-import org.codelibs.core.lang.StringUtil;
-import org.codelibs.core.misc.DynamicProperties;
-import org.codelibs.core.net.URLUtil;
-import org.codelibs.fess.Constants;
-import org.codelibs.fess.InvalidQueryException;
-import org.codelibs.fess.ResultOffsetExceededException;
-import org.codelibs.fess.SSCConstants;
-import org.codelibs.fess.UnsupportedSearchException;
-import org.codelibs.fess.client.FessEsClient;
-import org.codelibs.fess.client.FessEsClient.SearchConditionBuilder;
-import org.codelibs.fess.entity.LoginInfo;
-import org.codelibs.fess.es.exentity.ClickLog;
-import org.codelibs.fess.es.exentity.SearchLog;
-import org.codelibs.fess.es.exentity.UserInfo;
-import org.codelibs.fess.exception.SSCActionMessagesException;
-import org.codelibs.fess.helper.CrawlingConfigHelper;
-import org.codelibs.fess.helper.FieldHelper;
-import org.codelibs.fess.helper.HotSearchWordHelper;
-import org.codelibs.fess.helper.HotSearchWordHelper.Range;
-import org.codelibs.fess.helper.LabelTypeHelper;
-import org.codelibs.fess.helper.OpenSearchHelper;
-import org.codelibs.fess.helper.QueryHelper;
-import org.codelibs.fess.helper.RoleQueryHelper;
-import org.codelibs.fess.helper.SearchLogHelper;
-import org.codelibs.fess.helper.SystemHelper;
-import org.codelibs.fess.helper.UserInfoHelper;
-import org.codelibs.fess.helper.ViewHelper;
-import org.codelibs.fess.screenshot.ScreenShotManager;
-import org.codelibs.fess.util.ComponentUtil;
-import org.codelibs.fess.util.FacetResponse;
-import org.codelibs.fess.util.MoreLikeThisResponse;
-import org.codelibs.fess.util.QueryResponseList;
-import org.codelibs.fess.util.WebApiUtil;
-import org.codelibs.robot.util.CharUtil;
-import org.dbflute.optional.OptionalEntity;
-import org.elasticsearch.index.query.QueryBuilders;
-import org.elasticsearch.index.query.TermQueryBuilder;
-import org.lastaflute.taglib.function.LaFunctions;
-import org.lastaflute.web.util.LaRequestUtil;
-import org.lastaflute.web.util.LaResponseUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class IndexAction {
-
-    private static final Logger logger = LoggerFactory.getLogger(IndexAction.class);
-
-    private static final String REDIRECT_TO_INDEX = "index?redirect=true";
-
-    private static final String LABEL_FIELD = "label";
-
-    protected static final long DEFAULT_START_COUNT = 0;
-
-    protected static final int DEFAULT_PAGE_SIZE = 20;
-
-    protected static final int MAX_PAGE_SIZE = 100;
-
-    protected static final int DEFAULT_SUGGEST_PAGE_SIZE = 5;
-
-    protected static final int DEFAULT_SPELLCHECK_PAGE_SIZE = 5;
-
-    protected static final Pattern FIELD_EXTRACTION_PATTERN = Pattern.compile("^([a-zA-Z0-9_]+):.*");
-
-    //@ActionForm
-    @Resource
-    protected IndexForm indexForm;
-
-    @Resource
-    protected FessEsClient fessEsClient;
-
-    @Binding(bindingType = BindingType.MAY)
-    @Resource
-    protected ScreenShotManager screenShotManager;
-
-    @Resource
-    protected LabelTypeHelper labelTypeHelper;
-
-    @Resource
-    protected ViewHelper viewHelper;
-
-    @Resource
-    protected QueryHelper queryHelper;
-
-    @Resource
-    protected RoleQueryHelper roleQueryHelper;
-
-    @Resource
-    protected UserInfoHelper userInfoHelper;
-
-    @Resource
-    protected OpenSearchHelper openSearchHelper;
-
-    @Resource
-    protected SystemHelper systemHelper;
-
-    @Resource
-    protected FieldHelper fieldHelper;
-
-    @Resource
-    protected DynamicProperties crawlerProperties;
-
-    @Resource
-    protected HttpServletRequest request;
-
-    @Resource
-    protected HttpServletResponse response;
-
-    public List<Map<String, Object>> documentItems;
-
-    public FacetResponse facetResponse;
-
-    public MoreLikeThisResponse moreLikeThisResponse;
-
-    public String pageSize;
-
-    public String currentPageNumber;
-
-    public String allRecordCount;
-
-    public String allPageCount;
-
-    public boolean existNextPage;
-
-    public boolean existPrevPage;
-
-    public String currentStartRecordNumber;
-
-    public String currentEndRecordNumber;
-
-    public List<String> pageNumberList;
-
-    public String execTime;
-
-    public String queryTime = Constants.INVALID_NUMERIC_PARAMETER;
-
-    public String searchTime = Constants.INVALID_NUMERIC_PARAMETER;
-
-    public boolean partialResults;
-
-    public List<Map<String, String>> labelTypeItems;
-
-    public List<Map<String, String>> langItems;
-
-    public String errorMessage;
-
-    protected String pagingQuery = null;
-
-    public boolean searchLogSupport;
-
-    public boolean favoriteSupport;
-
-    public boolean screenShotSupport;
-
-    public String username;
-
-    public String appendHighlightQueries;
-
-    @PostConstruct
-    public void init() {
-        searchLogSupport = Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE));
-        favoriteSupport = Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE));
-    }
-
-    public String getPagingQuery() {
-        if (pagingQuery == null) {
-            final StringBuilder buf = new StringBuilder(200);
-            if (indexForm.additional != null) {
-                final Set<String> fieldSet = new HashSet<String>();
-                for (final String additional : indexForm.additional) {
-                    if (StringUtil.isNotBlank(additional) && additional.length() < 1000 && !hasFieldInQuery(fieldSet, additional)) {
-                        buf.append("&additional=").append(LaFunctions.u(additional));
-                    }
-                }
-            }
-            if (StringUtil.isNotBlank(indexForm.sort)) {
-                buf.append("&sort=").append(LaFunctions.u(indexForm.sort));
-            }
-            if (StringUtil.isNotBlank(indexForm.op)) {
-                buf.append("&op=").append(LaFunctions.u(indexForm.op));
-            }
-            if (indexForm.lang != null) {
-                final Set<String> langSet = new HashSet<String>();
-                for (final String lang : indexForm.lang) {
-                    if (StringUtil.isNotBlank(lang) && lang.length() < 1000) {
-                        if (Constants.ALL_LANGUAGES.equals(lang)) {
-                            langSet.clear();
-                            break;
-                        }
-                        final String normalizeLang = systemHelper.normalizeLang(lang);
-                        if (normalizeLang != null) {
-                            langSet.add(normalizeLang);
-                        }
-                    }
-                }
-                if (!langSet.isEmpty()) {
-                    for (final String lang : langSet) {
-                        buf.append("&lang=").append(LaFunctions.u(lang));
-                    }
-                }
-            }
-            if (!indexForm.fields.isEmpty()) {
-                for (final Map.Entry<String, String[]> entry : indexForm.fields.entrySet()) {
-                    final String[] values = entry.getValue();
-                    if (values != null) {
-                        for (final String v : values) {
-                            if (StringUtil.isNotBlank(v)) {
-                                buf.append("&fields.").append(LaFunctions.u(entry.getKey())).append('=').append(LaFunctions.u(v));
-                            }
-                        }
-                    }
-                }
-            }
-
-            pagingQuery = buf.toString();
-        }
-        return pagingQuery;
-    }
-
-    //@Execute(validator = false, input = "index.jsp")
-    public String index() {
-        searchAvailable();
-
-        buildViewParams();
-        buildInitParams();
-
-        return "index.jsp";
-    }
-
-    protected void searchAvailable() {
-        final String supportedSearch =
-                crawlerProperties.getProperty(Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY, Constants.SUPPORTED_SEARCH_WEB);
-        if (Constants.SUPPORTED_SEARCH_NONE.equals(supportedSearch)) {
-            throw new UnsupportedSearchException("A search is not supported: " + LaRequestUtil.getRequest().getRequestURL());
-        }
-    }
-
-    protected String doSearch() {
-        searchAvailable();
-
-        if (StringUtil.isBlank(indexForm.query)) {
-            try {
-                final String optionQuery = queryHelper.buildOptionQuery(indexForm.options);
-                indexForm.query = optionQuery;
-            } catch (final InvalidQueryException e) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug(e.getMessage(), e);
-                }
-                throw new SSCActionMessagesException(e, e.getMessageCode());
-            }
-        }
-
-        if (StringUtil.isBlank(indexForm.query) && indexForm.fields.isEmpty()) {
-            // redirect to index page
-            indexForm.query = null;
-            return REDIRECT_TO_INDEX;
-        }
-
-        updateSearchParams();
-        buildViewParams();
-        doSearchInternal();
-
-        return "search.jsp";
-    }
-
-    //@Execute(validator = true, input = "index")
-    public String cache() {
-        Map<String, Object> doc = null;
-        try {
-            doc = fessEsClient.getDocument(fieldHelper.docIndex, fieldHelper.docType, queryRequestBuilder -> {
-                final TermQueryBuilder termQuery = QueryBuilders.termQuery(fieldHelper.docIdField, indexForm.docId);
-                queryRequestBuilder.setQuery(termQuery);
-                queryRequestBuilder.addFields(queryHelper.getResponseFields());
-                return true;
-            }).get();
-        } catch (final Exception e) {
-            logger.warn("Failed to request: " + indexForm.docId, e);
-        }
-        if (doc == null) {
-            errorMessage =
-                    MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "errors.docid_not_found", indexForm.docId);
-            return "error.jsp";
-        }
-
-        final String content = viewHelper.createCacheContent(doc, indexForm.hq);
-        if (content == null) {
-            errorMessage =
-                    MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "errors.docid_not_found", indexForm.docId);
-            return "error.jsp";
-        }
-        LaResponseUtil.write(content, "text/html", Constants.UTF_8);
-
-        return null;
-    }
-
-    //@Execute(validator = true, input = "index")
-    public String go() throws IOException {
-        Map<String, Object> doc = null;
-        try {
-            doc = fessEsClient.getDocument(fieldHelper.docIndex, fieldHelper.docType, queryRequestBuilder -> {
-                final TermQueryBuilder termQuery = QueryBuilders.termQuery(fieldHelper.docIdField, indexForm.docId);
-                queryRequestBuilder.setQuery(termQuery);
-                queryRequestBuilder.addFields(queryHelper.getResponseFields());
-                return true;
-            }).get();
-        } catch (final Exception e) {
-            logger.warn("Failed to request: " + indexForm.docId, e);
-        }
-        if (doc == null) {
-            errorMessage =
-                    MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "errors.docid_not_found", indexForm.docId);
-            return "error.jsp";
-        }
-        final Object urlObj = doc.get(fieldHelper.urlField);
-        if (urlObj == null) {
-            errorMessage =
-                    MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "errors.document_not_found", indexForm.docId);
-            return "error.jsp";
-        }
-        final String url = urlObj.toString();
-
-        if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE))) {
-            final String userSessionId = userInfoHelper.getUserCode();
-            if (userSessionId != null) {
-                final SearchLogHelper searchLogHelper = ComponentUtil.getSearchLogHelper();
-                final ClickLog clickLog = new ClickLog();
-                clickLog.setUrl(url);
-                final long now = systemHelper.getCurrentTimeAsLong();
-                clickLog.setRequestedTime(now);
-                clickLog.setQueryRequestedTime(Long.parseLong(indexForm.rt));
-                clickLog.setUserSessionId(userSessionId);
-                clickLog.setDocId(indexForm.docId);
-                long clickCount = 0;
-                final Object count = doc.get(fieldHelper.clickCountField);
-                if (count instanceof Long) {
-                    clickCount = ((Long) count).longValue();
-                }
-                clickLog.setClickCount(clickCount);
-                searchLogHelper.addClickLog(clickLog);
-            }
-        }
-
-        String hash;
-        if (StringUtil.isNotBlank(indexForm.hash)) {
-            final String value = URLUtil.decode(indexForm.hash, Constants.UTF_8);
-            final StringBuilder buf = new StringBuilder(value.length() + 100);
-            for (final char c : value.toCharArray()) {
-                if (CharUtil.isUrlChar(c) || c == ' ') {
-                    buf.append(c);
-                } else {
-                    try {
-                        buf.append(URLEncoder.encode(String.valueOf(c), Constants.UTF_8));
-                    } catch (final UnsupportedEncodingException e) {
-                        // NOP
-                    }
-                }
-            }
-            hash = buf.toString();
-        } else {
-            hash = StringUtil.EMPTY;
-        }
-
-        if (isFileSystemPath(url)) {
-            if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_FILE_PROXY_PROPERTY, Constants.TRUE))) {
-                final CrawlingConfigHelper crawlingConfigHelper = ComponentUtil.getCrawlingConfigHelper();
-                try {
-                    crawlingConfigHelper.writeContent(doc);
-                    return null;
-                } catch (final Exception e) {
-                    logger.error("Failed to load: " + doc, e);
-                    errorMessage =
-                            MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "errors.not_load_from_server", url);
-                    return "error.jsp";
-                }
-            } 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()) {
-                    errorMessage =
-                            MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "errors.not_found_on_file_system", url);
-                    return "error.jsp";
-                }
-                final Desktop desktop = Desktop.getDesktop();
-                try {
-                    desktop.open(file);
-                } catch (final Exception e) {
-                    errorMessage =
-                            MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "errors.could_not_open_on_system", url);
-                    logger.warn("Could not open " + path, e);
-                    return "error.jsp";
-                }
-
-                LaResponseUtil.getResponse().setStatus(HttpServletResponse.SC_NO_CONTENT);
-                return null;
-            } else {
-                LaResponseUtil.getResponse().sendRedirect(url + hash);
-            }
-        } else {
-            LaResponseUtil.getResponse().sendRedirect(url + hash);
-        }
-        return null;
-    }
-
-    //@Execute(validator = false, input = "index")
-    public String search() {
-        if (viewHelper.isUseSession() && StringUtil.isNotBlank(indexForm.num)) {
-            normalizePageNum();
-            final HttpSession session = request.getSession();
-            if (session != null) {
-                session.setAttribute(Constants.RESULTS_PER_PAGE, indexForm.num);
-            }
-        }
-
-        return doSearch();
-    }
-
-    //@Execute(validator = false, input = "index")
-    public String prev() {
-        return doMove(-1);
-    }
-
-    //@Execute(validator = false, input = "index")
-    public String next() {
-        return doMove(1);
-    }
-
-    //@Execute(validator = false, input = "index")
-    public String move() {
-        return doMove(0);
-    }
-
-    //@Execute(validator = false)
-    public String screenshot() {
-        OutputStream out = null;
-        BufferedInputStream in = null;
-        try {
-            final Map<String, Object> doc = fessEsClient.getDocument(fieldHelper.docIndex, fieldHelper.docType, queryRequestBuilder -> {
-                final TermQueryBuilder termQuery = QueryBuilders.termQuery(fieldHelper.docIdField, indexForm.docId);
-                queryRequestBuilder.setQuery(termQuery);
-                queryRequestBuilder.addFields(queryHelper.getResponseFields());
-                return true;
-            }).get();
-            final String url = doc == null ? null : (String) doc.get(fieldHelper.urlField);
-            if (StringUtil.isBlank(indexForm.queryId) || StringUtil.isBlank(url) || screenShotManager == null) {
-                // 404
-                response.sendError(HttpServletResponse.SC_NOT_FOUND);
-                return null;
-            }
-
-            final File screenShotFile = screenShotManager.getScreenShotFile(indexForm.queryId, indexForm.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));
-            InputStreamUtil.copy(in, out);
-            OutputStreamUtil.flush(out);
-        } catch (final Exception e) {
-            logger.error("Failed to response: " + indexForm.docId, e);
-        } finally {
-            IOUtils.closeQuietly(in);
-            IOUtils.closeQuietly(out);
-        }
-
-        return null;
-    }
-
-    //@Execute(validator = false)
-    public String searchApi() {
-        try {
-            WebApiUtil.setObject("searchQuery", doSearchInternal());
-            WebApiUtil.setObject("searchTime", searchTime);
-            WebApiUtil.setObject("queryTime", queryTime);
-            WebApiUtil.setObject("execTime", execTime);
-            WebApiUtil.setObject("pageSize", pageSize);
-            WebApiUtil.setObject("currentPageNumber", currentPageNumber);
-            WebApiUtil.setObject("allRecordCount", allRecordCount);
-            WebApiUtil.setObject("allPageCount", allPageCount);
-            WebApiUtil.setObject("documentItems", documentItems);
-            WebApiUtil.setObject("facetResponse", facetResponse);
-            WebApiUtil.setObject("moreLikeThisResponse", moreLikeThisResponse);
-        } catch (final Exception e) {
-            WebApiUtil.setError(1, e);
-        }
-        return null;
-    }
-
-    //@Execute(validator = false)
-    public String suggestApi() {
-        if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_API_SUGGEST_PROPERTY, Constants.TRUE))) {
-            WebApiUtil.setError(9, "Unsupported operation.");
-            return null;
-        }
-
-        if (indexForm.fn == null || indexForm.fn.length == 0) {
-            WebApiUtil.setError(2, "The field name is empty.");
-            return null;
-        }
-
-        if (StringUtil.isBlank(indexForm.query)) {
-            WebApiUtil.setError(3, "Your query is empty.");
-            return null;
-        }
-
-        if (StringUtil.isBlank(indexForm.num)) {
-            indexForm.num = String.valueOf(DEFAULT_SUGGEST_PAGE_SIZE);
-        }
-
-        int num = Integer.parseInt(indexForm.num);
-        if (num > getMaxPageSize()) {
-            num = getMaxPageSize();
-        }
-
-        final String[] fieldNames = indexForm.fn;
-        final String[] labels = indexForm.fields.get("label");
-
-        //        final List<SuggestResponse> suggestResultList = new ArrayList<SuggestResponse>();
-        //        WebApiUtil.setObject("suggestResultList", suggestResultList);
-
-        final List<String> suggestFieldName = Arrays.asList(fieldNames);
-        WebApiUtil.setObject("suggestFieldName", suggestFieldName);
-
-        if (labels == null) {
-            new ArrayList<String>();
-        } else {
-            Arrays.asList(labels);
-        }
-
-        try {
-            if (roleQueryHelper != null) {
-                roleQueryHelper.build();
-            } else {
-                new HashSet<>();
-            }
-
-            // TODO
-            //            final SuggestResponse suggestResponse =
-            //                    suggestService.getSuggestResponse(indexForm.query, suggestFieldName, labelList, new ArrayList<String>(roleSet), num);
-            //
-            //            if (!suggestResponse.isEmpty()) {
-            //                suggestResultList.add(suggestResponse);
-            //            }
-
-            WebApiUtil.setObject("suggestRecordCount", 1);
-        } catch (final Exception e) {
-            WebApiUtil.setError(1, e);
-        }
-        return null;
-    }
-
-    //@Execute(validator = false)
-    public String hotSearchWordApi() {
-        if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY, Constants.TRUE))) {
-            WebApiUtil.setError(9, "Unsupported operation.");
-            return null;
-        }
-
-        Range range;
-        if (indexForm.range == null) {
-            range = Range.ENTIRE;
-        } else if ("day".equals(indexForm.range) || "1".equals(indexForm.range)) {
-            range = Range.ONE_DAY;
-        } else if ("week".equals(indexForm.range) || "7".equals(indexForm.range)) {
-            range = Range.ONE_DAY;
-        } else if ("month".equals(indexForm.range) || "30".equals(indexForm.range)) {
-            range = Range.ONE_DAY;
-        } else if ("year".equals(indexForm.range) || "365".equals(indexForm.range)) {
-            range = Range.ONE_DAY;
-        } else {
-            range = Range.ENTIRE;
-        }
-
-        try {
-            final HotSearchWordHelper hotSearchWordHelper = ComponentUtil.getHotSearchWordHelper();
-            final List<String> hotSearchWordList = hotSearchWordHelper.getHotSearchWordList(range);
-            WebApiUtil.setObject("hotSearchWordList", hotSearchWordList);
-        } catch (final Exception e) {
-            WebApiUtil.setError(1, e);
-        }
-        return null;
-
-    }
-
-    //@Execute(validator = false)
-    public String favoriteApi() {
-        if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE))) {
-            WebApiUtil.setError(9, "Unsupported operation.");
-            return null;
-        }
-
-        try {
-            final Map<String, Object> doc =
-                    indexForm.docId == null ? null : fessEsClient.getDocument(fieldHelper.docIndex, fieldHelper.docType,
-                            queryRequestBuilder -> {
-                                final TermQueryBuilder termQuery = QueryBuilders.termQuery(fieldHelper.docIdField, indexForm.docId);
-                                queryRequestBuilder.setQuery(termQuery);
-                                queryRequestBuilder.addFields(queryHelper.getResponseFields());
-                                return true;
-                            }).get();
-            final String userCode = userInfoHelper.getUserCode();
-            final String favoriteUrl = doc == null ? null : (String) doc.get(fieldHelper.urlField);
-
-            if (StringUtil.isBlank(userCode)) {
-                WebApiUtil.setError(2, "No user session.");
-                return null;
-            } else if (StringUtil.isBlank(favoriteUrl)) {
-                WebApiUtil.setError(2, "URL is null.");
-                return null;
-            }
-
-            final String[] docIds = userInfoHelper.getResultDocIds(URLDecoder.decode(indexForm.queryId, Constants.UTF_8));
-            if (docIds == null) {
-                WebApiUtil.setError(6, "No searched urls.");
-                return null;
-            }
-
-            boolean found = false;
-            for (final String docId : docIds) {
-                if (indexForm.docId.equals(docId)) {
-                    found = true;
-                    break;
-                }
-            }
-            if (!found) {
-                WebApiUtil.setError(5, "Not found: " + favoriteUrl);
-                return null;
-            }
-
-            final SearchLogHelper searchLogHelper = ComponentUtil.getSearchLogHelper();
-            if (!searchLogHelper.addfavoriteLog(userCode, favoriteUrl)) {
-                WebApiUtil.setError(4, "Failed to add url: " + favoriteUrl);
-                return null;
-            }
-
-            final FessEsClient fessEsClient = ComponentUtil.getElasticsearchClient();
-            final Object count = doc.get(fieldHelper.favoriteCountField);
-            if (count instanceof Long) {
-                fessEsClient.update(fieldHelper.docIndex, fieldHelper.docType, indexForm.docId, fieldHelper.favoriteCountField,
-                        ((Long) count).longValue() + 1);
-            } else {
-                WebApiUtil.setError(7, "Failed to update count: " + favoriteUrl);
-                return null;
-            }
-        } catch (final Exception e) {
-            WebApiUtil.setError(1, e);
-        }
-        return null;
-
-    }
-
-    //@Execute(validator = false)
-    public String osdd() {
-        openSearchHelper.write(LaResponseUtil.getResponse());
-        return null;
-    }
-
-    //@Execute(validator = false, input = "index")
-    public String help() {
-        buildViewParams();
-        buildInitParams();
-        return "help.jsp";
-    }
-
-    protected String doSearchInternal() {
-        final StringBuilder queryBuf = new StringBuilder(255);
-        if (StringUtil.isNotBlank(indexForm.query)) {
-            queryBuf.append(indexForm.query);
-        }
-        if (StringUtil.isNotBlank(indexForm.op)) {
-            request.setAttribute(Constants.DEFAULT_OPERATOR, indexForm.op);
-        }
-        if (queryBuf.indexOf(" OR ") >= 0) {
-            queryBuf.insert(0, '(').append(')');
-        }
-        if (indexForm.additional != null) {
-            final Set<String> fieldSet = new HashSet<String>();
-            for (final String additional : indexForm.additional) {
-                if (StringUtil.isNotBlank(additional) && additional.length() < 1000 && !hasFieldInQuery(fieldSet, additional)) {
-                    queryBuf.append(' ').append(additional);
-                }
-            }
-        }
-        if (!indexForm.fields.isEmpty()) {
-            for (final Map.Entry<String, String[]> entry : indexForm.fields.entrySet()) {
-                final List<String> valueList = new ArrayList<String>();
-                final String[] values = entry.getValue();
-                if (values != null) {
-                    for (final String v : values) {
-                        valueList.add(v);
-                    }
-                }
-                if (valueList.size() == 1) {
-                    queryBuf.append(' ').append(entry.getKey()).append(":\"").append(valueList.get(0)).append('\"');
-                } else if (valueList.size() > 1) {
-                    queryBuf.append(" (");
-                    for (int i = 0; i < valueList.size(); i++) {
-                        if (i != 0) {
-                            queryBuf.append(" OR");
-                        }
-                        queryBuf.append(' ').append(entry.getKey()).append(":\"").append(valueList.get(i)).append('\"');
-                    }
-                    queryBuf.append(')');
-                }
-
-            }
-        }
-        if (StringUtil.isNotBlank(indexForm.sort)) {
-            queryBuf.append(" sort:").append(indexForm.sort);
-        }
-        if (indexForm.lang != null) {
-            final Set<String> langSet = new HashSet<>();
-            for (final String lang : indexForm.lang) {
-                if (StringUtil.isNotBlank(lang) && lang.length() < 1000) {
-                    if (Constants.ALL_LANGUAGES.equalsIgnoreCase(lang)) {
-                        langSet.add(Constants.ALL_LANGUAGES);
-                    } else {
-                        final String normalizeLang = systemHelper.normalizeLang(lang);
-                        if (normalizeLang != null) {
-                            langSet.add(normalizeLang);
-                        }
-                    }
-                }
-            }
-            if (langSet.size() > 1 && langSet.contains(Constants.ALL_LANGUAGES)) {
-                langSet.clear();
-                indexForm.lang = new String[] { Constants.ALL_LANGUAGES };
-            } else {
-                langSet.remove(Constants.ALL_LANGUAGES);
-            }
-            appendLangQuery(queryBuf, langSet);
-        } else if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USE_BROWSER_LOCALE_FOR_SEARCH_PROPERTY, Constants.FALSE))) {
-            final Set<String> langSet = new HashSet<>();
-            final Enumeration<Locale> locales = request.getLocales();
-            if (locales != null) {
-                while (locales.hasMoreElements()) {
-                    final Locale locale = locales.nextElement();
-                    final String normalizeLang = systemHelper.normalizeLang(locale.toString());
-                    if (normalizeLang != null) {
-                        langSet.add(normalizeLang);
-                    }
-                }
-                if (!langSet.isEmpty()) {
-                    appendLangQuery(queryBuf, langSet);
-                }
-            }
-        }
-
-        final String query = queryBuf.toString().trim();
-
-        // init pager
-        if (StringUtil.isBlank(indexForm.start)) {
-            indexForm.start = String.valueOf(DEFAULT_START_COUNT);
-        } else {
-            try {
-                Long.parseLong(indexForm.start);
-            } catch (final NumberFormatException e) {
-                indexForm.start = String.valueOf(DEFAULT_START_COUNT);
-            }
-        }
-        if (StringUtil.isBlank(indexForm.num)) {
-            indexForm.num = String.valueOf(getDefaultPageSize());
-        }
-        normalizePageNum();
-
-        final int pageStart = Integer.parseInt(indexForm.start);
-        final int pageNum = Integer.parseInt(indexForm.num);
-        try {
-            documentItems =
-                    fessEsClient.getDocumentList(fieldHelper.docIndex, fieldHelper.docType,
-                            searchRequestBuilder -> {
-                                return SearchConditionBuilder.builder(searchRequestBuilder).query(query).offset(pageStart).size(pageNum)
-                                        .facetInfo(indexForm.facet).geoInfo(indexForm.geo).responseFields(queryHelper.getResponseFields())
-                                        .build();
-                            });
-        } catch (final InvalidQueryException e) {
-            if (logger.isDebugEnabled()) {
-                logger.debug(e.getMessage(), e);
-            }
-            throw new SSCActionMessagesException(e, e.getMessageCode());
-        } catch (final ResultOffsetExceededException e) {
-            if (logger.isDebugEnabled()) {
-                logger.debug(e.getMessage(), e);
-            }
-            throw new SSCActionMessagesException(e, "errors.result_size_exceeded");
-        }
-        // search
-        final QueryResponseList queryResponseList = (QueryResponseList) documentItems;
-        facetResponse = queryResponseList.getFacetResponse();
-        moreLikeThisResponse = queryResponseList.getMoreLikeThisResponse();
-        final NumberFormat nf = NumberFormat.getInstance(LaRequestUtil.getRequest().getLocale());
-        nf.setMaximumIntegerDigits(2);
-        nf.setMaximumFractionDigits(2);
-        try {
-            execTime = nf.format((double) queryResponseList.getExecTime() / 1000);
-        } catch (final Exception e) {
-            // ignore
-        }
-
-        final Clock clock = Clock.systemDefaultZone();
-        indexForm.rt = Long.toString(clock.millis());
-
-        // favorite
-        if (favoriteSupport || screenShotManager != null) {
-            indexForm.queryId = userInfoHelper.generateQueryId(query, documentItems);
-            if (screenShotManager != null) {
-                screenShotManager.storeRequest(indexForm.queryId, documentItems);
-                screenShotSupport = true;
-            }
-        }
-
-        // search log
-        if (searchLogSupport) {
-            final long now = systemHelper.getCurrentTimeAsLong();
-
-            final SearchLogHelper searchLogHelper = ComponentUtil.getSearchLogHelper();
-            final SearchLog searchLog = new SearchLog();
-
-            String userCode = null;
-            if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE))) {
-                userCode = userInfoHelper.getUserCode();
-                if (StringUtil.isNotBlank(userCode)) {
-                    final UserInfo userInfo = new UserInfo();
-                    userInfo.setCode(userCode);
-                    userInfo.setCreatedTime(now);
-                    userInfo.setUpdatedTime(now);
-                    searchLog.setUserInfo(OptionalEntity.of(userInfo));
-                }
-            }
-
-            searchLog.setHitCount(queryResponseList.getAllRecordCount());
-            searchLog.setResponseTime(Integer.valueOf((int) queryResponseList.getExecTime()));
-            searchLog.setSearchWord(StringUtils.abbreviate(query, 1000));
-            searchLog.setSearchQuery(StringUtils.abbreviate(queryResponseList.getSearchQuery(), 1000));
-            searchLog.setSolrQuery(StringUtils.abbreviate(queryResponseList.getSolrQuery(), 1000));
-            searchLog.setRequestedTime(now);
-            searchLog.setQueryOffset(pageStart);
-            searchLog.setQueryPageSize(pageNum);
-
-            searchLog.setClientIp(StringUtils.abbreviate(request.getRemoteAddr(), 50));
-            searchLog.setReferer(StringUtils.abbreviate(request.getHeader("referer"), 1000));
-            searchLog.setUserAgent(StringUtils.abbreviate(request.getHeader("user-agent"), 255));
-            if (userCode != null) {
-                searchLog.setUserSessionId(userCode);
-            }
-            final Object accessType = request.getAttribute(Constants.SEARCH_LOG_ACCESS_TYPE);
-            if (Constants.SEARCH_LOG_ACCESS_TYPE_JSON.equals(accessType)) {
-                searchLog.setAccessType(Constants.SEARCH_LOG_ACCESS_TYPE_JSON);
-            } else if (Constants.SEARCH_LOG_ACCESS_TYPE_XML.equals(accessType)) {
-                searchLog.setAccessType(Constants.SEARCH_LOG_ACCESS_TYPE_XML);
-            } else if (Constants.SEARCH_LOG_ACCESS_TYPE_OTHER.equals(accessType)) {
-                searchLog.setAccessType(Constants.SEARCH_LOG_ACCESS_TYPE_OTHER);
-            } else {
-                searchLog.setAccessType(Constants.SEARCH_LOG_ACCESS_TYPE_WEB);
-            }
-
-            @SuppressWarnings("unchecked")
-            final Map<String, List<String>> fieldLogMap = (Map<String, List<String>>) request.getAttribute(Constants.FIELD_LOGS);
-            if (fieldLogMap != null) {
-                for (final Map.Entry<String, List<String>> logEntry : fieldLogMap.entrySet()) {
-                    for (final String value : logEntry.getValue()) {
-                        searchLog.addSearchFieldLogValue(logEntry.getKey(), StringUtils.abbreviate(value, 1000));
-                    }
-                }
-            }
-
-            searchLogHelper.addSearchLog(searchLog);
-        }
-
-        final String[] highlightQueries = (String[]) request.getAttribute(Constants.HIGHLIGHT_QUERIES);
-        if (highlightQueries != null) {
-            final StringBuilder buf = new StringBuilder(100);
-            for (final String q : highlightQueries) {
-                buf.append("&hq=").append(q);
-            }
-            appendHighlightQueries = buf.toString();
-        }
-
-        BeanUtil.copyBeanToBean(documentItems, this, option -> option.include("pageSize", "currentPageNumber", "allRecordCount",
-                "allPageCount", "existNextPage", "existPrevPage", "currentStartRecordNumber", "currentEndRecordNumber", "pageNumberList",
-                "partialResults", "queryTime", "searchTime"));
-
-        return query;
-    }
-
-    private void appendLangQuery(final StringBuilder queryBuf, final Set<String> langSet) {
-        if (langSet.size() == 1) {
-            queryBuf.append(' ').append(fieldHelper.langField).append(':').append(langSet.iterator().next());
-        } else if (langSet.size() > 1) {
-            boolean first = true;
-            for (final String lang : langSet) {
-                if (first) {
-                    queryBuf.append(" (");
-                    first = false;
-                } else {
-                    queryBuf.append(" OR ");
-                }
-                queryBuf.append(fieldHelper.langField).append(':').append(lang);
-            }
-            queryBuf.append(')');
-        }
-    }
-
-    protected void updateSearchParams() {
-        if (indexForm.facet == null) {
-            indexForm.facet = queryHelper.getDefaultFacetInfo();
-        }
-
-        if (indexForm.geo == null) {
-            indexForm.geo = queryHelper.getDefaultGeoInfo();
-        }
-    }
-
-    protected boolean isFileSystemPath(final String url) {
-        return url.startsWith("file:") || url.startsWith("smb:");
-    }
-
-    protected String doMove(final int move) {
-        int pageNum = getDefaultPageSize();
-        if (StringUtil.isBlank(indexForm.num)) {
-            indexForm.num = String.valueOf(getDefaultPageSize());
-        } else {
-            try {
-                pageNum = Integer.parseInt(indexForm.num);
-            } catch (final NumberFormatException e) {
-                indexForm.num = String.valueOf(getDefaultPageSize());
-            }
-        }
-
-        if (StringUtil.isBlank(indexForm.pn)) {
-            indexForm.start = String.valueOf(DEFAULT_START_COUNT);
-        } else {
-            Integer pageNumber = Integer.parseInt(indexForm.pn);
-            if (pageNumber != null && pageNumber > 0) {
-                pageNumber = pageNumber + move;
-                if (pageNumber < 1) {
-                    pageNumber = 1;
-                }
-                indexForm.start = String.valueOf((pageNumber - 1) * pageNum);
-            } else {
-                indexForm.start = String.valueOf(DEFAULT_START_COUNT);
-            }
-        }
-
-        return doSearch();
-    }
-
-    public List<Map<String, String>> getLabelTypeItems() {
-        return labelTypeItems;
-    }
-
-    public boolean isDisplayLabelTypeItems() {
-        if (labelTypeItems != null) {
-            return !labelTypeItems.isEmpty();
-        } else {
-            return false;
-        }
-    }
-
-    public String getDisplayQuery() {
-        final StringBuilder buf = new StringBuilder(100);
-        buf.append(indexForm.query);
-        if (!indexForm.fields.isEmpty() && indexForm.fields.containsKey(LABEL_FIELD)) {
-            final String[] values = indexForm.fields.get(LABEL_FIELD);
-            final List<String> labelList = new ArrayList<String>();
-            if (values != null) {
-                for (final String v : values) {
-                    labelList.add(v);
-                }
-            }
-            for (final String labelTypeValue : labelList) {
-                for (final Map<String, String> map : labelTypeItems) {
-                    if (map.get(Constants.ITEM_VALUE).equals(labelTypeValue)) {
-                        buf.append(' ');
-                        buf.append(map.get(Constants.ITEM_LABEL));
-                        break;
-                    }
-                }
-            }
-        }
-        return buf.toString();
-    }
-
-    protected void buildViewParams() {
-        // label
-        labelTypeItems = labelTypeHelper.getLabelTypeItemList();
-
-        if (!labelTypeItems.isEmpty() && !indexForm.fields.containsKey(LABEL_FIELD)) {
-            final String defaultLabelValue = crawlerProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
-            if (StringUtil.isNotBlank(defaultLabelValue)) {
-                final String[] values = defaultLabelValue.split("\n");
-                if (values != null && values.length > 0) {
-                    final List<String> list = new ArrayList<String>(values.length);
-                    for (final String value : values) {
-                        if (StringUtil.isNotBlank(value)) {
-                            list.add(value);
-                        }
-                    }
-                    if (!list.isEmpty()) {
-                        indexForm.fields.put(LABEL_FIELD, list.toArray(new String[list.size()]));
-                    }
-                }
-            }
-        }
-
-        final Map<String, String> labelMap = new LinkedHashMap<String, String>();
-        if (!labelTypeItems.isEmpty()) {
-            for (final Map<String, String> map : labelTypeItems) {
-                labelMap.put(map.get(Constants.ITEM_VALUE), map.get(Constants.ITEM_LABEL));
-            }
-        }
-        request.setAttribute(Constants.LABEL_VALUE_MAP, labelMap);
-
-        if (viewHelper.isUseSession()) {
-            final HttpSession session = request.getSession(false);
-            if (session != null) {
-                final Object resultsPerPage = session.getAttribute(Constants.RESULTS_PER_PAGE);
-                if (resultsPerPage != null) {
-                    indexForm.num = resultsPerPage.toString();
-                }
-            }
-        }
-
-        Locale locale = request.getLocale();
-        if (locale == null) {
-            locale = Locale.ENGLISH;
-        }
-        langItems = systemHelper.getLanguageItems(locale);
-
-        final HttpSession session = request.getSession(false);
-        if (session != null) {
-            final Object obj = session.getAttribute(SSCConstants.USER_INFO);
-            if (obj instanceof LoginInfo) {
-                final LoginInfo loginInfo = (LoginInfo) obj;
-                username = loginInfo.getUsername();
-            }
-        }
-
-    }
-
-    protected void buildInitParams() {
-        buildInitParamMap(viewHelper.getInitFacetParamMap(), Constants.FACET_QUERY, Constants.FACET_FORM);
-        buildInitParamMap(viewHelper.getInitGeoParamMap(), Constants.GEO_QUERY, Constants.GEO_FORM);
-    }
-
-    protected void buildInitParamMap(final Map<String, String> paramMap, final String queryKey, final String formKey) {
-        if (!paramMap.isEmpty()) {
-            final StringBuilder queryBuf = new StringBuilder(100);
-            final StringBuilder formBuf = new StringBuilder(100);
-            for (final Map.Entry<String, String> entry : paramMap.entrySet()) {
-                queryBuf.append('&');
-                queryBuf.append(URLEncoderUtil.encode(entry.getValue()));
-                queryBuf.append('=');
-                queryBuf.append(URLEncoderUtil.encode(entry.getKey()));
-                formBuf.append("<input type=\"hidden\" name=\"");
-                formBuf.append(StringEscapeUtils.escapeHtml(entry.getValue()));
-                formBuf.append("\" value=\"");
-                formBuf.append(StringEscapeUtils.escapeHtml(entry.getKey()));
-                formBuf.append("\"/>");
-            }
-            request.setAttribute(queryKey, queryBuf.toString());
-            request.setAttribute(formKey, formBuf.toString());
-        }
-    }
-
-    protected void normalizePageNum() {
-        try {
-            final int num = Integer.parseInt(indexForm.num);
-            if (num > getMaxPageSize()) {
-                // max page size
-                indexForm.num = String.valueOf(getMaxPageSize());
-            } else if (num <= 0) {
-                indexForm.num = String.valueOf(getDefaultPageSize());
-            }
-        } catch (final NumberFormatException e) {
-            indexForm.num = String.valueOf(getDefaultPageSize());
-        }
-    }
-
-    protected int getDefaultPageSize() {
-        return DEFAULT_PAGE_SIZE;
-    }
-
-    protected int getMaxPageSize() {
-        final Object maxPageSize = crawlerProperties.get(Constants.SEARCH_RESULT_MAX_PAGE_SIZE);
-        if (maxPageSize == null) {
-            return MAX_PAGE_SIZE;
-        }
-        try {
-            return Integer.parseInt(maxPageSize.toString());
-        } catch (final NumberFormatException e) {
-            return MAX_PAGE_SIZE;
-        }
-    }
-
-    public boolean isOsddLink() {
-        return openSearchHelper.hasOpenSearchFile();
-    }
-
-    public String getHelpPage() {
-        return viewHelper.getPagePath("common/help");
-    }
-
-    protected boolean hasFieldInQuery(final Set<String> fieldSet, final String query) {
-        final Matcher matcher = FIELD_EXTRACTION_PATTERN.matcher(query);
-        if (matcher.matches()) {
-            final String field = matcher.replaceFirst("$1");
-            if (fieldSet.contains(field)) {
-                return true;
-            }
-            fieldSet.add(field);
-        }
-        return false;
-    }
-
-    protected String getImageMimeType(final File imageFile) {
-        final String path = imageFile.getAbsolutePath();
-        if (path.endsWith(".png")) {
-            return "image/png";
-        } else if (path.endsWith(".gif")) {
-            return "image/gif";
-        } else if (path.endsWith(".jpg") || path.endsWith(".jpeg")) {
-            return "image/jpeg";
-        } else {
-            return "application/octet-stream";
-        }
-    }
-
-}

+ 1 - 1
src/main/java/org/codelibs/fess/app/web/RootAction.java

@@ -115,7 +115,7 @@ public class RootAction {
 
 
     //@ActionForm
     //@ActionForm
     @Resource
     @Resource
-    protected IndexForm indexForm;
+    protected RootForm indexForm;
 
 
     @Resource
     @Resource
     protected FessEsClient fessEsClient;
     protected FessEsClient fessEsClient;

+ 1 - 1
src/main/java/org/codelibs/fess/app/web/IndexForm.java → src/main/java/org/codelibs/fess/app/web/RootForm.java

@@ -22,7 +22,7 @@ import org.codelibs.fess.entity.FacetInfo;
 import org.codelibs.fess.entity.GeoInfo;
 import org.codelibs.fess.entity.GeoInfo;
 import org.codelibs.fess.util.SearchParamMap;
 import org.codelibs.fess.util.SearchParamMap;
 
 
-public class IndexForm implements Serializable {
+public class RootForm implements Serializable {
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 

+ 326 - 0
src/main/java/org/codelibs/fess/app/web/admin/AdminDesignAction.java

@@ -0,0 +1,326 @@
+/*
+ * Copyright 2009-2015 the 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.admin;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletContext;
+
+import org.apache.commons.io.FileUtils;
+import org.codelibs.core.io.FileUtil;
+import org.codelibs.core.lang.StringUtil;
+import org.codelibs.core.misc.DynamicProperties;
+import org.codelibs.fess.Constants;
+import org.codelibs.fess.FessSystemException;
+import org.codelibs.fess.annotation.Token;
+import org.codelibs.fess.app.web.base.FessAdminAction;
+import org.codelibs.fess.crud.util.SAStrutsUtil;
+import org.codelibs.fess.helper.SystemHelper;
+import org.lastaflute.di.util.LdiFileUtil;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.callback.ActionRuntime;
+import org.lastaflute.web.response.ActionResponse;
+import org.lastaflute.web.response.HtmlResponse;
+import org.lastaflute.web.response.StreamResponse;
+import org.lastaflute.web.servlet.request.ResponseManager;
+import org.lastaflute.web.util.LaServletContextUtil;
+import org.lastaflute.web.validation.VaErrorHook;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author codelibs
+ * @author jflute
+ */
+public class AdminDesignAction extends FessAdminAction implements Serializable {
+    
+    private static final long serialVersionUID = 1L;
+
+    private static final Logger logger = LoggerFactory.getLogger(AdminDesignAction.class);
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    private ResponseManager responseManager;
+    @Resource
+    private DynamicProperties crawlerProperties;
+    @Resource
+    private SystemHelper systemHelper;
+
+    // ===================================================================================
+    //                                                                             Execute
+    //                                                                             =======
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse index() {
+        return asHtml(path_AdminDesign_AdminDesignJsp).useForm(AdminDesignForm.class);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse back() {
+        return asHtml(path_AdminDesign_AdminDesignJsp).useForm(AdminDesignForm.class);
+    }
+
+    @Execute
+    public HtmlResponse upload(AdminDesignForm form) {
+        validate(form, messages -> {}, toMainHtml());
+        final String uploadedFileName = form.designFile.getFileName();
+        String fileName = form.designFileName;
+        if (StringUtil.isBlank(fileName)) {
+            fileName = uploadedFileName;
+            try {
+                int pos = fileName.indexOf('/');
+                if (pos >= 0) {
+                    fileName = fileName.substring(pos + 1);
+                }
+                pos = fileName.indexOf('\\');
+                if (pos >= 0) {
+                    fileName = fileName.substring(pos + 1);
+                }
+            } catch (final Exception e) {
+                throwValidationError(messages -> messages.addErrorsDesignFileNameIsInvalid(GLOBAL), toMainHtml());
+            }
+        }
+        if (StringUtil.isBlank(fileName)) {
+            throwValidationError(messages -> messages.addErrorsDesignFileNameIsNotFound(GLOBAL), toMainHtml());
+        }
+
+        String baseDir = null;
+        // normalize filename
+        if (checkFileType(fileName, systemHelper.getSupportedUploadedMediaExtentions())
+                && checkFileType(uploadedFileName, systemHelper.getSupportedUploadedMediaExtentions())) {
+            baseDir = "/images/";
+        } else if (checkFileType(fileName, systemHelper.getSupportedUploadedCssExtentions())
+                && checkFileType(uploadedFileName, systemHelper.getSupportedUploadedCssExtentions())) {
+            baseDir = "/css/";
+        } else if (checkFileType(fileName, systemHelper.getSupportedUploadedJSExtentions())
+                && checkFileType(uploadedFileName, systemHelper.getSupportedUploadedJSExtentions())) {
+            baseDir = "/js/";
+        } else {
+            throwValidationError(messages -> messages.addErrorsDesignFileIsUnsupportedType(GLOBAL), toMainHtml());
+        }
+
+        final File uploadFile = new File(getServletContext().getRealPath(baseDir + fileName));
+        final File parentFile = uploadFile.getParentFile();
+        if (!parentFile.exists() && !parentFile.mkdirs()) {
+            logger.warn("Could not create " + parentFile.getAbsolutePath());
+        }
+
+        try {
+            LdiFileUtil.write(uploadFile.getAbsolutePath(), form.designFile.getFileData());
+            SAStrutsUtil.addSessionMessage("success.upload_design_file", fileName);
+        } catch (final Exception e) {
+            logger.error("Failed to write an image file: {}", fileName, e);
+            throwValidationError(messages -> messages.addErrorsFailedToWriteDesignImageFile(GLOBAL), toMainHtml());
+        }
+        return redirect(getClass());
+    }
+
+    private boolean checkFileType(final String fileName, final String[] exts) {
+        if (fileName == null) {
+            return false;
+        }
+        final String lFileName = fileName.toLowerCase(Locale.ENGLISH);
+        for (final String ext : exts) {
+            if (lFileName.endsWith("." + ext)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse edit(AdminDesignForm form) {
+        final String jspType = "view";
+        final File jspFile = getJspFile(form, jspType);
+        try {
+            form.content = new String(FileUtil.readBytes(jspFile), Constants.UTF_8);
+        } catch (final UnsupportedEncodingException e) {
+            throw new FessSystemException("Invalid encoding", e);
+        }
+        return asHtml(path_AdminDesign_AdminDesignEditJsp);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editAsUseDefault(AdminDesignForm form) {
+        final String jspType = "orig/view";
+        final File jspFile = getJspFile(form, jspType);
+        try {
+            form.content = new String(FileUtil.readBytes(jspFile), Constants.UTF_8);
+        } catch (final UnsupportedEncodingException e) {
+            throw new FessSystemException("Invalid encoding", e);
+        }
+        return asHtml(path_AdminDesign_AdminDesignEditJsp);
+    }
+
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse update(AdminDesignForm form) {
+        final String jspType = "view";
+        final File jspFile = getJspFile(form, jspType);
+
+        if (form.content == null) {
+            form.content = StringUtil.EMPTY;
+        }
+
+        try {
+            LdiFileUtil.write(jspFile.getAbsolutePath(), form.content.getBytes(Constants.UTF_8));
+            SAStrutsUtil.addSessionMessage("success.update_design_jsp_file", systemHelper.getDesignJspFileName(form.fileName));
+        } catch (final Exception e) {
+            logger.error("Failed to update {}", form.fileName, e);
+            throwValidationError(messages -> messages.addErrorsFailedToUpdateJspFile(GLOBAL), toMainHtml());
+        }
+        return redirect(getClass());
+    }
+
+    @Execute
+    public StreamResponse download(AdminDesignForm form) {
+        final File file = getTargetFile(form);
+        if (file == null) {
+            throwValidationError(messages -> messages.addErrorsTargetFileDoesNotExist(GLOBAL, form.fileName), toMainHtml());
+        }
+        FileInputStream fis = null;
+        try {
+            fis = new FileInputStream(file);
+        } catch (final FileNotFoundException e) {
+            logger.error("Not found the file: {}", file.getAbsolutePath(), e);
+            throwValidationError(messages -> messages.addErrorsFailedToDownloadFile(GLOBAL, form.fileName), toMainHtml());
+        }
+        return asStream(file.getName()).stream(fis);
+    }
+
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse delete(AdminDesignForm form) {
+        final File file = getTargetFile(form);
+        if (file == null) {
+            throwValidationError(messages -> messages.addErrorsTargetFileDoesNotExist(GLOBAL, form.fileName), toMainHtml());
+        }
+        if (!file.delete()) {
+            logger.error("Failed to delete {}", file.getAbsolutePath());
+            throwValidationError(messages -> messages.addErrorsFailedToDeleteFile(GLOBAL, form.fileName), toMainHtml());
+        }
+        SAStrutsUtil.addSessionMessage("success.delete_file", form.fileName);
+        return redirect(getClass());
+    }
+
+    // ===================================================================================
+    //                                                                               Hook
+    //                                                                              ======
+    @Override
+    public ActionResponse hookBefore(ActionRuntime runtime) {
+        checkEditorStatus(runtime);
+        return super.hookBefore(runtime);
+    }
+
+    private void checkEditorStatus(ActionRuntime runtime) {
+        if (cannotEdit()) {
+            throwValidationError(messages -> messages.addErrorsDesignEditorDisabled(GLOBAL), toMainHtml());
+        }
+    }
+
+    @Override
+    public void hookFinally(ActionRuntime runtime) {
+        super.hookFinally(runtime);
+        if (runtime.isForwardToHtml()) {
+            runtime.registerData("fileNameItems", loadFileNameItems());
+            runtime.registerData("editable", cannotEdit());
+        }
+    }
+
+    private List<String> loadFileNameItems() {
+        final File baseDir = new File(getServletContext().getRealPath("/"));
+        final List<String> fileNameItems = new ArrayList<String>();
+        final List<File> fileList = getAccessibleFileList(baseDir);
+        final int length = baseDir.getAbsolutePath().length();
+        for (final File file : fileList) {
+            fileNameItems.add(file.getAbsolutePath().substring(length));
+        }
+        return fileNameItems;
+    }
+
+    // ===================================================================================
+    //                                                                        Assist Logic
+    //                                                                        ============
+    private File getTargetFile(AdminDesignForm form) {
+        final File baseDir = new File(getServletContext().getRealPath("/"));
+        final File targetFile = new File(getServletContext().getRealPath(form.fileName));
+        final List<File> fileList = getAccessibleFileList(baseDir);
+        boolean exist = false;
+        for (final File file : fileList) {
+            if (targetFile.equals(file)) {
+                exist = true;
+                break;
+            }
+        }
+        if (exist) {
+            return targetFile;
+        }
+        return null;
+    }
+
+    private List<File> getAccessibleFileList(final File baseDir) {
+        final List<File> fileList = new ArrayList<File>();
+        fileList.addAll(FileUtils.listFiles(new File(baseDir, "images"), systemHelper.getSupportedUploadedMediaExtentions(), true));
+        fileList.addAll(FileUtils.listFiles(new File(baseDir, "css"), systemHelper.getSupportedUploadedCssExtentions(), true));
+        fileList.addAll(FileUtils.listFiles(new File(baseDir, "js"), systemHelper.getSupportedUploadedJSExtentions(), true));
+        return fileList;
+    }
+
+    private File getJspFile(final AdminDesignForm form, final String jspType) {
+        final String jspFileName = systemHelper.getDesignJspFileName(form.fileName);
+        if (jspFileName == null) {
+            throwValidationError(messages -> messages.addErrorsInvalidDesignJspFileName(GLOBAL), toMainHtml());
+        }
+        final File jspFile = new File(getServletContext().getRealPath("/WEB-INF/" + jspType + "/" + jspFileName));
+        if (jspFile == null || !jspFile.exists()) {
+            throwValidationError(messages -> messages.addErrorsDesignJspFileDoesNotExist(GLOBAL), toMainHtml());
+        }
+        return jspFile;
+    }
+
+    private VaErrorHook toMainHtml() {
+        return () -> {
+            return asHtml(path_AdminDesign_AdminDesignJsp);
+        };
+    }
+    
+    private boolean cannotEdit() {
+        return Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_DESIGN_EDITOR_PROPERTY, Constants.TRUE));
+    }
+
+    private ServletContext getServletContext() {
+        return LaServletContextUtil.getServletContext();
+    }
+
+    // TODO fess needed? public? by jflute (2015/07/25)
+    public String getHelpLink() {
+        return systemHelper.getHelpLink("design");
+    }
+}

+ 5 - 2
src/main/java/org/codelibs/fess/app/web/admin/DesignForm.java → src/main/java/org/codelibs/fess/app/web/admin/AdminDesignForm.java

@@ -18,15 +18,18 @@ package org.codelibs.fess.app.web.admin;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 
 
-public class DesignForm implements Serializable {
+import org.lastaflute.web.ruts.multipart.MultipartFormFile;
+
+public class AdminDesignForm implements Serializable {
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
     //@Required(target = "upload")
     //@Required(target = "upload")
-    //public FormFile designFile;
+    public MultipartFormFile designFile;
 
 
     public String designFileName;
     public String designFileName;
 
 
+    // TODO jflute unneeded? no validator at the method (2015/07/25)
     //@Required(target = "edit,editAsUseDefault,download,delete")
     //@Required(target = "edit,editAsUseDefault,download,delete")
     public String fileName;
     public String fileName;
 
 

+ 0 - 301
src/main/java/org/codelibs/fess/app/web/admin/DesignAction.java

@@ -1,301 +0,0 @@
-/*
- * Copyright 2009-2015 the 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.admin;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.codelibs.core.io.FileUtil;
-import org.codelibs.core.lang.StringUtil;
-import org.codelibs.core.misc.DynamicProperties;
-import org.codelibs.fess.Constants;
-import org.codelibs.fess.FessSystemException;
-import org.codelibs.fess.annotation.Token;
-import org.codelibs.fess.crud.util.SAStrutsUtil;
-import org.codelibs.fess.exception.SSCActionMessagesException;
-import org.codelibs.fess.helper.SystemHelper;
-import org.lastaflute.web.util.LaResponseUtil;
-import org.lastaflute.web.util.LaServletContextUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DesignAction implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    private static final Logger logger = LoggerFactory.getLogger(DesignAction.class);
-
-    //@ActionForm
-    @Resource
-    protected DesignForm designForm;
-
-    @Resource
-    protected DynamicProperties crawlerProperties;
-
-    public boolean editable = true;
-
-    @Resource
-    protected SystemHelper systemHelper;
-
-    public List<String> fileNameItems;
-
-    public String getHelpLink() {
-        return systemHelper.getHelpLink("design");
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "index")
-    public String index() {
-        checkEditorStatus();
-        loadFileNameItems();
-        return "index.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false)
-    public String back() {
-        checkEditorStatus();
-        loadFileNameItems();
-        return "index.jsp";
-    }
-
-    private boolean checkFileType(final String fileName, final String[] exts) {
-        if (fileName == null) {
-            return false;
-        }
-        final String lFileName = fileName.toLowerCase(Locale.ENGLISH);
-        for (final String ext : exts) {
-            if (lFileName.endsWith("." + ext)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    //@Execute(validator = true, input = "index")
-    public String upload() {
-        checkEditorStatus();
-        final String uploadedFileName = designForm.designFile.getFileName();
-        String fileName = designForm.designFileName;
-        if (StringUtil.isBlank(fileName)) {
-            fileName = uploadedFileName;
-            try {
-                int pos = fileName.indexOf('/');
-                if (pos >= 0) {
-                    fileName = fileName.substring(pos + 1);
-                }
-                pos = fileName.indexOf('\\');
-                if (pos >= 0) {
-                    fileName = fileName.substring(pos + 1);
-                }
-            } catch (final Exception e) {
-                throw new SSCActionMessagesException(e, "errors.design_file_name_is_invalid");
-            }
-        }
-        if (StringUtil.isBlank(fileName)) {
-            throw new SSCActionMessagesException("errors.design_file_name_is_not_found");
-        }
-
-        String baseDir = null;
-        // normalize filename
-        if (checkFileType(fileName, systemHelper.getSupportedUploadedMediaExtentions())
-                && checkFileType(uploadedFileName, systemHelper.getSupportedUploadedMediaExtentions())) {
-            baseDir = "/images/";
-        } else if (checkFileType(fileName, systemHelper.getSupportedUploadedCssExtentions())
-                && checkFileType(uploadedFileName, systemHelper.getSupportedUploadedCssExtentions())) {
-            baseDir = "/css/";
-        } else if (checkFileType(fileName, systemHelper.getSupportedUploadedJSExtentions())
-                && checkFileType(uploadedFileName, systemHelper.getSupportedUploadedJSExtentions())) {
-            baseDir = "/js/";
-        } else {
-            throw new SSCActionMessagesException("errors.design_file_is_unsupported_type");
-        }
-
-        final File uploadFile = new File(LaServletContextUtil.getServletContext().getRealPath(baseDir + fileName));
-        final File parentFile = uploadFile.getParentFile();
-        if (!parentFile.exists() && !parentFile.mkdirs()) {
-            logger.warn("Could not create " + parentFile.getAbsolutePath());
-        }
-
-        try {
-            FileUtil.write(uploadFile.getAbsolutePath(), designForm.designFile.getFileData());
-            SAStrutsUtil.addSessionMessage("success.upload_design_file", fileName);
-            return "index?redirect=true";
-        } catch (final Exception e) {
-            logger.error("Failed to write an image file.", e);
-            throw new SSCActionMessagesException(e, "errors.failed_to_write_design_image_file");
-        }
-
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "index")
-    public String edit() {
-        checkEditorStatus();
-        final String jspType = "view";
-        final File jspFile = getJspFile(jspType);
-
-        try {
-            designForm.content = new String(FileUtil.readBytes(jspFile), Constants.UTF_8);
-        } catch (final UnsupportedEncodingException e) {
-            throw new FessSystemException("Invalid encoding", e);
-        }
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "index")
-    public String editAsUseDefault() {
-        checkEditorStatus();
-        final String jspType = "orig/view";
-        final File jspFile = getJspFile(jspType);
-
-        try {
-            designForm.content = new String(FileUtil.readBytes(jspFile), Constants.UTF_8);
-        } catch (final UnsupportedEncodingException e) {
-            throw new FessSystemException("Invalid encoding", e);
-        }
-
-        return "edit.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    //@Execute(validator = false, input = "index")
-    public String update() {
-        checkEditorStatus();
-        final String jspType = "view";
-        final File jspFile = getJspFile(jspType);
-
-        if (designForm.content == null) {
-            designForm.content = StringUtil.EMPTY;
-        }
-
-        try {
-            FileUtil.write(jspFile.getAbsolutePath(), designForm.content.getBytes(Constants.UTF_8));
-            SAStrutsUtil.addSessionMessage("success.update_design_jsp_file", systemHelper.getDesignJspFileName(designForm.fileName));
-            return "index?redirect=true";
-        } catch (final Exception e) {
-            logger.error("Failed to update " + designForm.fileName, e);
-            throw new SSCActionMessagesException(e, "errors.failed_to_update_jsp_file");
-        }
-    }
-
-    //@Execute(validator = false, input = "index")
-    public String download() {
-        checkEditorStatus();
-
-        final File file = getTargetFile();
-        if (file == null) {
-            throw new SSCActionMessagesException("errors.target_file_does_not_exist", designForm.fileName);
-        }
-
-        BufferedInputStream bis = null;
-        try {
-            bis = new BufferedInputStream(new FileInputStream(file));
-            LaResponseUtil.download(file.getName(), bis);
-        } catch (final Exception e) {
-            logger.error("Failed to download " + file.getAbsolutePath(), e);
-            throw new SSCActionMessagesException(e, "errors.failed_to_download_file", designForm.fileName);
-        } finally {
-            IOUtils.closeQuietly(bis);
-        }
-        return null;
-    }
-
-    @Token(save = false, validate = true)
-    //@Execute(validator = false, input = "index")
-    public String delete() {
-        checkEditorStatus();
-
-        final File file = getTargetFile();
-        if (file == null) {
-            throw new SSCActionMessagesException("errors.target_file_does_not_exist", designForm.fileName);
-        }
-
-        if (file.delete()) {
-            SAStrutsUtil.addSessionMessage("success.delete_file", designForm.fileName);
-            return "index?redirect=true";
-        } else {
-            logger.error("Failed to delete " + file.getAbsolutePath());
-            throw new SSCActionMessagesException("errors.failed_to_delete_file", designForm.fileName);
-        }
-    }
-
-    private File getJspFile(final String jspType) {
-        final String jspFileName = systemHelper.getDesignJspFileName(designForm.fileName);
-        if (jspFileName == null) {
-            throw new SSCActionMessagesException("errors.invalid_design_jsp_file_name");
-        }
-        final File jspFile = new File(ServletContextUtil.getServletContext().getRealPath("/WEB-INF/" + jspType + "/" + jspFileName));
-        if (jspFile == null || !jspFile.exists()) {
-            throw new SSCActionMessagesException("errors.design_jsp_file_does_not_exist");
-        }
-        return jspFile;
-    }
-
-    private void checkEditorStatus() {
-        if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_DESIGN_EDITOR_PROPERTY, Constants.TRUE))) {
-            editable = false;
-            throw new SSCActionMessagesException("errors.design_editor_disabled");
-        }
-    }
-
-    private void loadFileNameItems() {
-        final File baseDir = new File(LaServletContextUtil.getServletContext().getRealPath("/"));
-        fileNameItems = new ArrayList<String>();
-        final List<File> fileList = getAccessibleFileList(baseDir);
-        final int length = baseDir.getAbsolutePath().length();
-        for (final File file : fileList) {
-            fileNameItems.add(file.getAbsolutePath().substring(length));
-        }
-    }
-
-    private List<File> getAccessibleFileList(final File baseDir) {
-        final List<File> fileList = new ArrayList<File>();
-        fileList.addAll(FileUtils.listFiles(new File(baseDir, "images"), systemHelper.getSupportedUploadedMediaExtentions(), true));
-        fileList.addAll(FileUtils.listFiles(new File(baseDir, "css"), systemHelper.getSupportedUploadedCssExtentions(), true));
-        fileList.addAll(FileUtils.listFiles(new File(baseDir, "js"), systemHelper.getSupportedUploadedJSExtentions(), true));
-        return fileList;
-    }
-
-    private File getTargetFile() {
-        final File baseDir = new File(LaServletContextUtil.getServletContext().getRealPath("/"));
-        final File targetFile = new File(LaServletContextUtil.getServletContext().getRealPath(designForm.fileName));
-        final List<File> fileList = getAccessibleFileList(baseDir);
-        boolean exist = false;
-        for (final File file : fileList) {
-            if (targetFile.equals(file)) {
-                exist = true;
-                break;
-            }
-        }
-        if (exist) {
-            return targetFile;
-        }
-        return null;
-    }
-}

+ 4 - 4
src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java

@@ -47,11 +47,11 @@ public interface FessHtmlPath {
     /** The path of the HTML: /admin/dataConfig/index.jsp */
     /** The path of the HTML: /admin/dataConfig/index.jsp */
     HtmlNext path_AdminDataConfig_IndexJsp = new HtmlNext("/admin/dataConfig/index.jsp");
     HtmlNext path_AdminDataConfig_IndexJsp = new HtmlNext("/admin/dataConfig/index.jsp");
 
 
-    /** The path of the HTML: /admin/design/edit.jsp */
-    HtmlNext path_AdminDesign_EditJsp = new HtmlNext("/admin/design/edit.jsp");
+    /** The path of the HTML: /admin/design/admin_design.jsp */
+    HtmlNext path_AdminDesign_AdminDesignJsp = new HtmlNext("/admin/design/admin_design.jsp");
 
 
-    /** The path of the HTML: /admin/design/index.jsp */
-    HtmlNext path_AdminDesign_IndexJsp = new HtmlNext("/admin/design/index.jsp");
+    /** The path of the HTML: /admin/design/admin_design_edit.jsp */
+    HtmlNext path_AdminDesign_AdminDesignEditJsp = new HtmlNext("/admin/design/admin_design_edit.jsp");
 
 
     /** The path of the HTML: /admin/dict/error.jsp */
     /** The path of the HTML: /admin/dict/error.jsp */
     HtmlNext path_AdminDict_ErrorJsp = new HtmlNext("/admin/dict/error.jsp");
     HtmlNext path_AdminDict_ErrorJsp = new HtmlNext("/admin/dict/error.jsp");

+ 2 - 4
src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java

@@ -2490,8 +2490,7 @@ public class FessLabels extends ActionMessages {
     public static final String LABELS_system_info_bug_report_title = "{labels.system_info_bug_report_title}";
     public static final String LABELS_system_info_bug_report_title = "{labels.system_info_bug_report_title}";
 
 
     /** The key of the message: crawler.properties does not exist. Default values are applied. */
     /** The key of the message: crawler.properties does not exist. Default values are applied. */
-    public static final String LABELS_system_info_crawler_properties_does_not_exist =
-            "{labels.system_info_crawler_properties_does_not_exist}";
+    public static final String LABELS_system_info_crawler_properties_does_not_exist = "{labels.system_info_crawler_properties_does_not_exist}";
 
 
     /** The key of the message: File Authentication */
     /** The key of the message: File Authentication */
     public static final String LABELS_file_authentication_configuration = "{labels.file_authentication_configuration}";
     public static final String LABELS_file_authentication_configuration = "{labels.file_authentication_configuration}";
@@ -2530,8 +2529,7 @@ public class FessLabels extends ActionMessages {
     public static final String LABELS_file_authentication_list_hostname = "{labels.file_authentication_list_hostname}";
     public static final String LABELS_file_authentication_list_hostname = "{labels.file_authentication_list_hostname}";
 
 
     /** The key of the message: Config Name */
     /** The key of the message: Config Name */
-    public static final String LABELS_file_authentication_list_file_crawling_config =
-            "{labels.file_authentication_list_file_crawling_config}";
+    public static final String LABELS_file_authentication_list_file_crawling_config = "{labels.file_authentication_list_file_crawling_config}";
 
 
     /** The key of the message: Any */
     /** The key of the message: Any */
     public static final String LABELS_file_authentication_any = "{labels.file_authentication_any}";
     public static final String LABELS_file_authentication_any = "{labels.file_authentication_any}";

+ 2 - 2
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java

@@ -1,5 +1,6 @@
 package org.codelibs.fess.mylasta.action;
 package org.codelibs.fess.mylasta.action;
 
 
+import org.codelibs.fess.mylasta.action.FessLabels;
 import org.lastaflute.web.ruts.message.ActionMessage;
 import org.lastaflute.web.ruts.message.ActionMessage;
 
 
 /**
 /**
@@ -123,8 +124,7 @@ public class FessMessages extends FessLabels {
     public static final String ERRORS_failed_to_delete_solr_index = "{errors.failed_to_delete_solr_index}";
     public static final String ERRORS_failed_to_delete_solr_index = "{errors.failed_to_delete_solr_index}";
 
 
     /** The key of the message: Failed to start a process because of running solr process. */
     /** The key of the message: Failed to start a process because of running solr process. */
-    public static final String ERRORS_failed_to_start_solr_process_because_of_running =
-            "{errors.failed_to_start_solr_process_because_of_running}";
+    public static final String ERRORS_failed_to_start_solr_process_because_of_running = "{errors.failed_to_start_solr_process_because_of_running}";
 
 
     /** The key of the message: Failed to restore data. */
     /** The key of the message: Failed to restore data. */
     public static final String ERRORS_failed_to_import_data = "{errors.failed_to_import_data}";
     public static final String ERRORS_failed_to_import_data = "{errors.failed_to_import_data}";

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

@@ -1,5 +1,6 @@
 package org.codelibs.fess.mylasta.direction;
 package org.codelibs.fess.mylasta.direction;
 
 
+import org.codelibs.fess.mylasta.direction.FessEnv;
 import org.lastaflute.core.direction.exception.ConfigPropertyNotFoundException;
 import org.lastaflute.core.direction.exception.ConfigPropertyNotFoundException;
 
 
 /**
 /**

+ 2 - 2
src/main/java/org/codelibs/fess/mylasta/direction/FessEnv.java

@@ -102,7 +102,7 @@ public interface FessEnv {
     /**
     /**
      * Get the value for the key 'time.adjust.time.millis'. <br>
      * Get the value for the key 'time.adjust.time.millis'. <br>
      * The value is, e.g. 0 <br>
      * The value is, e.g. 0 <br>
-     * comment: The milliseconds for (relative or absolute) adjust time (set only when test) //@LongType *dynamic in development
+     * comment: The milliseconds for (relative or absolute) adjust time (set only when test) @LongType *dynamic in development
      * @return The value of found property. (NotNull: if not found, exception but basically no way)
      * @return The value of found property. (NotNull: if not found, exception but basically no way)
      */
      */
     String getTimeAdjustTimeMillis();
     String getTimeAdjustTimeMillis();
@@ -110,7 +110,7 @@ public interface FessEnv {
     /**
     /**
      * Get the value for the key 'time.adjust.time.millis' as {@link Long}. <br>
      * Get the value for the key 'time.adjust.time.millis' as {@link Long}. <br>
      * The value is, e.g. 0 <br>
      * The value is, e.g. 0 <br>
-     * comment: The milliseconds for (relative or absolute) adjust time (set only when test) //@LongType *dynamic in development
+     * comment: The milliseconds for (relative or absolute) adjust time (set only when test) @LongType *dynamic in development
      * @return The value of found property. (NotNull: if not found, exception but basically no way)
      * @return The value of found property. (NotNull: if not found, exception but basically no way)
      * @throws NumberFormatException When the property is not long.
      * @throws NumberFormatException When the property is not long.
      */
      */

+ 3 - 3
src/main/java/org/codelibs/fess/servlet/Tomcat7ConfigServlet.java

@@ -24,6 +24,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 
 
 public class Tomcat7ConfigServlet extends HttpServlet {
 public class Tomcat7ConfigServlet extends HttpServlet {
+
     private static final Logger logger = LoggerFactory.getLogger(Tomcat7ConfigServlet.class);
     private static final Logger logger = LoggerFactory.getLogger(Tomcat7ConfigServlet.class);
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
@@ -39,13 +40,12 @@ public class Tomcat7ConfigServlet extends HttpServlet {
     private void shutdownCommonsHttpClient() {
     private void shutdownCommonsHttpClient() {
         try {
         try {
             final Class<?> clazz = Class.forName("org.apache.commons.httpclient.MultiThreadedHttpConnectionManager");
             final Class<?> clazz = Class.forName("org.apache.commons.httpclient.MultiThreadedHttpConnectionManager");
-            final Method method = clazz.getMethod("shutdownAll", null);
-            method.invoke(null, null);
+            final Method method = clazz.getMethod("shutdownAll", (Class<?>[]) null);
+            method.invoke(null, (Object[]) null);
         } catch (final ClassNotFoundException e) {
         } catch (final ClassNotFoundException e) {
             // ignore
             // ignore
         } catch (final Exception e) {
         } catch (final Exception e) {
             logger.warn("Could not shutdown Commons HttpClient.", e);
             logger.warn("Could not shutdown Commons HttpClient.", e);
         }
         }
     }
     }
-
 }
 }

+ 1 - 0
src/main/resources/my_creator.xml

@@ -2,5 +2,6 @@
 <!DOCTYPE components PUBLIC "-//DBFLUTE//DTD LastaDi 1.0//EN"
 <!DOCTYPE components PUBLIC "-//DBFLUTE//DTD LastaDi 1.0//EN"
 	"http://dbflute.org/meta/lastadi10.dtd">
 	"http://dbflute.org/meta/lastadi10.dtd">
 <components>
 <components>
+	<include path="convention.xml"/>
     <component name="pagerCreator" class="org.codelibs.fess.crud.creator.PagerCreator"/>
     <component name="pagerCreator" class="org.codelibs.fess.crud.creator.PagerCreator"/>
 </components>
 </components>

+ 0 - 55
src/main/webapp/WEB-INF/struts-config.xml

@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE struts-config PUBLIC
-          "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
-          "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
-
-<struts-config>
-
-<!-- ======================================== Form Bean Definitions -->
-
-    <form-beans>
-    </form-beans>
-
-<!-- ================================= Global Exception Definitions -->
-
-    <global-exceptions>
-    </global-exceptions>
-
-<!-- =================================== Global Forward Definitions -->
-
-    <global-forwards>
-    </global-forwards>
-
-<!-- =================================== Action Mapping Definitions -->
-
-    <action-mappings>
-    </action-mappings>
-    
-
-<!-- ===================================== Controller Configuration -->
-
-    <controller
-        maxFileSize="10M"
-        bufferSize="1024"
-        processorClass="org.codelibs.fess.struts.action.FessRequestProcessor"
-        multipartClass="org.dbflute.saflute.web.action.processor.ActionMultipartRequestHandler"/>
-
-<!-- ================================ Message Resources Definitions -->
-
-    <message-resources parameter="application"
-        factory="org.seasar.struts.util.S2PropertyMessageResourcesFactory">
-        <!-- 
-        factory="org.dbflute.saflute.web.action.message.PropertiesMessageResourcesFactory">
-         -->
-    </message-resources>
-
-<!-- ======================================= Plug Ins Configuration -->
-
-    <plug-in className="org.seasar.struts.validator.S2ValidatorPlugIn">
-        <set-property
-          property="pathnames"
-          value="/WEB-INF/validator-rules.xml"/>
-    </plug-in>
-</struts-config>
-

+ 0 - 0
src/main/webapp/WEB-INF/view/admin/design/index.jsp → src/main/webapp/WEB-INF/view/admin/design/admin_design.jsp


+ 0 - 0
src/main/webapp/WEB-INF/view/admin/design/edit.jsp → src/main/webapp/WEB-INF/view/admin/design/admin_design_edit.jsp


+ 2 - 6
src/main/webapp/WEB-INF/view/common/common.jsp

@@ -1,11 +1,7 @@
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%><%--
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%><%--
  --%><%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%><%--
  --%><%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%><%--
  --%><%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %><%--
  --%><%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %><%--
- --%><%@taglib prefix="html" uri="http://struts.codelibs.org/tags-html"%><%--
- --%><%@taglib prefix="bean" uri="http://struts.apache.org/tags-bean"%><%--
- --%><%@taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %><%--
- --%><%@taglib prefix="tiles" uri="http://jakarta.apache.org/struts/tags-tiles"%><%--
- --%><%@taglib prefix="s" uri="http://sastruts.seasar.org" %><%--
- --%><%@taglib prefix="f" uri="http://sastruts.seasar.org/functions" %><%--
+ --%><%@taglib prefix="la" uri="http://lastaflute.org/latags" %><%--
+ --%><%@taglib prefix="f" uri="http://lastaflute.org/functions" %><%--
  --%><%@taglib prefix="fe" uri="http://fess.codelibs.org/functions" %><%--
  --%><%@taglib prefix="fe" uri="http://fess.codelibs.org/functions" %><%--
  --%><c:set var="contextPath" value="${request.contextPath}"/>
  --%><c:set var="contextPath" value="${request.contextPath}"/>

+ 39 - 107
src/main/webapp/WEB-INF/web.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <?xml version="1.0"?>
 <!--
 <!--
- * Copyright 2004-2006 the Seasar Foundation and the Others.
+ * Copyright 2009-2015 the CodeLibs Project and the Others.
  *
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may not use this file except in compliance with the License.
@@ -14,17 +14,15 @@
  * either express or implied. See the License for the specific language
  * either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  * governing permissions and limitations under the License.
 -->
 -->
-<web-app
-    xmlns="http://java.sun.com/xml/ns/j2ee"
+<?xml version="1.0"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
-    version="2.4">
-
-  <context-param>
-    <param-name>sastruts.VIEW_PREFIX</param-name>
-    <param-value>/WEB-INF/view</param-value>
-  </context-param>
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+    version="3.0">
 
 
+  <!-- ================================================================================= -->
+  <!--                                                                    Servlet Filter -->
+  <!--                                                                    ============== -->
   <filter>
   <filter>
     <filter-name>encodingfilter</filter-name>
     <filter-name>encodingfilter</filter-name>
     <filter-class>org.codelibs.fess.filter.FessEncodingFilter</filter-class>
     <filter-class>org.codelibs.fess.filter.FessEncodingFilter</filter-class>
@@ -38,16 +36,6 @@
     </init-param>
     </init-param>
   </filter>
   </filter>
 
 
-  <filter>
-    <filter-name>s2filter</filter-name>
-    <filter-class>org.seasar.framework.container.filter.S2ContainerFilter</filter-class>
-  </filter>
-
-  <filter>
-    <filter-name>hotdeployfilter</filter-name>
-    <filter-class>org.seasar.framework.container.hotdeploy.HotdeployFilter</filter-class>
-  </filter>
-
   <filter>
   <filter>
     <filter-name>authenticationFilter</filter-name>
     <filter-name>authenticationFilter</filter-name>
     <filter-class>org.codelibs.fess.filter.AdminAuthFilter</filter-class>
     <filter-class>org.codelibs.fess.filter.AdminAuthFilter</filter-class>
@@ -71,20 +59,8 @@
   </filter>
   </filter>
 
 
   <filter>
   <filter>
-    <filter-name>routingfilter</filter-name>
-    <filter-class>org.seasar.struts.filter.RoutingFilter</filter-class>
-    <!-- 
-    <filter-class>org.dbflute.saflute.web.servlet.filter.RequestRoutingFilter</filter-class>
-     -->
-    <init-param>
-      <param-name>jspDirectAccess</param-name>
-      <param-value>false</param-value>
-    </init-param>
-  </filter>
-
-  <filter>
-    <filter-name>requestLoggingFilter</filter-name>
-    <filter-class>org.dbflute.saflute.web.servlet.filter.RequestLoggingFilter</filter-class>
+    <filter-name>lastaFilter</filter-name>
+    <filter-class>org.lastaflute.web.LastaFilter</filter-class>
   </filter>
   </filter>
 
 
   <!--
   <!--
@@ -169,6 +145,9 @@
   </filter>
   </filter>
 -->
 -->
 
 
+  <!-- ================================================================================= -->
+  <!--                                                                    Filter Mapping -->
+  <!--                                                                    ============== -->
   <filter-mapping>
   <filter-mapping>
     <filter-name>encodingfilter</filter-name>
     <filter-name>encodingfilter</filter-name>
     <url-pattern>/*</url-pattern>
     <url-pattern>/*</url-pattern>
@@ -176,32 +155,6 @@
     <dispatcher>FORWARD</dispatcher>
     <dispatcher>FORWARD</dispatcher>
   </filter-mapping>
   </filter-mapping>
 
 
-  <filter-mapping>
-    <filter-name>s2filter</filter-name>
-    <url-pattern>/*</url-pattern>
-    <dispatcher>REQUEST</dispatcher>
-    <dispatcher>FORWARD</dispatcher>
-    <dispatcher>INCLUDE</dispatcher>
-  </filter-mapping>
-
-  <filter-mapping>
-    <filter-name>hotdeployfilter</filter-name>
-    <url-pattern>/*</url-pattern>
-    <dispatcher>REQUEST</dispatcher>
-    <dispatcher>FORWARD</dispatcher>
-    <dispatcher>INCLUDE</dispatcher>
-  </filter-mapping>
-
-  <!--
-   basically you should set original filters after Seasar's basic filters
-   because request and session might be filtered by the filters
-   (e.g. session attributes are wrapped in holder when hot-deploy)
-   -->
-  <filter-mapping>
-    <filter-name>requestLoggingFilter</filter-name>
-    <url-pattern>/*</url-pattern>
-  </filter-mapping>
-
   <filter-mapping>
   <filter-mapping>
     <filter-name>authenticationFilter</filter-name>
     <filter-name>authenticationFilter</filter-name>
     <url-pattern>/*</url-pattern>
     <url-pattern>/*</url-pattern>
@@ -214,9 +167,8 @@
   </filter-mapping>
   </filter-mapping>
 
 
   <filter-mapping>
   <filter-mapping>
-    <filter-name>routingfilter</filter-name>
+    <filter-name>lastaFilter</filter-name>
     <url-pattern>/*</url-pattern>
     <url-pattern>/*</url-pattern>
-    <dispatcher>REQUEST</dispatcher>
   </filter-mapping>
   </filter-mapping>
 
 
   <!--
   <!--
@@ -232,71 +184,46 @@
   </filter-mapping>
   </filter-mapping>
 -->
 -->
 
 
-  <servlet>
-    <servlet-name>action</servlet-name>
-    <servlet-class>org.codelibs.fess.struts.servlet.SSCActionServlet</servlet-class>
-    <init-param>
-      <param-name>config</param-name>
-      <param-value>/WEB-INF/struts-config.xml</param-value>
-    </init-param>
-    <init-param>
-      <param-name>configFactory</param-name>
-      <param-value>org.seasar.struts.config.S2ModuleConfigFactory</param-value>
-    </init-param>
-    <load-on-startup>1</load-on-startup>
-  </servlet>
-
-<!-- BEGIN: H2 -->
-  <servlet>
-    <servlet-name>h2ConfigServlet</servlet-name>
-    <servlet-class>org.codelibs.fess.servlet.H2ConfigServlet</servlet-class>
-    <init-param>
-      <param-name>tcpPort</param-name>
-      <param-value>19092</param-value>
-    </init-param>
-    <load-on-startup>2</load-on-startup>
-  </servlet>
- <!-- END: H2 -->
-
+  <!-- ================================================================================= -->
+  <!--                                                                           Servlet -->
+  <!--                                                                           ======= -->
   <servlet>
   <servlet>
     <servlet-name>tomcat7ConfigServlet</servlet-name>
     <servlet-name>tomcat7ConfigServlet</servlet-name>
     <servlet-class>org.codelibs.fess.servlet.Tomcat7ConfigServlet</servlet-class>
     <servlet-class>org.codelibs.fess.servlet.Tomcat7ConfigServlet</servlet-class>
-    <load-on-startup>3</load-on-startup>
-  </servlet>
-
-  <servlet>
-    <servlet-name>s2container</servlet-name>
-    <servlet-class>org.dbflute.saflute.web.servlet.ContainerManagementServlet</servlet-class>
-    <load-on-startup>4</load-on-startup>
+    <load-on-startup>1</load-on-startup>
   </servlet>
   </servlet>
 
 
-  <servlet-mapping>
-    <servlet-name>action</servlet-name>
-    <url-pattern>*.do</url-pattern>
-  </servlet-mapping>
-
-<!--
-  <servlet-mapping>
-    <servlet-name>s2container</servlet-name>
-    <url-pattern>/s2container</url-pattern>
-  </servlet-mapping>
--->
+  <!-- ================================================================================= -->
+  <!--                                                                   Servlet Mapping -->
+  <!--                                                                   =============== -->
 
 
+  <!-- ================================================================================= -->
+  <!--                                                                  Servlet Listener -->
+  <!--                                                                  ================ -->
   <listener>
   <listener>
   	<listener-class>org.apache.commons.fileupload.servlet.FileCleanerCleanup</listener-class>
   	<listener-class>org.apache.commons.fileupload.servlet.FileCleanerCleanup</listener-class>
   </listener>
   </listener>
 
 
+  <!-- ================================================================================= -->
+  <!--                                                                    Session Config -->
+  <!--                                                                    ============== -->
 <!--
 <!--
     <session-config>
     <session-config>
         <session-timeout>1</session-timeout>
         <session-timeout>1</session-timeout>
     </session-config>
     </session-config>
 	-->
 	-->
 
 
+  <!-- ================================================================================= -->
+  <!--                                                                      Welcome File -->
+  <!--                                                                      ============ -->
 <!--
 <!--
     <welcome-file-list>
     <welcome-file-list>
     </welcome-file-list>
     </welcome-file-list>
 	-->
 	-->
 
 
+  <!-- ================================================================================= -->
+  <!--                                                                        JSP Config -->
+  <!--                                                                        ========== -->
   <jsp-config>
   <jsp-config>
     <jsp-property-group>
     <jsp-property-group>
       <url-pattern>*.jsp</url-pattern>
       <url-pattern>*.jsp</url-pattern>
@@ -307,6 +234,9 @@
     </jsp-property-group>
     </jsp-property-group>
   </jsp-config>
   </jsp-config>
 
 
+  <!-- ================================================================================= -->
+  <!--                                                                          Security -->
+  <!--                                                                          ======== -->
   <security-constraint>
   <security-constraint>
     <web-resource-collection>
     <web-resource-collection>
       <web-resource-name>Fess Authentication</web-resource-name>
       <web-resource-name>Fess Authentication</web-resource-name>
@@ -332,6 +262,9 @@
     </form-login-config>
     </form-login-config>
   </login-config>
   </login-config>
 
 
+  <!-- ================================================================================= -->
+  <!--                                                                        Error Page -->
+  <!--                                                                        ========== -->
   <error-page>
   <error-page>
   	<error-code>400</error-code>
   	<error-code>400</error-code>
   	<location>/WEB-INF/view/error/redirect.jsp?type=badRequest</location>
   	<location>/WEB-INF/view/error/redirect.jsp?type=badRequest</location>
@@ -352,5 +285,4 @@
   	<error-code>500</error-code>
   	<error-code>500</error-code>
   	<location>/WEB-INF/view/error/redirect.jsp?type=systemError</location>
   	<location>/WEB-INF/view/error/redirect.jsp?type=systemError</location>
   </error-page>
   </error-page>
-
 </web-app>
 </web-app>