Преглед изворни кода

modify error page handling

Shinsuke Sugaya пре 9 година
родитељ
комит
6fb754399f

+ 1 - 1
pom.xml

@@ -39,7 +39,7 @@
 
 		<!-- Main Framework -->
 		<dbflute.version>1.1.0-sp8</dbflute.version>
-		<lastaflute.version>0.6.7-A-SNAPSHOT</lastaflute.version>
+		<lastaflute.version>0.6.7-B-SNAPSHOT</lastaflute.version>
 		<lasta.taglib.version>0.6.1</lasta.taglib.version>
 		<servlet.version>3.1.0</servlet.version>
 		<jsp.version>2.3.1</jsp.version>

+ 0 - 13
src/main/java/org/codelibs/fess/app/web/base/FessAdminAction.java

@@ -95,19 +95,6 @@ public abstract class FessAdminAction extends FessBaseAction {
         return OptionalThing.of(fessLoginAssist);
     }
 
-    // ===================================================================================
-    //                                                                            Override
-    //                                                                           =========
-    //    @Override
-    //    protected TypicalEmbeddedKeySupplier newTypicalEmbeddedKeySupplier() {
-    //        return new TypicalSimpleEmbeddedKeySupplier() {
-    //            @Override
-    //            public String getErrorMessageForwardPath() {
-    //                return "/admin/error/error.jsp";
-    //            }
-    //        };
-    //    }
-
     // ===================================================================================
     //                                                                               Hook
     //                                                                              ======

+ 0 - 13
src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java

@@ -86,19 +86,6 @@ public abstract class FessSearchAction extends FessBaseAction {
 
     protected boolean favoriteSupport;
 
-    // ===================================================================================
-    //                                                                            Override
-    //                                                                           =========
-    //    @Override
-    //    protected TypicalEmbeddedKeySupplier newTypicalEmbeddedKeySupplier() {
-    //        return new TypicalSimpleEmbeddedKeySupplier() {
-    //            @Override
-    //            public String getErrorMessageForwardPath() {
-    //                return "/error/system.jsp";
-    //            }
-    //        };
-    //    }
-
     @Override
     public ActionResponse hookBefore(final ActionRuntime runtime) { // application may override
         searchLogSupport = Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE));

+ 12 - 0
src/main/java/org/codelibs/fess/mylasta/direction/FessFwAssistantDirector.java

@@ -17,6 +17,7 @@ package org.codelibs.fess.mylasta.direction;
 
 import javax.annotation.Resource;
 
+import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.mylasta.direction.sponsor.FessActionAdjustmentProvider;
 import org.codelibs.fess.mylasta.direction.sponsor.FessApiFailureHook;
 import org.codelibs.fess.mylasta.direction.sponsor.FessCookieResourceProvider;
@@ -37,6 +38,8 @@ import org.lastaflute.core.security.OneWayCryptographer;
 import org.lastaflute.db.dbflute.classification.ListedClassificationProvider;
 import org.lastaflute.db.direction.FwDbDirection;
 import org.lastaflute.web.direction.FwWebDirection;
+import org.lastaflute.web.ruts.process.ActionRuntime;
+import org.lastaflute.web.ruts.renderer.JspHtmlRenderingProvider;
 
 /**
  * @author jflute
@@ -126,6 +129,15 @@ public class FessFwAssistantDirector extends CachedFwAssistantDirector {
         direction.directMessage(nameList -> nameList.add("fess_message"), "fess_label");
         direction.directApiCall(createApiFailureHook());
         direction.directMultipart(() -> new FessMultipartRequestHandler());
+        direction.directHtmlRendering(new JspHtmlRenderingProvider() {
+            protected String getShowErrorsForwardPath(ActionRuntime runtime) {
+                if (FessAdminAction.class.isAssignableFrom(runtime.getActionType())) {
+                    return "/admin/error/error.jsp";
+                } else {
+                    return "/error/system.jsp";
+                }
+            };
+        });
     }
 
     protected FessUserLocaleProcessProvider createUserLocaleProcessProvider() {