Browse Source

Merge pull request #997 from kw-udon/add-admin-apis

Add several Admin APIs
Shinsuke Sugaya 8 years ago
parent
commit
d2975547ad
24 changed files with 901 additions and 16 deletions
  1. 6 3
      src/main/java/org/codelibs/fess/app/web/admin/duplicatehost/AdminDuplicatehostAction.java
  2. 5 3
      src/main/java/org/codelibs/fess/app/web/admin/keymatch/AdminKeymatchAction.java
  3. 5 3
      src/main/java/org/codelibs/fess/app/web/admin/labeltype/AdminLabeltypeAction.java
  4. 4 1
      src/main/java/org/codelibs/fess/app/web/admin/log/AdminLogAction.java
  5. 55 0
      src/main/java/org/codelibs/fess/app/web/api/ApiResult.java
  6. 2 2
      src/main/java/org/codelibs/fess/app/web/api/admin/dataconfig/ApiAdminDataconfigAction.java
  7. 139 0
      src/main/java/org/codelibs/fess/app/web/api/admin/duplicatehost/ApiAdminDuplicatehostAction.java
  8. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/duplicatehost/CreateBody.java
  9. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/duplicatehost/EditBody.java
  10. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/duplicatehost/SearchBody.java
  11. 2 2
      src/main/java/org/codelibs/fess/app/web/api/admin/fileconfig/ApiAdminFileconfigAction.java
  12. 94 0
      src/main/java/org/codelibs/fess/app/web/api/admin/joblog/ApiAdminJoblogAction.java
  13. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/joblog/EditBody.java
  14. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/joblog/SearchBody.java
  15. 139 0
      src/main/java/org/codelibs/fess/app/web/api/admin/keymatch/ApiAdminKeymatchAction.java
  16. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/keymatch/CreateBody.java
  17. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/keymatch/EditBody.java
  18. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/keymatch/SearchBody.java
  19. 139 0
      src/main/java/org/codelibs/fess/app/web/api/admin/labeltype/ApiAdminLabeltypeAction.java
  20. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/labeltype/CreateBody.java
  21. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/labeltype/EditBody.java
  22. 22 0
      src/main/java/org/codelibs/fess/app/web/api/admin/labeltype/SearchBody.java
  23. 67 0
      src/main/java/org/codelibs/fess/app/web/api/admin/log/ApiAdminLogAction.java
  24. 2 2
      src/main/java/org/codelibs/fess/app/web/api/admin/webconfig/ApiAdminWebconfigAction.java

+ 6 - 3
src/main/java/org/codelibs/fess/app/web/admin/duplicatehost/AdminDuplicatehostAction.java

@@ -23,6 +23,8 @@ import org.codelibs.fess.app.service.DuplicateHostService;
 import org.codelibs.fess.app.web.CrudMode;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.es.config.exentity.DuplicateHost;
+import org.codelibs.fess.helper.SystemHelper;
+import org.codelibs.fess.util.ComponentUtil;
 import org.codelibs.fess.util.RenderDataUtil;
 import org.dbflute.optional.OptionalEntity;
 import org.dbflute.optional.OptionalThing;
@@ -225,7 +227,7 @@ public class AdminDuplicatehostAction extends FessAdminAction {
     // ===================================================================================
     //                                                                        Assist Logic
     //                                                                        ============
-    private OptionalEntity<DuplicateHost> getEntity(final CreateForm form, final String username, final long currentTime) {
+    public static OptionalEntity<DuplicateHost> getEntity(final CreateForm form, final String username, final long currentTime) {
         switch (form.crudMode) {
         case CrudMode.CREATE:
             return OptionalEntity.of(new DuplicateHost()).map(entity -> {
@@ -235,7 +237,7 @@ public class AdminDuplicatehostAction extends FessAdminAction {
             });
         case CrudMode.EDIT:
             if (form instanceof EditForm) {
-                return duplicateHostService.getDuplicateHost(((EditForm) form).id);
+                return ComponentUtil.getComponent(DuplicateHostService.class).getDuplicateHost(((EditForm) form).id);
             }
             break;
         default:
@@ -244,7 +246,8 @@ public class AdminDuplicatehostAction extends FessAdminAction {
         return OptionalEntity.empty();
     }
 
-    protected OptionalEntity<DuplicateHost> getDuplicateHost(final CreateForm form) {
+    public static OptionalEntity<DuplicateHost> getDuplicateHost(final CreateForm form) {
+        final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
         final String username = systemHelper.getUsername();
         final long currentTime = systemHelper.getCurrentTimeAsLong();
         return getEntity(form, username, currentTime).map(entity -> {

+ 5 - 3
src/main/java/org/codelibs/fess/app/web/admin/keymatch/AdminKeymatchAction.java

@@ -28,6 +28,7 @@ import org.codelibs.fess.app.web.CrudMode;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.es.config.exentity.KeyMatch;
 import org.codelibs.fess.helper.KeyMatchHelper;
+import org.codelibs.fess.helper.SystemHelper;
 import org.codelibs.fess.util.ComponentUtil;
 import org.codelibs.fess.util.RenderDataUtil;
 import org.dbflute.optional.OptionalEntity;
@@ -241,7 +242,7 @@ public class AdminKeymatchAction extends FessAdminAction {
     //                                                                        Assist Logic
     //                                                                        ============
 
-    private OptionalEntity<KeyMatch> getEntity(final CreateForm form, final String username, final long currentTime) {
+    public static OptionalEntity<KeyMatch> getEntity(final CreateForm form, final String username, final long currentTime) {
         switch (form.crudMode) {
         case CrudMode.CREATE:
             return OptionalEntity.of(new KeyMatch()).map(entity -> {
@@ -251,7 +252,7 @@ public class AdminKeymatchAction extends FessAdminAction {
             });
         case CrudMode.EDIT:
             if (form instanceof EditForm) {
-                return keyMatchService.getKeyMatch(((EditForm) form).id);
+                return ComponentUtil.getComponent(KeyMatchService.class).getKeyMatch(((EditForm) form).id);
             }
             break;
         default:
@@ -260,7 +261,8 @@ public class AdminKeymatchAction extends FessAdminAction {
         return OptionalEntity.empty();
     }
 
-    protected OptionalEntity<KeyMatch> getKeyMatch(final CreateForm form) {
+    public static OptionalEntity<KeyMatch> getKeyMatch(final CreateForm form) {
+        final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
         final String username = systemHelper.getUsername();
         final long currentTime = systemHelper.getCurrentTimeAsLong();
         return getEntity(form, username, currentTime).map(entity -> {

+ 5 - 3
src/main/java/org/codelibs/fess/app/web/admin/labeltype/AdminLabeltypeAction.java

@@ -32,6 +32,7 @@ import org.codelibs.fess.app.web.CrudMode;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.es.config.exentity.LabelType;
 import org.codelibs.fess.helper.PermissionHelper;
+import org.codelibs.fess.helper.SystemHelper;
 import org.codelibs.fess.util.ComponentUtil;
 import org.codelibs.fess.util.RenderDataUtil;
 import org.dbflute.optional.OptionalEntity;
@@ -268,7 +269,7 @@ public class AdminLabeltypeAction extends FessAdminAction {
     //                                                                        Assist Logic
     //                                                                        ============
 
-    private OptionalEntity<LabelType> getEntity(final CreateForm form, final String username, final long currentTime) {
+    public static OptionalEntity<LabelType> getEntity(final CreateForm form, final String username, final long currentTime) {
         switch (form.crudMode) {
         case CrudMode.CREATE:
             return OptionalEntity.of(new LabelType()).map(entity -> {
@@ -278,7 +279,7 @@ public class AdminLabeltypeAction extends FessAdminAction {
             });
         case CrudMode.EDIT:
             if (form instanceof EditForm) {
-                return labelTypeService.getLabelType(((EditForm) form).id);
+                return ComponentUtil.getComponent(LabelTypeService.class).getLabelType(((EditForm) form).id);
             }
             break;
         default:
@@ -287,7 +288,8 @@ public class AdminLabeltypeAction extends FessAdminAction {
         return OptionalEntity.empty();
     }
 
-    protected OptionalEntity<LabelType> getLabelType(final CreateForm form) {
+    public static OptionalEntity<LabelType> getLabelType(final CreateForm form) {
+        final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
         final String username = systemHelper.getUsername();
         final long currentTime = systemHelper.getCurrentTimeAsLong();
         return getEntity(form, username, currentTime).map(

+ 4 - 1
src/main/java/org/codelibs/fess/app/web/admin/log/AdminLogAction.java

@@ -32,6 +32,8 @@ import java.util.stream.Stream;
 import org.codelibs.core.lang.StringUtil;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.exception.FessSystemException;
+import org.codelibs.fess.helper.SystemHelper;
+import org.codelibs.fess.util.ComponentUtil;
 import org.codelibs.fess.util.RenderDataUtil;
 import org.lastaflute.di.exception.IORuntimeException;
 import org.lastaflute.web.Execute;
@@ -74,7 +76,8 @@ public class AdminLogAction extends FessAdminAction {
         return redirect(getClass()); // no-op
     }
 
-    private List<Map<String, Object>> getLogFileItems() {
+    public static List<Map<String, Object>> getLogFileItems() {
+        final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
         final List<Map<String, Object>> logFileItems = new ArrayList<>();
         final String logFilePath = systemHelper.getLogFilePath();
         if (StringUtil.isNotBlank(logFilePath)) {

+ 55 - 0
src/main/java/org/codelibs/fess/app/web/api/ApiResult.java

@@ -17,6 +17,7 @@ package org.codelibs.fess.app.web.api;
 
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 import org.codelibs.fess.Constants;
@@ -114,6 +115,60 @@ public class ApiResult {
         }
     }
 
+    public static class ApiLogResponse extends ApiResponse {
+        protected Object log;
+
+        public ApiLogResponse log(final Object log) {
+            this.log = log;
+            return this;
+        }
+
+        @Override
+        public ApiResult result() {
+            return new ApiResult(this);
+        }
+    }
+
+    public static class ApiLogsResponse<T> extends ApiResponse {
+        protected List<T> logs;
+        protected long total = 0;
+
+        public ApiLogsResponse<T> logs(final List<T> logs) {
+            this.logs = logs;
+            return this;
+        }
+
+        public ApiLogsResponse<T> total(final long total) {
+            this.total = total;
+            return this;
+        }
+
+        @Override
+        public ApiResult result() {
+            return new ApiResult(this);
+        }
+    }
+
+    public static class ApiLogFilesResponse extends ApiResponse {
+        protected List<Map<String, Object>> logfiles;
+        protected long total = 0;
+
+        public ApiLogFilesResponse logfiles(final List<Map<String, Object>> logfiles) {
+            this.logfiles = logfiles;
+            return this;
+        }
+
+        public ApiLogFilesResponse total(final long total) {
+            this.total = total;
+            return this;
+        }
+
+        @Override
+        public ApiResult result() {
+            return new ApiResult(this);
+        }
+    }
+
     public static class ApiErrorResponse extends ApiResponse {
         protected String message;
 

+ 2 - 2
src/main/java/org/codelibs/fess/app/web/api/admin/dataconfig/ApiAdminDataconfigAction.java

@@ -51,8 +51,8 @@ public class ApiAdminDataconfigAction extends FessApiAdminAction {
     //                                                                      Search Execute
     //                                                                      ==============
 
-    // GET /api/admin/dataconfig
-    // POST /api/admin/dataconfig
+    // GET /api/admin/dataconfig/settings
+    // POST /api/admin/dataconfig/settings
     @Execute
     public JsonResponse<ApiResult> settings(final SearchBody body) {
         validateApi(body, messages -> {});

+ 139 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/duplicatehost/ApiAdminDuplicatehostAction.java

@@ -0,0 +1,139 @@
+/*
+ * Copyright 2012-2017 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.api.admin.duplicatehost;
+
+import static org.codelibs.fess.app.web.admin.duplicatehost.AdminDuplicatehostAction.getDuplicateHost;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import org.codelibs.fess.Constants;
+import org.codelibs.fess.app.pager.DuplicateHostPager;
+import org.codelibs.fess.app.service.DuplicateHostService;
+import org.codelibs.fess.app.web.CrudMode;
+import org.codelibs.fess.app.web.api.ApiResult;
+import org.codelibs.fess.app.web.api.ApiResult.ApiConfigResponse;
+import org.codelibs.fess.app.web.api.ApiResult.ApiResponse;
+import org.codelibs.fess.app.web.api.ApiResult.ApiUpdateResponse;
+import org.codelibs.fess.app.web.api.ApiResult.Status;
+import org.codelibs.fess.app.web.api.admin.FessApiAdminAction;
+import org.codelibs.fess.es.config.exentity.DuplicateHost;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.response.JsonResponse;
+
+/**
+ * @author Keiichi Watanabe
+ */
+public class ApiAdminDuplicatehostAction extends FessApiAdminAction {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    private DuplicateHostService duplicateHostService;
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+
+    // GET /api/admin/duplicatehost/settings
+    // POST /api/admin/duplicatehost/settings
+    @Execute
+    public JsonResponse<ApiResult> settings(final SearchBody body) {
+        validateApi(body, messages -> {});
+        final DuplicateHostPager pager = new DuplicateHostPager();
+        copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
+        final List<DuplicateHost> list = duplicateHostService.getDuplicateHostList(pager);
+        return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
+                .settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
+                .total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
+    }
+
+    // GET /api/admin/duplicatehost/setting/{id}
+    @Execute
+    public JsonResponse<ApiResult> get$setting(final String id) {
+        return asJson(new ApiConfigResponse()
+                .setting(duplicateHostService.getDuplicateHost(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
+                    throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
+                    return null;
+                })).status(Status.OK).result());
+    }
+
+    // PUT /api/admin/duplicatehost/setting
+    @Execute
+    public JsonResponse<ApiResult> put$setting(final CreateBody body) {
+        validateApi(body, messages -> {});
+        body.crudMode = CrudMode.CREATE;
+        final DuplicateHost duplicateHost = getDuplicateHost(body).map(entity -> {
+            try {
+                duplicateHostService.store(entity);
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+            return entity;
+        }).orElseGet(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL));
+            return null;
+        });
+
+        return asJson(new ApiUpdateResponse().id(duplicateHost.getId()).created(true).status(Status.OK).result());
+    }
+
+    // POST /api/admin/duplicatehost/setting
+    @Execute
+    public JsonResponse<ApiResult> post$setting(final EditBody body) {
+        validateApi(body, messages -> {});
+        body.crudMode = CrudMode.EDIT;
+        final DuplicateHost duplicateHost = getDuplicateHost(body).map(entity -> {
+            try {
+                duplicateHostService.store(entity);
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+            return entity;
+        }).orElseGet(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, body.id));
+            return null;
+        });
+        return asJson(new ApiUpdateResponse().id(duplicateHost.getId()).created(false).status(Status.OK).result());
+    }
+
+    // DELETE /api/admin/duplicatehost/setting/{id}
+    @Execute
+    public JsonResponse<ApiResult> delete$setting(final String id) {
+        duplicateHostService.getDuplicateHost(id).ifPresent(entity -> {
+            try {
+                duplicateHostService.delete(entity);
+                saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+        }).orElse(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
+        });
+        return asJson(new ApiResponse().status(Status.OK).result());
+    }
+
+    protected EditBody createEditBody(final DuplicateHost entity) {
+        final EditBody body = new EditBody();
+        copyBeanToBean(entity, body, copyOp -> {
+            copyOp.excludeNull();
+        });
+        return body;
+    }
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/duplicatehost/CreateBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.duplicatehost;
+
+import org.codelibs.fess.app.web.admin.duplicatehost.CreateForm;
+
+public class CreateBody extends CreateForm {
+
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/duplicatehost/EditBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.duplicatehost;
+
+import org.codelibs.fess.app.web.admin.duplicatehost.EditForm;
+
+public class EditBody extends EditForm {
+
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/duplicatehost/SearchBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.duplicatehost;
+
+import org.codelibs.fess.app.web.admin.duplicatehost.SearchForm;
+
+public class SearchBody extends SearchForm {
+
+}

+ 2 - 2
src/main/java/org/codelibs/fess/app/web/api/admin/fileconfig/ApiAdminFileconfigAction.java

@@ -51,8 +51,8 @@ public class ApiAdminFileconfigAction extends FessApiAdminAction {
     //                                                                      Search Execute
     //                                                                      ==============
 
-    // GET /api/admin/fileconfig
-    // POST /api/admin/fileconfig
+    // GET /api/admin/fileconfig/settings
+    // POST /api/admin/fileconfig/settings
     @Execute
     public JsonResponse<ApiResult> settings(final SearchBody body) {
         validateApi(body, messages -> {});

+ 94 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/joblog/ApiAdminJoblogAction.java

@@ -0,0 +1,94 @@
+/*
+ * Copyright 2012-2017 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.api.admin.joblog;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import org.codelibs.fess.Constants;
+import org.codelibs.fess.app.pager.JobLogPager;
+import org.codelibs.fess.app.service.JobLogService;
+import org.codelibs.fess.app.web.api.ApiResult;
+import org.codelibs.fess.app.web.api.ApiResult.ApiLogResponse;
+import org.codelibs.fess.app.web.api.ApiResult.ApiResponse;
+import org.codelibs.fess.app.web.api.ApiResult.Status;
+import org.codelibs.fess.app.web.api.admin.FessApiAdminAction;
+import org.codelibs.fess.es.config.exentity.JobLog;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.response.JsonResponse;
+
+/**
+ * @author Keiichi Watanabe
+ */
+public class ApiAdminJoblogAction extends FessApiAdminAction {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    private JobLogService jobLogService;
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+
+    // GET /api/admin/joblog/logs
+    @Execute
+    public JsonResponse<ApiResult> logs(final SearchBody body) {
+        validateApi(body, messages -> {});
+        final JobLogPager pager = new JobLogPager();
+        copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
+        final List<JobLog> list = jobLogService.getJobLogList(pager);
+        return asJson(new ApiResult.ApiLogsResponse<EditBody>()
+                .logs(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList())).total(pager.getAllRecordCount())
+                .status(ApiResult.Status.OK).result());
+    }
+
+    // GET /api/admin/joblog/log/{id}
+    @Execute
+    public JsonResponse<ApiResult> get$log(final String id) {
+        return asJson(new ApiLogResponse().log(jobLogService.getJobLog(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
+            return null;
+        })).status(Status.OK).result());
+    }
+
+    // DELETE /api/admin/joblog/log/{id}
+    @Execute
+    public JsonResponse<ApiResult> delete$log(final String id) {
+        jobLogService.getJobLog(id).ifPresent(entity -> {
+            try {
+                jobLogService.delete(entity);
+                saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+        }).orElse(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
+        });
+        return asJson(new ApiResponse().status(Status.OK).result());
+    }
+
+    protected EditBody createEditBody(final JobLog entity) {
+        final EditBody body = new EditBody();
+        copyBeanToBean(entity, body, copyOp -> {
+            copyOp.excludeNull();
+        });
+        return body;
+    }
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/joblog/EditBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.joblog;
+
+import org.codelibs.fess.app.web.admin.joblog.EditForm;
+
+public class EditBody extends EditForm {
+
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/joblog/SearchBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.joblog;
+
+import org.codelibs.fess.app.web.admin.joblog.SearchForm;
+
+public class SearchBody extends SearchForm {
+
+}

+ 139 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/keymatch/ApiAdminKeymatchAction.java

@@ -0,0 +1,139 @@
+/*
+ * Copyright 2012-2017 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.api.admin.keymatch;
+
+import static org.codelibs.fess.app.web.admin.keymatch.AdminKeymatchAction.getKeyMatch;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import org.codelibs.fess.Constants;
+import org.codelibs.fess.app.pager.KeyMatchPager;
+import org.codelibs.fess.app.service.KeyMatchService;
+import org.codelibs.fess.app.web.CrudMode;
+import org.codelibs.fess.app.web.api.ApiResult;
+import org.codelibs.fess.app.web.api.ApiResult.ApiConfigResponse;
+import org.codelibs.fess.app.web.api.ApiResult.ApiResponse;
+import org.codelibs.fess.app.web.api.ApiResult.ApiUpdateResponse;
+import org.codelibs.fess.app.web.api.ApiResult.Status;
+import org.codelibs.fess.app.web.api.admin.FessApiAdminAction;
+import org.codelibs.fess.es.config.exentity.KeyMatch;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.response.JsonResponse;
+
+/**
+ * @author Keiichi Watanabe
+ */
+public class ApiAdminKeymatchAction extends FessApiAdminAction {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    private KeyMatchService keyMatchService;
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+
+    // GET /api/admin/keymatch/settings
+    // POST /api/admin/keymatch/settings
+    @Execute
+    public JsonResponse<ApiResult> settings(final SearchBody body) {
+        validateApi(body, messages -> {});
+        final KeyMatchPager pager = new KeyMatchPager();
+        copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
+        final List<KeyMatch> list = keyMatchService.getKeyMatchList(pager);
+        return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
+                .settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
+                .total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
+    }
+
+    // GET /api/admin/keymatch/setting/{id}
+    @Execute
+    public JsonResponse<ApiResult> get$setting(final String id) {
+        return asJson(new ApiConfigResponse()
+                .setting(keyMatchService.getKeyMatch(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
+                    throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
+                    return null;
+                })).status(Status.OK).result());
+    }
+
+    // PUT /api/admin/keymatch/setting
+    @Execute
+    public JsonResponse<ApiResult> put$setting(final CreateBody body) {
+        validateApi(body, messages -> {});
+        body.crudMode = CrudMode.CREATE;
+        final KeyMatch keyMatch = getKeyMatch(body).map(entity -> {
+            try {
+                keyMatchService.store(entity);
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+            return entity;
+        }).orElseGet(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL));
+            return null;
+        });
+
+        return asJson(new ApiUpdateResponse().id(keyMatch.getId()).created(true).status(Status.OK).result());
+    }
+
+    // POST /api/admin/keymatch/setting
+    @Execute
+    public JsonResponse<ApiResult> post$setting(final EditBody body) {
+        validateApi(body, messages -> {});
+        body.crudMode = CrudMode.EDIT;
+        final KeyMatch keyMatch = getKeyMatch(body).map(entity -> {
+            try {
+                keyMatchService.store(entity);
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+            return entity;
+        }).orElseGet(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, body.id));
+            return null;
+        });
+        return asJson(new ApiUpdateResponse().id(keyMatch.getId()).created(false).status(Status.OK).result());
+    }
+
+    // DELETE /api/admin/keymatch/setting/{id}
+    @Execute
+    public JsonResponse<ApiResult> delete$setting(final String id) {
+        keyMatchService.getKeyMatch(id).ifPresent(entity -> {
+            try {
+                keyMatchService.delete(entity);
+                saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+        }).orElse(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
+        });
+        return asJson(new ApiResponse().status(Status.OK).result());
+    }
+
+    protected EditBody createEditBody(final KeyMatch entity) {
+        final EditBody body = new EditBody();
+        copyBeanToBean(entity, body, copyOp -> {
+            copyOp.excludeNull();
+        });
+        return body;
+    }
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/keymatch/CreateBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.keymatch;
+
+import org.codelibs.fess.app.web.admin.keymatch.CreateForm;
+
+public class CreateBody extends CreateForm {
+
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/keymatch/EditBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.keymatch;
+
+import org.codelibs.fess.app.web.admin.keymatch.EditForm;
+
+public class EditBody extends EditForm {
+
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/keymatch/SearchBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.keymatch;
+
+import org.codelibs.fess.app.web.admin.keymatch.SearchForm;
+
+public class SearchBody extends SearchForm {
+
+}

+ 139 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/labeltype/ApiAdminLabeltypeAction.java

@@ -0,0 +1,139 @@
+/*
+ * Copyright 2012-2017 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.api.admin.labeltype;
+
+import static org.codelibs.fess.app.web.admin.labeltype.AdminLabeltypeAction.getLabelType;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import org.codelibs.fess.Constants;
+import org.codelibs.fess.app.pager.LabelTypePager;
+import org.codelibs.fess.app.service.LabelTypeService;
+import org.codelibs.fess.app.web.CrudMode;
+import org.codelibs.fess.app.web.api.ApiResult;
+import org.codelibs.fess.app.web.api.ApiResult.ApiConfigResponse;
+import org.codelibs.fess.app.web.api.ApiResult.ApiResponse;
+import org.codelibs.fess.app.web.api.ApiResult.ApiUpdateResponse;
+import org.codelibs.fess.app.web.api.ApiResult.Status;
+import org.codelibs.fess.app.web.api.admin.FessApiAdminAction;
+import org.codelibs.fess.es.config.exentity.LabelType;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.response.JsonResponse;
+
+/**
+ * @author Keiichi Watanabe
+ */
+public class ApiAdminLabeltypeAction extends FessApiAdminAction {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    private LabelTypeService labelTypeService;
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+
+    // GET /api/admin/labeltype/settings
+    // POST /api/admin/labeltype/settings
+    @Execute
+    public JsonResponse<ApiResult> settings(final SearchBody body) {
+        validateApi(body, messages -> {});
+        final LabelTypePager pager = new LabelTypePager();
+        copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
+        final List<LabelType> list = labelTypeService.getLabelTypeList(pager);
+        return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
+                .settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
+                .total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
+    }
+
+    // GET /api/admin/labeltype/setting/{id}
+    @Execute
+    public JsonResponse<ApiResult> get$setting(final String id) {
+        return asJson(new ApiConfigResponse()
+                .setting(labelTypeService.getLabelType(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
+                    throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
+                    return null;
+                })).status(Status.OK).result());
+    }
+
+    // PUT /api/admin/labeltype/setting
+    @Execute
+    public JsonResponse<ApiResult> put$setting(final CreateBody body) {
+        validateApi(body, messages -> {});
+        body.crudMode = CrudMode.CREATE;
+        final LabelType labelType = getLabelType(body).map(entity -> {
+            try {
+                labelTypeService.store(entity);
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+            return entity;
+        }).orElseGet(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL));
+            return null;
+        });
+
+        return asJson(new ApiUpdateResponse().id(labelType.getId()).created(true).status(Status.OK).result());
+    }
+
+    // POST /api/admin/labeltype/setting
+    @Execute
+    public JsonResponse<ApiResult> post$setting(final EditBody body) {
+        validateApi(body, messages -> {});
+        body.crudMode = CrudMode.EDIT;
+        final LabelType labelType = getLabelType(body).map(entity -> {
+            try {
+                labelTypeService.store(entity);
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+            return entity;
+        }).orElseGet(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, body.id));
+            return null;
+        });
+        return asJson(new ApiUpdateResponse().id(labelType.getId()).created(false).status(Status.OK).result());
+    }
+
+    // DELETE /api/admin/labeltype/setting/{id}
+    @Execute
+    public JsonResponse<ApiResult> delete$setting(final String id) {
+        labelTypeService.getLabelType(id).ifPresent(entity -> {
+            try {
+                labelTypeService.delete(entity);
+                saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
+            } catch (final Exception e) {
+                throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)));
+            }
+        }).orElse(() -> {
+            throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
+        });
+        return asJson(new ApiResponse().status(Status.OK).result());
+    }
+
+    protected EditBody createEditBody(final LabelType entity) {
+        final EditBody body = new EditBody();
+        copyBeanToBean(entity, body, copyOp -> {
+            copyOp.excludeNull();
+        });
+        return body;
+    }
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/labeltype/CreateBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.labeltype;
+
+import org.codelibs.fess.app.web.admin.labeltype.CreateForm;
+
+public class CreateBody extends CreateForm {
+
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/labeltype/EditBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.labeltype;
+
+import org.codelibs.fess.app.web.admin.labeltype.EditForm;
+
+public class EditBody extends EditForm {
+
+}

+ 22 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/labeltype/SearchBody.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2012-2017 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.api.admin.labeltype;
+
+import org.codelibs.fess.app.web.admin.labeltype.SearchForm;
+
+public class SearchBody extends SearchForm {
+
+}

+ 67 - 0
src/main/java/org/codelibs/fess/app/web/api/admin/log/ApiAdminLogAction.java

@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012-2017 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.api.admin.log;
+
+import static org.codelibs.fess.app.web.admin.log.AdminLogAction.getLogFileItems;
+
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Base64;
+import java.util.List;
+import java.util.Map;
+
+import org.codelibs.core.lang.StringUtil;
+import org.codelibs.fess.app.web.api.ApiResult;
+import org.codelibs.fess.app.web.api.admin.FessApiAdminAction;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.response.JsonResponse;
+import org.lastaflute.web.response.StreamResponse;
+
+/**
+ * @author Keiichi Watanabe
+ */
+public class ApiAdminLogAction extends FessApiAdminAction {
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+
+    // GET /api/admin/log/logfiles
+    @Execute
+    public JsonResponse<ApiResult> logfiles() {
+        List<Map<String, Object>> list = getLogFileItems();
+        return asJson(new ApiResult.ApiLogFilesResponse().logfiles(list).total(list.size()).status(ApiResult.Status.OK).result());
+    }
+
+    // GET /api/admin/log/logfile/{id}
+    @Execute
+    public StreamResponse get$logfile(final String id) {
+        final String filename = new String(Base64.getDecoder().decode(id), StandardCharsets.UTF_8).replace("..", "").replaceAll("\\s", "");
+        final String logFilePath = systemHelper.getLogFilePath();
+        if (StringUtil.isNotBlank(logFilePath)) {
+            final Path path = Paths.get(logFilePath, filename);
+            return asStream(filename).contentTypeOctetStream().stream(out -> {
+                try (InputStream in = Files.newInputStream(path)) {
+                    out.write(in);
+                }
+            });
+        }
+        return StreamResponse.asEmptyBody();
+    }
+}

+ 2 - 2
src/main/java/org/codelibs/fess/app/web/api/admin/webconfig/ApiAdminWebconfigAction.java

@@ -51,8 +51,8 @@ public class ApiAdminWebconfigAction extends FessApiAdminAction {
     //                                                                      Search Execute
     //                                                                      ==============
 
-    // GET /api/admin/webconfig
-    // POST /api/admin/webconfig
+    // GET /api/admin/webconfig/settings
+    // POST /api/admin/webconfig/settings
     @Execute
     public JsonResponse<ApiResult> settings(final SearchBody body) {
         validateApi(body, messages -> {});