(empty log message)
@@ -3,7 +3,10 @@ | ||
3 | 3 | import org.phosphoresce.webcore.ConfigName; |
4 | 4 | import org.phosphoresce.webcore.GlobalConstants; |
5 | 5 | import org.phosphoresce.webcore.config.Config; |
6 | +import org.phosphoresce.webcore.struts.action.AbstractForm; | |
7 | +import org.phosphoresce.webcore.struts.action.ServletContainer; | |
6 | 8 | import org.phosphoresce.webcore.struts.action.SessionContainer; |
9 | +import org.phosphoresce.webcore.struts.action.WindowSessionContainer; | |
7 | 10 | |
8 | 11 | /** |
9 | 12 | * Strutsアドオン定数インタフェース<br> |
@@ -18,23 +21,18 @@ | ||
18 | 21 | public interface StrutsConstants extends GlobalConstants { |
19 | 22 | |
20 | 23 | /** JSPパス(システムエラーページ) */ |
21 | - public static String JSP_SYSTEM_ERROR_PAGE = Config.getString(ConfigName.COMMON_JSP_PATH) + Config.getString(ConfigName.COMMON_JSP_SYSTEMERROR); | |
24 | + public static String JSP_SYSTEM_ERROR_PAGE = Config.getString(ConfigName.COMMON_JSP_SYSTEMERROR); | |
22 | 25 | |
23 | 26 | /** JSPパス(メッセージページ) */ |
24 | 27 | public static String JSP_MESSAGE_PAGE = Config.getString(ConfigName.COMMON_JSP_PATH) + Config.getString(StrutsConfigNames.STRUTS_STATUS_EXCEPTION); |
25 | 28 | |
29 | + /** アクションメソッドインタフェースシグネチャ */ | |
30 | + @SuppressWarnings("rawtypes") | |
31 | + public static final Class[] ACTION_METHOD_SIGNATURE = new Class[] { AbstractForm.class, WindowSessionContainer.class, ServletContainer.class }; | |
32 | + | |
26 | 33 | /** セッションキー(コンテナ保持キー) */ |
27 | 34 | public static final String SESSION_KEY_CONTAINER = SessionContainer.class.getName(); |
28 | 35 | |
29 | - /** リクエストアトリビュートキー(アプリケーション環境情報オブジェクト) */ | |
30 | - public static final String REQUEST_ATTR_KEY_ENVIRONMENT = "environment"; | |
31 | - | |
32 | - /** リクエストアトリビュートキー(アプリケーション環境定義オブジェクト) */ | |
33 | - public static final String REQUEST_ATTR_KEY_CONFIG = "config"; | |
34 | - | |
35 | - /** リクエストアトリビュートキー(リクエストオブジェクト) */ | |
36 | - public static final String REQUEST_ATTR_KEY_REQUEST = "request"; | |
37 | - | |
38 | 36 | /** リクエストアトリビュートキー(セッションコンテナオブジェクト) */ |
39 | 37 | public static final String REQUEST_ATTR_KEY_SESSION_CONTAINER = "sessionContainer"; |
40 | 38 |
@@ -44,9 +42,6 @@ | ||
44 | 42 | /** リクエストアトリビュートキー(画面データオブジェクト) */ |
45 | 43 | public static final String REQUEST_ATTR_KEY_SCREEN_DATA = "screenData"; |
46 | 44 | |
47 | - /** リクエストアトリビュートキー(例外オブジェクト) */ | |
48 | - public static final String REQUEST_ATTR_KEY_EXCEPTION = "exception"; | |
49 | - | |
50 | 45 | /** リクエストアトリビュートキー(アクションフォームオブジェクト) */ |
51 | 46 | public static final String REQUEST_ATTR_KEY_FORM = "form"; |
52 | 47 |
@@ -5,6 +5,7 @@ | ||
5 | 5 | import org.apache.struts.action.ActionMapping; |
6 | 6 | import org.apache.struts.config.ActionConfig; |
7 | 7 | import org.apache.struts.config.impl.ModuleConfigImpl; |
8 | +import org.phosphoresce.commons.util.StringUtil; | |
8 | 9 | import org.phosphoresce.webcore.config.Config; |
9 | 10 | import org.phosphoresce.webcore.logger.CodeConvertLogger; |
10 | 11 | import org.phosphoresce.webcore.struts.StrutsConfigNames; |
@@ -67,7 +68,8 @@ | ||
67 | 68 | /* |
68 | 69 | * サーブレットパスが未指定の場合はディフォルトアクションパスとする |
69 | 70 | */ |
70 | - if (!StrutsUtil.isExistActionClass(actionPath)) { | |
71 | + String functionId = StrutsUtil.getRequestFunction(actionPath); | |
72 | + if (StringUtil.isEmpty(functionId)) { | |
71 | 73 | actionPath = Config.getString(StrutsConfigNames.STRUTS_URL_INDEX); |
72 | 74 | } |
73 | 75 |
@@ -75,12 +77,6 @@ | ||
75 | 77 | * アクションコンフィグが存在しない場合はインスタンス生成 |
76 | 78 | */ |
77 | 79 | if (actionConfig == null) { |
78 | - if (!StrutsUtil.isExistFormClass(actionPath)) { | |
79 | - throw new StrutsProcessInternalException("FSTR08004", new Object[] { StrutsUtil.getFormClassName(actionPath) }); | |
80 | - } | |
81 | - if (!StrutsUtil.isExistActionClass(actionPath)) { | |
82 | - throw new StrutsProcessInternalException("FSTR09007", new Object[] { StrutsUtil.getActionClassName(actionPath) }); | |
83 | - } | |
84 | 80 | Class<? extends AbstractForm<? extends Serializable>> formClass = StrutsUtil.getFormClass(actionPath); |
85 | 81 | String name = StrutsUtil.getFormClassSimpleName(actionPath); |
86 | 82 | String scope = StrutsAnnotationUtil.getFormScope(formClass); |
@@ -54,12 +54,12 @@ | ||
54 | 54 | /** セッションタイムアウトチェックフラグ */ |
55 | 55 | public abstract boolean checkSesion() default true; |
56 | 56 | |
57 | + /** ログインチェックフラグ */ | |
58 | + public abstract boolean checkLogin() default true; | |
59 | + | |
57 | 60 | /** トークンチェックフラグ */ |
58 | 61 | public abstract boolean checkToken() default false; |
59 | 62 | |
60 | - /** ログインチェックフラグ */ | |
61 | - public abstract boolean checkLogin() default true; | |
62 | - | |
63 | 63 | /** フォームバリデーションメソッド */ |
64 | 64 | public abstract String validate() default ""; |
65 | 65 |
@@ -66,8 +66,8 @@ | ||
66 | 66 | /** バリデーションエラー時遷移ページ */ |
67 | 67 | public abstract String input() default ""; |
68 | 68 | |
69 | - /** データベーストランザクション処理フラグ */ | |
70 | - public abstract StrutsTransaction transaction() default @StrutsTransaction; | |
69 | + /** データベーストランザクション管理クラス */ | |
70 | + public abstract StrutsTransaction[] transactions() default {}; | |
71 | 71 | |
72 | 72 | /** 編集済み状態クリアフラグ */ |
73 | 73 | public abstract boolean clearEdited() default false; |
@@ -0,0 +1,26 @@ | ||
1 | +package org.phosphoresce.webcore.struts.annotation; | |
2 | + | |
3 | +import java.lang.annotation.Documented; | |
4 | +import java.lang.annotation.ElementType; | |
5 | +import java.lang.annotation.Retention; | |
6 | +import java.lang.annotation.RetentionPolicy; | |
7 | +import java.lang.annotation.Target; | |
8 | + | |
9 | +/** | |
10 | + * セッションクラスアノテーション<br> | |
11 | + * <br> | |
12 | + * セッションクラスに対して付与して利用しするアノテーションで、セッション処理の挙動定義を行います。<br> | |
13 | + * | |
14 | + * @author Kitagawa<br> | |
15 | + * | |
16 | + *<!-- | |
17 | + * 更新日 更新者 更新内容 | |
18 | + * 2010/07/19 Kitagawa 新規作成 | |
19 | + * 2012/07/04 Kitagawa 全体的に再構築 | |
20 | + *--> | |
21 | + */ | |
22 | +@Retention(RetentionPolicy.RUNTIME) | |
23 | +@Target({ ElementType.TYPE }) | |
24 | +@Documented | |
25 | +public @interface StrutsSession { | |
26 | +} |
@@ -0,0 +1,26 @@ | ||
1 | +package org.phosphoresce.webcore.struts.annotation; | |
2 | + | |
3 | +import java.lang.annotation.Documented; | |
4 | +import java.lang.annotation.ElementType; | |
5 | +import java.lang.annotation.Retention; | |
6 | +import java.lang.annotation.RetentionPolicy; | |
7 | +import java.lang.annotation.Target; | |
8 | + | |
9 | +/** | |
10 | + * ユーティリティクラスアノテーション<br> | |
11 | + * <br> | |
12 | + * ユーティリティクラスに対して付与して利用しするアノテーションで、ユーティリティ処理の挙動定義を行います。<br> | |
13 | + * | |
14 | + * @author Kitagawa<br> | |
15 | + * | |
16 | + *<!-- | |
17 | + * 更新日 更新者 更新内容 | |
18 | + * 2010/07/19 Kitagawa 新規作成 | |
19 | + * 2012/07/04 Kitagawa 全体的に再構築 | |
20 | + *--> | |
21 | + */ | |
22 | +@Retention(RetentionPolicy.RUNTIME) | |
23 | +@Target({ ElementType.TYPE }) | |
24 | +@Documented | |
25 | +public @interface StrutsUtility { | |
26 | +} |
@@ -26,8 +26,11 @@ | ||
26 | 26 | @Documented |
27 | 27 | public @interface StrutsTransaction { |
28 | 28 | |
29 | + /** トランザクションルックアップ名 */ | |
30 | + public abstract String lookup() default ""; | |
31 | + | |
29 | 32 | /** トランザクション管理クラス */ |
30 | - public abstract Class<? extends TransactionManager> transactionClass() default TransactionManager.class; | |
33 | + public abstract Class<? extends TransactionManager> transactionClass(); | |
31 | 34 | |
32 | 35 | /** トランザクション接続定義名前空間 */ |
33 | 36 | public abstract String namespace() default ""; |
@@ -75,69 +75,60 @@ | ||
75 | 75 | @Override |
76 | 76 | @Deprecated |
77 | 77 | public final ActionForward execute(final ActionMapping actionMapping, final ActionForm actionform, final HttpServletRequest request, final HttpServletResponse response) throws Exception { |
78 | - /* | |
79 | - * リクエスト情報デバッグ | |
80 | - */ | |
81 | - RequestUtil.debugRequest(request); | |
78 | + try { | |
79 | + /* | |
80 | + * リクエスト情報デバッグ | |
81 | + */ | |
82 | + RequestUtil.debugRequest(request); | |
82 | 83 | |
83 | - /* | |
84 | - * アクションコンテキスト生成 | |
85 | - */ | |
86 | - ActionContext<L, F> actionContext = new ActionContext<L, F>(); | |
87 | - actionContext.setAction(this); | |
88 | - actionContext.setActionMapping(actionMapping); | |
89 | - actionContext.setActionForm(actionform); | |
90 | - actionContext.setServletRequest(request); | |
91 | - actionContext.setServletResponse(response); | |
92 | - actionContext.setServletContext(super.getServlet().getServletContext()); | |
93 | - actionContext.setStartTime(System.currentTimeMillis()); | |
84 | + /* | |
85 | + * アクションコンテキスト生成 | |
86 | + */ | |
87 | + ActionContext<L, F> actionContext = new ActionContext<L, F>(); | |
88 | + actionContext.setAction(this); | |
89 | + actionContext.setActionMapping(actionMapping); | |
90 | + actionContext.setActionForm(actionform); | |
91 | + actionContext.setServletRequest(request); | |
92 | + actionContext.setServletResponse(response); | |
93 | + //actionContext.setServletContext(super.getServlet().getServletContext()); // Strutsパスが不正な場合にnullとなる | |
94 | + //actionContext.setServletContext(request.getServletContext()); // Servlet3.0以降でのインタフェース | |
95 | + actionContext.setServletContext(request.getSession(true).getServletContext()); | |
96 | + actionContext.setStartTime(System.currentTimeMillis()); | |
94 | 97 | |
95 | - /* | |
96 | - * アクションプロセッサー処理 | |
97 | - */ | |
98 | - AbstractActionProcess<L, F> actionProcess = new ActionProcessDefault<L, F>(); | |
99 | - try { | |
100 | - // アクションプロセス処理 | |
101 | - actionProcess.executeProcess(actionContext); | |
102 | - } catch (StrutsModuleApplicationException e) { | |
98 | + /* | |
99 | + * アクションプロセッサー処理 | |
100 | + */ | |
101 | + AbstractActionProcess<L, F> actionProcess = new ActionProcessDefault<L, F>(); | |
103 | 102 | try { |
103 | + // アクションプロセス処理 | |
104 | + actionProcess.executeProcess(actionContext); | |
105 | + } catch (StrutsModuleApplicationException e) { | |
104 | 106 | // アドオンモジュールアプリケーション例外ハンドル処理 |
107 | + //log.output(e, "FSTR09002"); | |
105 | 108 | actionProcess.handleStrutsModuleApplicationException(actionContext, e); |
106 | - } catch (Throwable e2) { | |
107 | - throw new ServletException(StringResource.getString("FSTR09002"), e2); | |
108 | - } | |
109 | - } catch (StrutsModuleCriticalException e) { | |
110 | - log.output(e, "FSTR09002"); | |
111 | - try { | |
109 | + } catch (StrutsModuleCriticalException e) { | |
112 | 110 | // アドオンモジュール致命的例外ハンドル処理 |
111 | + log.output(e, "FSTR09002"); | |
113 | 112 | actionProcess.handleStrutsCriticalModuleException(actionContext, e); |
114 | - } catch (Throwable e2) { | |
115 | - throw new ServletException(StringResource.getString("FSTR09002"), e2); | |
116 | - } | |
117 | - } catch (Throwable e) { | |
118 | - log.output(e, "FSTR09002"); | |
119 | - try { | |
113 | + } catch (Throwable e) { | |
120 | 114 | // アドオンモジュール以外の例外ハンドル処理 |
115 | + log.output(e, "FSTR09002"); | |
121 | 116 | actionProcess.handleThrowable(actionContext, e); |
122 | - } catch (Throwable e2) { | |
123 | - throw new ServletException(StringResource.getString("FSTR09002"), e2); | |
124 | - } | |
125 | - } finally { | |
126 | - try { | |
117 | + } finally { | |
127 | 118 | // アクションプロセス終了処理 |
128 | 119 | actionProcess.executeFinally(actionContext); |
129 | - } catch (Throwable e2) { | |
130 | - throw new ServletException(StringResource.getString("FSTR09003"), e2); | |
131 | 120 | } |
132 | - } | |
133 | 121 | |
134 | - // アクションフォーワード生成処理 | |
135 | - ActionForward actionForward = null; | |
136 | - if (actionContext.getForward() != null) { | |
137 | - actionForward = actionContext.getForward().createActionForward(actionContext); | |
122 | + // アクションフォーワード生成処理 | |
123 | + ActionForward actionForward = null; | |
124 | + if (actionContext.getForward() != null) { | |
125 | + actionForward = actionContext.getForward().createActionForward(actionContext); | |
126 | + } | |
127 | + | |
128 | + return actionForward; | |
129 | + } catch (Throwable e) { | |
130 | + throw new ServletException(StringResource.getString("FSTR00017"), e); | |
138 | 131 | } |
139 | - | |
140 | - return actionForward; | |
141 | 132 | } |
142 | 133 | |
143 | 134 | /** |
@@ -2,10 +2,12 @@ | ||
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | 4 | |
5 | +import org.phosphoresce.webcore.struts.annotation.StrutsForm; | |
6 | + | |
5 | 7 | /** |
6 | - * ダミーエンプティフォームクラス<br> | |
8 | + * ダミーフォームクラス<br> | |
7 | 9 | * <br> |
8 | - * サーブレットアクションモジュールが存在しないリクエストパス受領時のリクエストプロセッサーで返却されるダミーのアクションフォームとなります。<br> | |
10 | + * サーブレットアクションモジュールが存在しないリクエストパス受領時のリクエストプロセッサーで返却されるダミーのフォームとなります。<br> | |
9 | 11 | * |
10 | 12 | * @author Kitagawa<br> |
11 | 13 | * |
@@ -14,6 +16,7 @@ | ||
14 | 16 | * 2010/07/19 Kitagawa 新規作成 |
15 | 17 | *--> |
16 | 18 | */ |
19 | +@StrutsForm | |
17 | 20 | public final class DummyForm extends AbstractForm<Serializable> { |
18 | 21 | |
19 | 22 | /** |
@@ -8,8 +8,6 @@ | ||
8 | 8 | import java.text.DecimalFormat; |
9 | 9 | import java.text.MessageFormat; |
10 | 10 | import java.util.Iterator; |
11 | -import java.util.LinkedList; | |
12 | -import java.util.List; | |
13 | 11 | import java.util.ResourceBundle; |
14 | 12 | |
15 | 13 | import javax.servlet.ServletContext; |
@@ -23,15 +21,16 @@ | ||
23 | 21 | import org.apache.struts.action.ActionMessages; |
24 | 22 | import org.apache.struts.config.ModuleConfig; |
25 | 23 | import org.apache.struts.util.ModuleUtils; |
24 | +import org.phosphoresce.commons.util.ExceptionUtil; | |
26 | 25 | import org.phosphoresce.commons.util.ReflectionUtil; |
27 | 26 | import org.phosphoresce.commons.util.StringUtil; |
28 | 27 | import org.phosphoresce.webcore.Environment; |
29 | 28 | import org.phosphoresce.webcore.config.Config; |
30 | 29 | import org.phosphoresce.webcore.config.StringResource; |
31 | -import org.phosphoresce.webcore.jdbc.transaction.JDBCTransactionManager; | |
32 | 30 | import org.phosphoresce.webcore.struts.annotation.OneTimeField; |
33 | 31 | import org.phosphoresce.webcore.struts.annotation.StrutsMethod; |
34 | 32 | import org.phosphoresce.webcore.struts.annotation.StrutsMethod.ReflectFieldType; |
33 | +import org.phosphoresce.webcore.struts.annotation.StrutsTransaction; | |
35 | 34 | import org.phosphoresce.webcore.struts.exception.StrutsFormValidationException; |
36 | 35 | import org.phosphoresce.webcore.struts.exception.StrutsInvalidTokenException; |
37 | 36 | import org.phosphoresce.webcore.struts.exception.StrutsModuleApplicationException; |
@@ -38,8 +37,6 @@ | ||
38 | 37 | import org.phosphoresce.webcore.struts.exception.StrutsModuleCriticalException; |
39 | 38 | import org.phosphoresce.webcore.struts.exception.StrutsModuleException; |
40 | 39 | import org.phosphoresce.webcore.struts.exception.StrutsNoLoggedinException; |
41 | -import org.phosphoresce.webcore.struts.exception.StrutsNoSuchActionClassException; | |
42 | -import org.phosphoresce.webcore.struts.exception.StrutsNoSuchActionMethodException; | |
43 | 40 | import org.phosphoresce.webcore.struts.exception.StrutsProcessInternalException; |
44 | 41 | import org.phosphoresce.webcore.struts.exception.StrutsSessionTimeoutException; |
45 | 42 | import org.phosphoresce.webcore.struts.util.StrutsAnnotationUtil; |
@@ -101,12 +98,9 @@ | ||
101 | 98 | // ウィンドウセッションオブジェクト生成 |
102 | 99 | processCreateWindowSession(actionContext); |
103 | 100 | |
104 | - // アクションクラス存在チェック | |
105 | - processCheckActionClassExist(actionContext); | |
101 | + // クラス構成チェック | |
102 | + processCheckClassStructureExist(actionContext); | |
106 | 103 | |
107 | - // アクションメソッド存在チェック | |
108 | - processCheckActionMethodExist(actionContext); | |
109 | - | |
110 | 104 | // ウィンドウセッションアクセス時刻更新 |
111 | 105 | processUpdateWindowSessionTimestamp(actionContext); |
112 | 106 |
@@ -395,11 +389,10 @@ | ||
395 | 389 | } |
396 | 390 | |
397 | 391 | /** |
398 | - * リクエストされたパスに対応するアクションクラスが存在するかチェックします。<br> | |
399 | - * 但し、アクションターゲットが空(ルートURI)の場合はディフォルト遷移を行う為、エラーとしません。<br> | |
392 | + * リクエストされたパスに対応するクラス構造が正しいかチェックします。<br> | |
400 | 393 | * @param actionContext アクションコンテキストオブジェクト |
401 | 394 | */ |
402 | - protected void processCheckActionClassExist(ActionContext<L, F> actionContext) { | |
395 | + protected void processCheckClassStructureExist(ActionContext<L, F> actionContext) { | |
403 | 396 | // 妥当性チェック |
404 | 397 | validateActionContext(actionContext // |
405 | 398 | , true // モジュール環境オブジェクト必須フラグ |
@@ -423,40 +416,11 @@ | ||
423 | 416 | return; |
424 | 417 | } |
425 | 418 | |
426 | - // リクエストパスに対応するアクションクラスが存在しない場合はエラー | |
427 | - if (!StrutsUtil.isExistActionClass(actionPath)) { | |
428 | - throw new StrutsNoSuchActionClassException(); | |
429 | - } | |
430 | - } | |
419 | + // クラス構成チェック | |
420 | + StrutsUtil.checkClassStructure(actionPath); | |
431 | 421 | |
432 | - /** | |
433 | - * リクエストされたパスに対応するアノテーションが付与されたアクションメソッドが存在するかチェックします。<br> | |
434 | - * @param actionContext アクションコンテキストオブジェクト | |
435 | - */ | |
436 | - protected void processCheckActionMethodExist(ActionContext<L, F> actionContext) { | |
437 | - // 妥当性チェック | |
438 | - validateActionContext(actionContext // | |
439 | - , true // モジュール環境オブジェクト必須フラグ | |
440 | - , false // サーブレットコンテナオブジェクト必須フラグ | |
441 | - , false // セッションコンテナオブジェクト必須フラグ | |
442 | - , false // ウィンドウセッションコンテナオブジェクト必須フラグ | |
443 | - , false // メッセージコンテナオブジェクト必須フラグ | |
444 | - , false // トランザクションコンテナオブジェクト必須フラグ | |
445 | - , false // キャスト済みフォームオブジェクト必須フラグ | |
446 | - , false // フォワードオブジェクト必須フラグ | |
447 | - ); | |
448 | - | |
449 | - // リクエストパス情報取得(リクエストクエリが除外されたパス) | |
450 | - String actionPath = StrutsUtil.getRequestActionPath(actionContext.getServletRequest(), actionContext.getModuleConfig()); | |
451 | - | |
452 | - // アクションメソッドアノテーションが存在しない場合はエラー | |
453 | - StrutsMethod actionMethod = StrutsAnnotationUtil.getStrutsMethodAnnotation( // | |
454 | - actionContext.getServletRequest(), // | |
455 | - actionContext.getModuleConfig(), // | |
456 | - actionContext.getAction()); | |
457 | - if (actionMethod == null) { | |
458 | - throw new StrutsNoSuchActionMethodException(); | |
459 | - } | |
422 | + // クラスメソッド構成チェック | |
423 | + StrutsUtil.checkClassMethodStructure(actionPath); | |
460 | 424 | } |
461 | 425 | |
462 | 426 | /** |
@@ -598,7 +562,7 @@ | ||
598 | 562 | protected void processCreateTransactionManager(ActionContext<L, F> actionContext) { |
599 | 563 | // 妥当性チェック |
600 | 564 | validateActionContext(actionContext // |
601 | - , false // モジュール環境オブジェクト必須フラグ | |
565 | + , true // モジュール環境オブジェクト必須フラグ | |
602 | 566 | , false // サーブレットコンテナオブジェクト必須フラグ |
603 | 567 | , false // セッションコンテナオブジェクト必須フラグ |
604 | 568 | , false // ウィンドウセッションコンテナオブジェクト必須フラグ |
@@ -608,12 +572,33 @@ | ||
608 | 572 | , false // フォワードオブジェクト必須フラグ |
609 | 573 | ); |
610 | 574 | |
575 | + // アクションメソッドアノテーションが存在しない場合はチェック除外 | |
576 | + StrutsMethod actionMethod = StrutsAnnotationUtil.getStrutsMethodAnnotation( // | |
577 | + actionContext.getServletRequest(), // | |
578 | + actionContext.getModuleConfig(), // | |
579 | + actionContext.getAction()); | |
580 | + if (actionMethod == null) { | |
581 | + return; | |
582 | + } | |
583 | + | |
611 | 584 | // トランザクションコンテナ取得 |
612 | 585 | TransactionContainer transactionContainer = actionContext.getTransactionContainer(); |
613 | - | |
614 | - // トランザクションオブジェクト設定 | |
615 | - // TODO メソッドアノテーションで動的生成する | |
616 | - transactionContainer.add("test", new JDBCTransactionManager()); | |
586 | + try { | |
587 | + for (StrutsTransaction strutsTransaction : actionMethod.transactions()) { | |
588 | + String lookup = strutsTransaction.lookup(); | |
589 | + String namespace = strutsTransaction.namespace(); | |
590 | + Class<? extends TransactionManager> transactionManagerClass = strutsTransaction.transactionClass(); | |
591 | + TransactionManager transactionManager = null; | |
592 | + if (StringUtil.isEmpty(namespace)) { | |
593 | + transactionManager = transactionManagerClass.getConstructor(new Class[] {}).newInstance(new Object[] {}); | |
594 | + } else { | |
595 | + transactionManager = transactionManagerClass.getConstructor(new Class[] { String.class }).newInstance(new Object[] { namespace }); | |
596 | + } | |
597 | + transactionContainer.add(lookup, transactionManager); | |
598 | + } | |
599 | + } catch (Throwable e) { | |
600 | + throw new StrutsProcessInternalException("FSTR00016"); | |
601 | + } | |
617 | 602 | } |
618 | 603 | |
619 | 604 | /** |
@@ -1041,7 +1026,7 @@ | ||
1041 | 1026 | protected void processOpenTransaction(ActionContext<L, F> actionContext) { |
1042 | 1027 | // 妥当性チェック |
1043 | 1028 | validateActionContext(actionContext // |
1044 | - , true // モジュール環境オブジェクト必須フラグ | |
1029 | + , false // モジュール環境オブジェクト必須フラグ | |
1045 | 1030 | , false // サーブレットコンテナオブジェクト必須フラグ |
1046 | 1031 | , false // セッションコンテナオブジェクト必須フラグ |
1047 | 1032 | , false // ウィンドウセッションコンテナオブジェクト必須フラグ |
@@ -1051,19 +1036,8 @@ | ||
1051 | 1036 | , false // フォワードオブジェクト必須フラグ |
1052 | 1037 | ); |
1053 | 1038 | |
1054 | - // アクションメソッドアノテーションが存在しない場合は処理除外 | |
1055 | - StrutsMethod actionMethod = StrutsAnnotationUtil.getStrutsMethodAnnotation( // | |
1056 | - actionContext.getServletRequest(), // | |
1057 | - actionContext.getModuleConfig(), // | |
1058 | - actionContext.getAction()); | |
1059 | - if (actionMethod == null) { | |
1060 | - return; | |
1061 | - } | |
1062 | - | |
1063 | - // アクションメソッドアノテーションにトランザクション必要フラグが設定されている場合に処理 | |
1064 | - if (!actionMethod.transaction().transactionClass().equals(TransactionManager.class)) { | |
1065 | - actionContext.getTransactionContainer().open(); | |
1066 | - } | |
1039 | + // トランザクションコンテナオープン | |
1040 | + actionContext.getTransactionContainer().open(); | |
1067 | 1041 | } |
1068 | 1042 | |
1069 | 1043 | /** |
@@ -1209,7 +1183,7 @@ | ||
1209 | 1183 | protected void processCommitTransaction(ActionContext<L, F> actionContext) { |
1210 | 1184 | // 妥当性チェック |
1211 | 1185 | validateActionContext(actionContext // |
1212 | - , true // モジュール環境オブジェクト必須フラグ | |
1186 | + , false // モジュール環境オブジェクト必須フラグ | |
1213 | 1187 | , false // サーブレットコンテナオブジェクト必須フラグ |
1214 | 1188 | , false // セッションコンテナオブジェクト必須フラグ |
1215 | 1189 | , false // ウィンドウセッションコンテナオブジェクト必須フラグ |
@@ -1219,19 +1193,8 @@ | ||
1219 | 1193 | , false // フォワードオブジェクト必須フラグ |
1220 | 1194 | ); |
1221 | 1195 | |
1222 | - // アクションメソッドアノテーションが存在しない場合は処理除外 | |
1223 | - StrutsMethod actionMethod = StrutsAnnotationUtil.getStrutsMethodAnnotation( // | |
1224 | - actionContext.getServletRequest(), // | |
1225 | - actionContext.getModuleConfig(), // | |
1226 | - actionContext.getAction()); | |
1227 | - if (actionMethod == null) { | |
1228 | - return; | |
1229 | - } | |
1230 | - | |
1231 | - // アクションメソッドアノテーションにトランザクション必要フラグが設定されている場合に処理 | |
1232 | - if (!actionMethod.transaction().transactionClass().equals(TransactionManager.class)) { | |
1233 | - actionContext.getTransactionContainer().commit(); | |
1234 | - } | |
1196 | + // トランザクションコンテナコミット | |
1197 | + actionContext.getTransactionContainer().commit(); | |
1235 | 1198 | } |
1236 | 1199 | |
1237 | 1200 | /** |
@@ -1241,7 +1204,7 @@ | ||
1241 | 1204 | protected void processRollbackTransaction(ActionContext<L, F> actionContext) { |
1242 | 1205 | // 妥当性チェック |
1243 | 1206 | validateActionContext(actionContext // |
1244 | - , true // モジュール環境オブジェクト必須フラグ | |
1207 | + , false // モジュール環境オブジェクト必須フラグ | |
1245 | 1208 | , false // サーブレットコンテナオブジェクト必須フラグ |
1246 | 1209 | , false // セッションコンテナオブジェクト必須フラグ |
1247 | 1210 | , false // ウィンドウセッションコンテナオブジェクト必須フラグ |
@@ -1251,19 +1214,8 @@ | ||
1251 | 1214 | , false // フォワードオブジェクト必須フラグ |
1252 | 1215 | ); |
1253 | 1216 | |
1254 | - // アクションメソッドアノテーションが存在しない場合は処理除外 | |
1255 | - StrutsMethod actionMethod = StrutsAnnotationUtil.getStrutsMethodAnnotation( // | |
1256 | - actionContext.getServletRequest(), // | |
1257 | - actionContext.getModuleConfig(), // | |
1258 | - actionContext.getAction()); | |
1259 | - if (actionMethod == null) { | |
1260 | - return; | |
1261 | - } | |
1262 | - | |
1263 | - // アクションメソッドアノテーションにトランザクション必要フラグが設定されている場合に処理 | |
1264 | - if (!actionMethod.transaction().transactionClass().equals(TransactionManager.class)) { | |
1265 | - actionContext.getTransactionContainer().rollback(); | |
1266 | - } | |
1217 | + // トランザクションコンテナロールバック | |
1218 | + actionContext.getTransactionContainer().rollback(); | |
1267 | 1219 | } |
1268 | 1220 | |
1269 | 1221 | /** |
@@ -1273,7 +1225,7 @@ | ||
1273 | 1225 | protected void processCloseTransaction(ActionContext<L, F> actionContext) { |
1274 | 1226 | // 妥当性チェック |
1275 | 1227 | validateActionContext(actionContext // |
1276 | - , true // モジュール環境オブジェクト必須フラグ | |
1228 | + , false // モジュール環境オブジェクト必須フラグ | |
1277 | 1229 | , false // サーブレットコンテナオブジェクト必須フラグ |
1278 | 1230 | , false // セッションコンテナオブジェクト必須フラグ |
1279 | 1231 | , false // ウィンドウセッションコンテナオブジェクト必須フラグ |
@@ -1283,17 +1235,8 @@ | ||
1283 | 1235 | , false // フォワードオブジェクト必須フラグ |
1284 | 1236 | ); |
1285 | 1237 | |
1286 | - // アクションメソッドアノテーションが存在しない場合は処理除外 | |
1287 | - StrutsMethod actionMethod = StrutsAnnotationUtil.getStrutsMethodAnnotation( // | |
1288 | - actionContext.getServletRequest(), // | |
1289 | - actionContext.getModuleConfig(), // | |
1290 | - actionContext.getAction()); | |
1291 | - if (actionMethod == null) { | |
1292 | - return; | |
1293 | - } | |
1294 | - | |
1295 | - // アクションメソッドアノテーションにトランザクション必要フラグが設定されている場合に処理 | |
1296 | - if (!actionMethod.transaction().transactionClass().equals(TransactionManager.class)) { | |
1238 | + // トランザクションコンテナクローズ | |
1239 | + if (actionContext.getTransactionContainer().isOpened()) { | |
1297 | 1240 | actionContext.getTransactionContainer().close(); |
1298 | 1241 | } |
1299 | 1242 | } |
@@ -1307,27 +1250,37 @@ | ||
1307 | 1250 | // 妥当性チェック |
1308 | 1251 | validateActionContext(actionContext // |
1309 | 1252 | , false // モジュール環境オブジェクト必須フラグ |
1310 | - , true // サーブレットコンテナオブジェクト必須フラグ | |
1311 | - , true // セッションコンテナオブジェクト必須フラグ | |
1312 | - , true // ウィンドウセッションコンテナオブジェクト必須フラグ | |
1253 | + , false // サーブレットコンテナオブジェクト必須フラグ | |
1254 | + , false // セッションコンテナオブジェクト必須フラグ | |
1255 | + , false // ウィンドウセッションコンテナオブジェクト必須フラグ | |
1313 | 1256 | , false // メッセージコンテナオブジェクト必須フラグ |
1314 | 1257 | , false // トランザクションコンテナオブジェクト必須フラグ |
1315 | - , true // キャスト済みフォームオブジェクト必須フラグ | |
1258 | + , false // キャスト済みフォームオブジェクト必須フラグ | |
1316 | 1259 | , false // フォワードオブジェクト必須フラグ |
1317 | 1260 | ); |
1318 | 1261 | |
1319 | 1262 | // リクエストアトリビュート設定 |
1263 | + if (actionContext.getServletContainer() != null) { | |
1264 | + actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_PROCESSDATE, actionContext.getServletContainer().getProcessDate()); | |
1265 | + } | |
1320 | 1266 | actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_ENVIRONMENT, Environment.getMap()); |
1321 | 1267 | actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_CONFIG, Config.getMap()); |
1322 | 1268 | actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_REQUEST, actionContext.getServletRequest()); |
1323 | 1269 | actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_SESSION_CONTAINER, actionContext.getServletContainer()); |
1324 | 1270 | actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_WINDOW_SESSION_CONTAINER, actionContext.getWindowSessionContainer()); |
1325 | - actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_SCREEN_DATA, actionContext.getWindowSessionContainer().getScreenData()); | |
1271 | + if (actionContext.getWindowSessionContainer() != null) { | |
1272 | + actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_SCREEN_DATA, actionContext.getWindowSessionContainer().getScreenData()); | |
1273 | + } | |
1326 | 1274 | actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_FORM, actionContext.getCastedForm()); |
1327 | - actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_DOWNLOAD_ID, actionContext.getServletContainer().getDownloadId()); | |
1328 | - actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_DOWNLOAD_FILENAME, actionContext.getServletContainer().getDownloadName()); | |
1275 | + if (actionContext.getServletContainer() != null) { | |
1276 | + actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_DOWNLOAD_ID, actionContext.getServletContainer().getDownloadId()); | |
1277 | + } | |
1278 | + if (actionContext.getServletContainer() != null) { | |
1279 | + actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_DOWNLOAD_FILENAME, actionContext.getServletContainer().getDownloadName()); | |
1280 | + } | |
1329 | 1281 | if (throwable != null) { |
1330 | 1282 | actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_EXCEPTION, throwable); |
1283 | + actionContext.getServletRequest().setAttribute(REQUEST_ATTR_KEY_EXCEPTION_TRACE, ExceptionUtil.getStackTraceValue(throwable)); | |
1331 | 1284 | } |
1332 | 1285 | } |
1333 | 1286 |
@@ -1411,7 +1364,6 @@ | ||
1411 | 1364 | // メッセージ追加 |
1412 | 1365 | for (Iterator<String> iterator1 = messages.properties(); iterator1.hasNext();) { |
1413 | 1366 | String key = iterator1.next(); |
1414 | - List<String> buffer = new LinkedList<String>(); | |
1415 | 1367 | for (Iterator<ActionMessage> iterator2 = messages.get(key); iterator2.hasNext();) { |
1416 | 1368 | ActionMessage actionMessage = (ActionMessage) iterator2.next(); |
1417 | 1369 | // 重複メッセージ以外設定 |
@@ -6,6 +6,7 @@ | ||
6 | 6 | import javax.servlet.http.HttpServletRequest; |
7 | 7 | import javax.servlet.http.HttpServletResponse; |
8 | 8 | |
9 | +import org.apache.struts.action.Action; | |
9 | 10 | import org.apache.struts.action.ActionForm; |
10 | 11 | import org.apache.struts.action.ActionForward; |
11 | 12 | import org.apache.struts.action.ActionMapping; |
@@ -57,8 +58,8 @@ | ||
57 | 58 | // アクションパス取得 |
58 | 59 | String actionPath = StrutsUtil.getRequestActionPath(request, moduleConfig); |
59 | 60 | |
60 | - // 指定されたリクエストパスに合致するアクションフォームが存在しない場合はダミーのフォームを返却 | |
61 | - if (!StrutsUtil.isExistFormClass(actionPath)) { | |
61 | + // 指定されたリクエストパスに合致するフォームが存在しない場合はダミーのフォームを返却 | |
62 | + if (StrutsUtil.getFormClass(actionPath) == null) { | |
62 | 63 | return new DummyForm(); |
63 | 64 | } |
64 | 65 |
@@ -80,9 +81,28 @@ | ||
80 | 81 | } |
81 | 82 | |
82 | 83 | // 親クラスメソッドよりフォームオブジェクトを生成する |
83 | - ActionForm form = super.processActionForm(request, response, mapping); | |
84 | + return super.processActionForm(request, response, mapping); | |
85 | + } catch (Throwable e) { | |
86 | + throw new StrutsProcessInternalException("FSTR06003", e); | |
87 | + } | |
88 | + } | |
84 | 89 | |
85 | - return form; | |
90 | + /** | |
91 | + * リクエスト処理時のActionインスタンス生成処理を実行します。<br> | |
92 | + * @see org.apache.struts.action.RequestProcessor#processActionCreate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.action.ActionMapping) | |
93 | + */ | |
94 | + @Override | |
95 | + protected Action processActionCreate(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) throws IOException { | |
96 | + try { | |
97 | + // アクションパス取得 | |
98 | + String actionPath = StrutsUtil.getRequestActionPath(request, moduleConfig); | |
99 | + | |
100 | + // 指定されたリクエストパスに合致するアクションが存在しない場合はダミーのアクションを返却 | |
101 | + if (StrutsUtil.getActionClass(actionPath) == null) { | |
102 | + return new DummyAction(); | |
103 | + } | |
104 | + | |
105 | + return super.processActionCreate(request, response, mapping); | |
86 | 106 | } catch (Throwable e) { |
87 | 107 | throw new StrutsProcessInternalException("FSTR06003", e); |
88 | 108 | } |
@@ -94,6 +114,12 @@ | ||
94 | 114 | * @see org.apache.struts.action.RequestProcessor#processException(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Exception, org.apache.struts.action.ActionForm, org.apache.struts.action.ActionMapping) |
95 | 115 | */ |
96 | 116 | protected ActionForward processException(HttpServletRequest request, HttpServletResponse response, Exception exception, ActionForm form, ActionMapping mapping) throws IOException, ServletException { |
97 | - throw new ServletException(exception); | |
117 | + if (exception instanceof ServletException) { | |
118 | + throw (ServletException) exception; | |
119 | + } else if (exception instanceof IOException) { | |
120 | + throw (IOException) exception; | |
121 | + } else { | |
122 | + throw new ServletException(exception); | |
123 | + } | |
98 | 124 | } |
99 | 125 | } |
@@ -0,0 +1,35 @@ | ||
1 | +package org.phosphoresce.webcore.struts.action; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | + | |
5 | +import org.phosphoresce.webcore.struts.annotation.StrutsAction; | |
6 | + | |
7 | +/** | |
8 | + * ダミーアクションクラス<br> | |
9 | + * <br> | |
10 | + * サーブレットアクションモジュールが存在しないリクエストパス受領時のリクエストプロセッサーで返却されるダミーのアクションとなります。<br> | |
11 | + * | |
12 | + * @author Kitagawa<br> | |
13 | + * | |
14 | + *<!-- | |
15 | + * 更新日 更新者 更新内容 | |
16 | + * 2010/07/19 Kitagawa 新規作成 | |
17 | + *--> | |
18 | + */ | |
19 | +@StrutsAction | |
20 | +public final class DummyAction extends AbstractAction<Serializable, DummyForm> { | |
21 | + | |
22 | + /** | |
23 | + * 初期表示処理を行います。<br> | |
24 | + * @param form ActionFormオブジェクト | |
25 | + * @param session セッションコンテナオブジェクト | |
26 | + * @param servlet サーブレットコンテナオブジェクト | |
27 | + * @return 遷移先パス | |
28 | + * @throws Throwable 処理中に補足されない予期せぬエラーが発生した場合にスローされます | |
29 | + * @see org.phosphoresce.webcore.struts.action.AbstractAction#index(org.phosphoresce.webcore.struts.action.AbstractForm, org.phosphoresce.webcore.struts.action.WindowSessionContainer, org.phosphoresce.webcore.struts.action.ServletContainer) | |
30 | + */ | |
31 | + @Override | |
32 | + public Forward index(DummyForm form, WindowSessionContainer<Serializable> session, ServletContainer<Serializable> servlet) throws Throwable { | |
33 | + return new Forward(); | |
34 | + } | |
35 | +} |
@@ -3,8 +3,6 @@ | ||
3 | 3 | import java.io.Serializable; |
4 | 4 | import java.lang.reflect.Method; |
5 | 5 | import java.util.Iterator; |
6 | -import java.util.LinkedList; | |
7 | -import java.util.List; | |
8 | 6 | |
9 | 7 | import javax.servlet.http.HttpServletRequest; |
10 | 8 |
@@ -12,6 +10,8 @@ | ||
12 | 10 | import org.apache.struts.action.ActionMessages; |
13 | 11 | import org.apache.struts.action.RequestProcessor; |
14 | 12 | import org.apache.struts.config.ModuleConfig; |
13 | +import org.phosphoresce.commons.util.AnnotationUtil; | |
14 | +import org.phosphoresce.commons.util.ArrayUtil; | |
15 | 15 | import org.phosphoresce.commons.util.ReflectionUtil; |
16 | 16 | import org.phosphoresce.commons.util.StringUtil; |
17 | 17 | import org.phosphoresce.webcore.config.Config; |
@@ -20,8 +20,15 @@ | ||
20 | 20 | import org.phosphoresce.webcore.struts.action.AbstractAction; |
21 | 21 | import org.phosphoresce.webcore.struts.action.AbstractForm; |
22 | 22 | import org.phosphoresce.webcore.struts.action.AbstractLogic; |
23 | +import org.phosphoresce.webcore.struts.action.ScreenSession; | |
23 | 24 | import org.phosphoresce.webcore.struts.action.ServletContainer; |
24 | 25 | import org.phosphoresce.webcore.struts.action.WindowSessionContainer; |
26 | +import org.phosphoresce.webcore.struts.annotation.StrutsAction; | |
27 | +import org.phosphoresce.webcore.struts.annotation.StrutsForm; | |
28 | +import org.phosphoresce.webcore.struts.annotation.StrutsLogic; | |
29 | +import org.phosphoresce.webcore.struts.annotation.StrutsMethod; | |
30 | +import org.phosphoresce.webcore.struts.annotation.StrutsSession; | |
31 | +import org.phosphoresce.webcore.struts.annotation.StrutsUtility; | |
25 | 32 | import org.phosphoresce.webcore.struts.exception.StrutsProcessInternalException; |
26 | 33 | |
27 | 34 | /** |
@@ -212,7 +219,6 @@ | ||
212 | 219 | * @return リクエスト昨日 |
213 | 220 | */ |
214 | 221 | public static String getRequestFunction(String actionPath) { |
215 | - String function = EMPTY_STRING; | |
216 | 222 | if (StringUtil.isEmpty(actionPath)) { |
217 | 223 | throw new StrutsProcessInternalException("FSTR00006", new Object[] { actionPath }); |
218 | 224 | } |
@@ -258,26 +264,6 @@ | ||
258 | 264 | } |
259 | 265 | |
260 | 266 | /** |
261 | - * 指定されたアクションパスのアクションクラスが存在するか判定します。<br> | |
262 | - * @param actionPath アクションパス | |
263 | - * @return アクションクラスが存在する場合にtrueを返却 | |
264 | - */ | |
265 | - public static boolean isExistActionClass(String actionPath) { | |
266 | - Class<? extends AbstractAction<? extends Serializable, AbstractForm<? extends Serializable>>> clazz = getActionClass(actionPath); | |
267 | - return clazz != null; | |
268 | - } | |
269 | - | |
270 | - /** | |
271 | - * 指定されたアクションパスのフォームクラスが存在するか判定します。<br> | |
272 | - * @param actionPath プロセスパス | |
273 | - * @return フォームクラスが存在する場合にtrueを返却 | |
274 | - */ | |
275 | - public static boolean isExistFormClass(String actionPath) { | |
276 | - Class<? extends AbstractForm<? extends Serializable>> clazz = getFormClass(actionPath); | |
277 | - return clazz != null; | |
278 | - } | |
279 | - | |
280 | - /** | |
281 | 267 | * 指定されたアクションパスの定数インタフェースクラス名(SimpleName)を取得します。<br> |
282 | 268 | * @param actionPath アクションパス |
283 | 269 | * @return 定数インタフェースクラス名(SimpleName) |
@@ -567,6 +553,9 @@ | ||
567 | 553 | Class<? extends AbstractAction<? extends Serializable, AbstractForm<? extends Serializable>>> actionClass = getActionClass(actionPath); |
568 | 554 | Class<? extends AbstractForm<? extends Serializable>> formClass = getFormClass(actionPath); |
569 | 555 | String methodName = getRequestFunctionMethod(actionPath); |
556 | + if (actionClass == null) { | |
557 | + return null; | |
558 | + } | |
570 | 559 | Method method = ReflectionUtil.getMethod(actionClass, methodName, formClass, WindowSessionContainer.class, ServletContainer.class); |
571 | 560 | return method; |
572 | 561 | } |
@@ -585,8 +574,6 @@ | ||
585 | 574 | for (@SuppressWarnings("unchecked") |
586 | 575 | Iterator<String> iterator1 = savedMessages.properties(); iterator1.hasNext();) { |
587 | 576 | String key = iterator1.next(); |
588 | - List<String> buffer = new LinkedList<String>(); | |
589 | - | |
590 | 577 | for (@SuppressWarnings("unchecked") |
591 | 578 | Iterator<ActionMessage> iterator2 = savedMessages.get(key); iterator2.hasNext();) { |
592 | 579 | ActionMessage saveedMessage = (ActionMessage) iterator2.next(); |
@@ -624,4 +611,101 @@ | ||
624 | 611 | |
625 | 612 | return false; |
626 | 613 | } |
614 | + | |
615 | + /** | |
616 | + * 指定されたアクションパスの各種機能クラスの構成が不正でないか判定します。<br> | |
617 | + * 不正な場合は例外がスローされます。<br> | |
618 | + * @param actionPath アクションパス | |
619 | + */ | |
620 | + public static void checkClassStructure(String actionPath) { | |
621 | + Class<?> constantsClass = getConstantsClass(actionPath); | |
622 | + Class<? extends AbstractAction<? extends Serializable, AbstractForm<? extends Serializable>>> actionClass = getActionClass(actionPath); | |
623 | + Class<? extends AbstractForm<? extends Serializable>> formClass = getFormClass(actionPath); | |
624 | + Class<? extends AbstractLogic<? extends Serializable>> logicClass = getLogicClass(actionPath); | |
625 | + Class<?> sessionClass = getSessionClass(actionPath); | |
626 | + Class<?> utilClass = getUtilClass(actionPath); | |
627 | + | |
628 | + /* | |
629 | + * クラス存在チェック | |
630 | + */ | |
631 | + if (constantsClass == null) { | |
632 | + throw new StrutsProcessInternalException("FSTR00010", new Object[] { getConstantsClassSimpleName(actionPath) }); | |
633 | + } | |
634 | + if (actionClass == null) { | |
635 | + throw new StrutsProcessInternalException("FSTR00010", new Object[] { getActionClassSimpleName(actionPath) }); | |
636 | + } | |
637 | + if (formClass == null) { | |
638 | + throw new StrutsProcessInternalException("FSTR00010", new Object[] { getFormClassSimpleName(actionPath) }); | |
639 | + } | |
640 | + if (logicClass == null) { | |
641 | + throw new StrutsProcessInternalException("FSTR00010", new Object[] { getLogicClassSimpleName(actionPath) }); | |
642 | + } | |
643 | + if (sessionClass == null) { | |
644 | + throw new StrutsProcessInternalException("FSTR00010", new Object[] { getSessionClassSimpleName(actionPath) }); | |
645 | + } | |
646 | + if (utilClass == null) { | |
647 | + throw new StrutsProcessInternalException("FSTR00010", new Object[] { getUtilClassSimpleName(actionPath) }); | |
648 | + } | |
649 | + | |
650 | + /* | |
651 | + * インタフェース実装チェック | |
652 | + */ | |
653 | + if (!ArrayUtil.contains(actionClass.getInterfaces(), constantsClass)) { | |
654 | + throw new StrutsProcessInternalException("FSTR00011", new Object[] { getActionClassSimpleName(actionPath) }); | |
655 | + } | |
656 | + if (!ArrayUtil.contains(formClass.getInterfaces(), constantsClass)) { | |
657 | + throw new StrutsProcessInternalException("FSTR00011", new Object[] { getFormClassSimpleName(actionPath) }); | |
658 | + } | |
659 | + if (!ArrayUtil.contains(logicClass.getInterfaces(), constantsClass)) { | |
660 | + throw new StrutsProcessInternalException("FSTR00011", new Object[] { getLogicClassSimpleName(actionPath) }); | |
661 | + } | |
662 | + if (!ArrayUtil.contains(sessionClass.getInterfaces(), constantsClass)) { | |
663 | + throw new StrutsProcessInternalException("FSTR00011", new Object[] { getSessionClassSimpleName(actionPath) }); | |
664 | + } | |
665 | + if (!ArrayUtil.contains(utilClass.getInterfaces(), constantsClass)) { | |
666 | + throw new StrutsProcessInternalException("FSTR00011", new Object[] { getUtilClassSimpleName(actionPath) }); | |
667 | + } | |
668 | + if (!ArrayUtil.contains(sessionClass.getInterfaces(), ScreenSession.class)) { | |
669 | + throw new StrutsProcessInternalException("FSTR00012", new Object[] { getSessionClassSimpleName(actionPath) }); | |
670 | + } | |
671 | + | |
672 | + /* | |
673 | + * アノテーションチェック | |
674 | + */ | |
675 | + if (AnnotationUtil.getClassAnnotation(StrutsAction.class, actionClass) == null) { | |
676 | + throw new StrutsProcessInternalException("FSTR00013", new Object[] { getActionClassSimpleName(actionPath) }); | |
677 | + } | |
678 | + if (AnnotationUtil.getClassAnnotation(StrutsForm.class, formClass) == null) { | |
679 | + throw new StrutsProcessInternalException("FSTR00013", new Object[] { getFormClassSimpleName(actionPath) }); | |
680 | + } | |
681 | + if (AnnotationUtil.getClassAnnotation(StrutsLogic.class, logicClass) == null) { | |
682 | + throw new StrutsProcessInternalException("FSTR00013", new Object[] { getLogicClassSimpleName(actionPath) }); | |
683 | + } | |
684 | + if (AnnotationUtil.getClassAnnotation(StrutsSession.class, sessionClass) == null) { | |
685 | + throw new StrutsProcessInternalException("FSTR00013", new Object[] { getSessionClassSimpleName(actionPath) }); | |
686 | + } | |
687 | + if (AnnotationUtil.getClassAnnotation(StrutsUtility.class, utilClass) == null) { | |
688 | + throw new StrutsProcessInternalException("FSTR00013", new Object[] { getUtilClassSimpleName(actionPath) }); | |
689 | + } | |
690 | + } | |
691 | + | |
692 | + /** | |
693 | + * 指定されたアクションパスのクラスメソッド構成が不正でないか判定します。<br> | |
694 | + * 不正な場合は例外がスローされます。<br> | |
695 | + * @param actionPath アクションパス | |
696 | + */ | |
697 | + public static void checkClassMethodStructure(String actionPath) { | |
698 | + String methodName = getRequestFunctionMethod(actionPath); | |
699 | + Method method = getActionMethod(actionPath); | |
700 | + | |
701 | + if (StringUtil.isEmpty(methodName)) { | |
702 | + return; // メソッド名未指定の場合はディフォルト遷移させるのでここではチェック除外 | |
703 | + } | |
704 | + if (method == null) { | |
705 | + throw new StrutsProcessInternalException("FSTR00014", new Object[] { getActionClassSimpleName(actionPath), methodName }); | |
706 | + } | |
707 | + if (method.getAnnotation(StrutsMethod.class) == null) { | |
708 | + throw new StrutsProcessInternalException("FSTR00015", new Object[] { getActionClassSimpleName(actionPath), methodName }); | |
709 | + } | |
710 | + } | |
627 | 711 | } |
@@ -97,11 +97,7 @@ | ||
97 | 97 | if (method == null) { |
98 | 98 | return null; |
99 | 99 | } |
100 | - StrutsMethod strutsActionMethod = method.getAnnotation(StrutsMethod.class); | |
101 | - if (strutsActionMethod == null) { | |
102 | - throw new StrutsProcessInternalException("FSTR00005", new Object[] { method.getName() }); | |
103 | - } | |
104 | - return strutsActionMethod; | |
100 | + return method.getAnnotation(StrutsMethod.class); | |
105 | 101 | } |
106 | 102 | |
107 | 103 | /** |
@@ -1,24 +0,0 @@ | ||
1 | -package org.phosphoresce.webcore.struts.exception; | |
2 | - | |
3 | -/** | |
4 | - * サーブレットアクションクラス非存在例外クラス<br> | |
5 | - * <br> | |
6 | - * 当クラスはアクション処理時対象のアクションクラスが存在しなかった場合にスローされます。<br> | |
7 | - * アドオンモジュールレベルで致命的な例外として扱われます。<br> | |
8 | - * | |
9 | - * @author Kitagawa<br> | |
10 | - * | |
11 | - *<!-- | |
12 | - * 更新日 更新者 更新内容 | |
13 | - * 2010/07/19 Kitagawa 新規作成 | |
14 | - *--> | |
15 | - */ | |
16 | -public class StrutsNoSuchActionClassException extends StrutsModuleCriticalException { | |
17 | - | |
18 | - /** | |
19 | - * コンストラクタ<br> | |
20 | - */ | |
21 | - public StrutsNoSuchActionClassException() { | |
22 | - super(); | |
23 | - } | |
24 | -} |
@@ -1,24 +0,0 @@ | ||
1 | -package org.phosphoresce.webcore.struts.exception; | |
2 | - | |
3 | -/** | |
4 | - * サーブレットアクションメソッド非存在例外クラス<br> | |
5 | - * <br> | |
6 | - * 当クラスはアクション処理時対象のアクションメソッドが存在しなかった場合にスローされます。<br> | |
7 | - * アドオンモジュールレベルで致命的な例外として扱われます。<br> | |
8 | - * | |
9 | - * @author Kitagawa<br> | |
10 | - * | |
11 | - *<!-- | |
12 | - * 更新日 更新者 更新内容 | |
13 | - * 2010/07/19 Kitagawa 新規作成 | |
14 | - *--> | |
15 | - */ | |
16 | -public class StrutsNoSuchActionMethodException extends StrutsModuleCriticalException { | |
17 | - | |
18 | - /** | |
19 | - * コンストラクタ<br> | |
20 | - */ | |
21 | - public StrutsNoSuchActionMethodException() { | |
22 | - super(); | |
23 | - } | |
24 | -} |
@@ -68,7 +68,7 @@ | ||
68 | 68 | forward.setRedirect(false); |
69 | 69 | } else { |
70 | 70 | forward = new Forward(); |
71 | - forward.setPath(actionContext.getServletRequest().getServletPath() + "/" + Config.getString(ConfigName.COMMON_CHARSET_DEFAULT)); | |
71 | + forward.setPath(actionContext.getServletRequest().getServletPath() + "/" + Config.getString(StrutsConfigNames.STRUTS_ACTION_DEFAULT)); | |
72 | 72 | forward.setRedirect(false); |
73 | 73 | } |
74 | 74 | return forward; |
@@ -2,7 +2,6 @@ | ||
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | 4 | |
5 | -import org.phosphoresce.webcore.ConfigName; | |
6 | 5 | import org.phosphoresce.webcore.config.Config; |
7 | 6 | import org.phosphoresce.webcore.struts.StrutsConfigNames; |
8 | 7 | import org.phosphoresce.webcore.struts.action.AbstractForm; |
@@ -68,7 +67,7 @@ | ||
68 | 67 | forward.setRedirect(false); |
69 | 68 | } else { |
70 | 69 | forward = new Forward(); |
71 | - forward.setPath(actionContext.getServletRequest().getServletPath() + "/" + Config.getString(ConfigName.COMMON_CHARSET_DEFAULT)); | |
70 | + forward.setPath(actionContext.getServletRequest().getServletPath() + "/" + Config.getString(StrutsConfigNames.STRUTS_ACTION_DEFAULT)); | |
72 | 71 | forward.setRedirect(false); |
73 | 72 | } |
74 | 73 | return forward; |
@@ -2,7 +2,6 @@ | ||
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | 4 | |
5 | -import org.phosphoresce.webcore.ConfigName; | |
6 | 5 | import org.phosphoresce.webcore.config.Config; |
7 | 6 | import org.phosphoresce.webcore.struts.StrutsConfigNames; |
8 | 7 | import org.phosphoresce.webcore.struts.action.AbstractForm; |
@@ -62,13 +61,9 @@ | ||
62 | 61 | Forward forward = null; |
63 | 62 | if (actionContext.isJSONReuqest()) { |
64 | 63 | forward = null; |
65 | - } else if (actionContext.isPopupRequest()) { | |
66 | - forward = new Forward(); | |
67 | - forward.setPath(JSP_MESSAGE_PAGE); | |
68 | - forward.setRedirect(false); | |
69 | 64 | } else { |
70 | 65 | forward = new Forward(); |
71 | - forward.setPath(actionContext.getServletRequest().getServletPath() + "/" + Config.getString(ConfigName.COMMON_CHARSET_DEFAULT)); | |
66 | + forward.setPath(actionContext.getServletRequest().getServletPath() + "/" + Config.getString(StrutsConfigNames.STRUTS_ACTION_DEFAULT)); | |
72 | 67 | forward.setRedirect(false); |
73 | 68 | } |
74 | 69 | return forward; |
@@ -20,7 +20,7 @@ | ||
20 | 20 | *--> |
21 | 21 | */ |
22 | 22 | @StrutsAction |
23 | -public class C00001Action extends SampleAction { | |
23 | +public class C00001Action extends SampleAction implements C00001Constants { | |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @see org.phosphoresce.webcore.struts.action.AbstractAction#index(org.phosphoresce.webcore.struts.action.AbstractForm, org.phosphoresce.webcore.struts.action.WindowSessionContainer, org.phosphoresce.webcore.struts.action.ServletContainer) |
@@ -2,6 +2,7 @@ | ||
2 | 2 | |
3 | 3 | import org.phosphoresce.webcore.hibernate4.model.SMUser; |
4 | 4 | import org.phosphoresce.webcore.struts.action.ServletContainer; |
5 | +import org.phosphoresce.webcore.struts.annotation.StrutsLogic; | |
5 | 6 | import org.phosphoresce.webcore.struts.sample.common.action.SampleLogic; |
6 | 7 | |
7 | 8 | /** |
@@ -14,6 +15,7 @@ | ||
14 | 15 | * 2012/07/03 Kitagawa 新規作成 |
15 | 16 | *--> |
16 | 17 | */ |
18 | +@StrutsLogic | |
17 | 19 | public class C00001Logic extends SampleLogic implements C00001Constants { |
18 | 20 | |
19 | 21 | /** |
@@ -1,6 +1,6 @@ | ||
1 | 1 | package org.phosphoresce.webcore.struts.sample.function.C00001; |
2 | 2 | |
3 | -import org.phosphoresce.webcore.struts.sample.common.action.SampleConstants; | |
3 | +import org.phosphoresce.webcore.struts.annotation.StrutsUtility; | |
4 | 4 | |
5 | 5 | /** |
6 | 6 | * 共通機能ユーティリティクラス<br> |
@@ -12,5 +12,6 @@ | ||
12 | 12 | * 2012/07/03 Kitagawa 新規作成 |
13 | 13 | *--> |
14 | 14 | */ |
15 | -public class C00001Util implements SampleConstants { | |
15 | +@StrutsUtility | |
16 | +public class C00001Util implements C00001Constants { | |
16 | 17 | } |
@@ -20,7 +20,7 @@ | ||
20 | 20 | *--> |
21 | 21 | */ |
22 | 22 | @StrutsForm(scope = "request") |
23 | -public class C00001Form extends SampleForm { | |
23 | +public class C00001Form extends SampleForm implements C00001Constants { | |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @see org.phosphoresce.webcore.struts.action.AbstractForm#reset(org.phosphoresce.webcore.struts.action.ServletContainer, org.phosphoresce.webcore.struts.action.WindowSessionContainer) |
@@ -1,7 +1,7 @@ | ||
1 | 1 | package org.phosphoresce.webcore.struts.sample.function.C00001; |
2 | 2 | |
3 | 3 | import org.phosphoresce.webcore.struts.action.ScreenSession; |
4 | -import org.phosphoresce.webcore.struts.sample.common.action.SampleConstants; | |
4 | +import org.phosphoresce.webcore.struts.annotation.StrutsSession; | |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * 共通機能セッションクラス<br> |
@@ -13,5 +13,6 @@ | ||
13 | 13 | * 2012/07/18 Kitagawa 新規作成 |
14 | 14 | *--> |
15 | 15 | */ |
16 | -public class C00001Session implements ScreenSession, SampleConstants { | |
16 | +@StrutsSession | |
17 | +public class C00001Session implements ScreenSession, C00001Constants { | |
17 | 18 | } |
@@ -1,39 +0,0 @@ | ||
1 | -package org.phosphoresce.webcore.struts.sample.function.FS00001; | |
2 | - | |
3 | -import org.phosphoresce.webcore.hibernate4.model.SMUser; | |
4 | -import org.phosphoresce.webcore.struts.action.ServletContainer; | |
5 | -import org.phosphoresce.webcore.struts.action.WindowSessionContainer; | |
6 | -import org.phosphoresce.webcore.struts.sample.common.action.SampleForm; | |
7 | - | |
8 | -/** | |
9 | - * サンプル機能フォームクラス(ログイン画面)<br> | |
10 | - * | |
11 | - * @author Kitagawa<br> | |
12 | - * | |
13 | - *<!-- | |
14 | - * 更新日 更新者 更新内容 | |
15 | - * 2010/07/03 Kitagawa 新規作成 | |
16 | - *--> | |
17 | - */ | |
18 | -public class _FS00001Form extends SampleForm { | |
19 | - | |
20 | - /** | |
21 | - * フォームオブジェクトをリセットします。<br> | |
22 | - * @param servlet サーブレットコンテナオブジェクト | |
23 | - * @param session ウィンドウセッションオブジェクト | |
24 | - * @see org.phosphoresce.webcore.struts.action.AbstractForm#reset(org.phosphoresce.webcore.struts.action.ServletContainer, org.phosphoresce.webcore.struts.action.WindowSessionContainer) | |
25 | - */ | |
26 | - @Override | |
27 | - public void reset(ServletContainer<SMUser> servlet, WindowSessionContainer<SMUser> session) { | |
28 | - } | |
29 | - | |
30 | - /** | |
31 | - * フォームオブジェクトを初期化します。<br> | |
32 | - * @param servlet サーブレットコンテナオブジェクト | |
33 | - * @param session ウィンドウセッションオブジェクト | |
34 | - * @see org.phosphoresce.webcore.struts.action.AbstractForm#init(org.phosphoresce.webcore.struts.action.ServletContainer, org.phosphoresce.webcore.struts.action.WindowSessionContainer) | |
35 | - */ | |
36 | - @Override | |
37 | - public void init(ServletContainer<SMUser> servlet, WindowSessionContainer<SMUser> session) { | |
38 | - } | |
39 | -} |
@@ -0,0 +1,14 @@ | ||
1 | +package org.phosphoresce.webcore.struts.sample.function.FS00001; | |
2 | + | |
3 | +/** | |
4 | + * サンプル機能定数インタフェース(ログイン画面)<br> | |
5 | + * | |
6 | + * @author Kitagawa<br> | |
7 | + * | |
8 | + *<!-- | |
9 | + * 更新日 更新者 更新内容 | |
10 | + * 2010/07/03 Kitagawa 新規作成 | |
11 | + *--> | |
12 | + */ | |
13 | +public interface FS00001Constants { | |
14 | +} |
@@ -5,6 +5,7 @@ | ||
5 | 5 | import org.phosphoresce.webcore.struts.action.ServletContainer; |
6 | 6 | import org.phosphoresce.webcore.struts.action.WindowSessionContainer; |
7 | 7 | import org.phosphoresce.webcore.struts.annotation.StrutsAction; |
8 | +import org.phosphoresce.webcore.struts.annotation.StrutsMethod; | |
8 | 9 | import org.phosphoresce.webcore.struts.sample.common.action.SampleAction; |
9 | 10 | import org.phosphoresce.webcore.struts.sample.common.action.SampleForm; |
10 | 11 |
@@ -19,7 +20,7 @@ | ||
19 | 20 | *--> |
20 | 21 | */ |
21 | 22 | @StrutsAction |
22 | -public class FS00001Action extends SampleAction { | |
23 | +public class FS00001Action extends SampleAction implements FS00001Constants { | |
23 | 24 | |
24 | 25 | /** |
25 | 26 | * 初期表示処理を行います。<br> |
@@ -31,7 +32,24 @@ | ||
31 | 32 | * @see org.phosphoresce.webcore.struts.action.AbstractAction#index(org.phosphoresce.webcore.struts.action.AbstractForm, org.phosphoresce.webcore.struts.action.WindowSessionContainer, org.phosphoresce.webcore.struts.action.ServletContainer) |
32 | 33 | */ |
33 | 34 | @Override |
35 | + @StrutsMethod(checkSesion = false, checkLogin = false) | |
34 | 36 | public Forward index(SampleForm form, WindowSessionContainer<SMUser> session, ServletContainer<SMUser> servlet) throws Throwable { |
35 | - return new Forward(); | |
37 | + return new Forward("FS00001.jsp"); | |
36 | 38 | } |
39 | + | |
40 | + /** | |
41 | + * 例外発生テスト処理を行います。<br> | |
42 | + * @param form ActionFormオブジェクト | |
43 | + * @param session セッションコンテナオブジェクト | |
44 | + * @param servlet サーブレットコンテナオブジェクト | |
45 | + * @return 遷移先パス | |
46 | + * @throws Throwable 処理中に補足されない予期せぬエラーが発生した場合にスローされます | |
47 | + */ | |
48 | + @StrutsMethod(checkSesion = false, checkLogin = false) | |
49 | + public Forward testException(SampleForm form, WindowSessionContainer<SMUser> session, ServletContainer<SMUser> servlet) throws Throwable { | |
50 | + if (true) { | |
51 | + throw new Exception("テスト例外発生"); | |
52 | + } | |
53 | + return null; | |
54 | + } | |
37 | 55 | } |
@@ -0,0 +1,17 @@ | ||
1 | +package org.phosphoresce.webcore.struts.sample.function.FS00001; | |
2 | + | |
3 | +import org.phosphoresce.webcore.struts.annotation.StrutsUtility; | |
4 | + | |
5 | +/** | |
6 | + * サンプル機能ユーティリティクラス(ログイン画面)<br> | |
7 | + * | |
8 | + * @author Kitagawa<br> | |
9 | + * | |
10 | + *<!-- | |
11 | + * 更新日 更新者 更新内容 | |
12 | + * 2010/07/03 Kitagawa 新規作成 | |
13 | + *--> | |
14 | + */ | |
15 | +@StrutsUtility | |
16 | +public class FS00001Util implements FS00001Constants { | |
17 | +} |
@@ -0,0 +1,28 @@ | ||
1 | +package org.phosphoresce.webcore.struts.sample.function.FS00001; | |
2 | + | |
3 | +import org.phosphoresce.webcore.hibernate4.model.SMUser; | |
4 | +import org.phosphoresce.webcore.struts.action.ServletContainer; | |
5 | +import org.phosphoresce.webcore.struts.annotation.StrutsLogic; | |
6 | +import org.phosphoresce.webcore.struts.sample.common.action.SampleLogic; | |
7 | + | |
8 | +/** | |
9 | + * サンプル機能ロジッククラス(ログイン画面)<br> | |
10 | + * | |
11 | + * @author Kitagawa<br> | |
12 | + * | |
13 | + *<!-- | |
14 | + * 更新日 更新者 更新内容 | |
15 | + * 2010/07/03 Kitagawa 新規作成 | |
16 | + *--> | |
17 | + */ | |
18 | +@StrutsLogic | |
19 | +public class FS00001Logic extends SampleLogic implements FS00001Constants { | |
20 | + | |
21 | + /** | |
22 | + * コンストラクタ<br> | |
23 | + * @param servlet サーブレットコンテナオブジェクト | |
24 | + */ | |
25 | + protected FS00001Logic(ServletContainer<SMUser> servlet) { | |
26 | + super(servlet); | |
27 | + } | |
28 | +} |
@@ -0,0 +1,39 @@ | ||
1 | +package org.phosphoresce.webcore.struts.sample.function.FS00001; | |
2 | + | |
3 | +import org.phosphoresce.webcore.hibernate4.model.SMUser; | |
4 | +import org.phosphoresce.webcore.struts.action.ServletContainer; | |
5 | +import org.phosphoresce.webcore.struts.action.WindowSessionContainer; | |
6 | +import org.phosphoresce.webcore.struts.sample.common.action.SampleForm; | |
7 | + | |
8 | +/** | |
9 | + * サンプル機能フォームクラス(ログイン画面)<br> | |
10 | + * | |
11 | + * @author Kitagawa<br> | |
12 | + * | |
13 | + *<!-- | |
14 | + * 更新日 更新者 更新内容 | |
15 | + * 2010/07/03 Kitagawa 新規作成 | |
16 | + *--> | |
17 | + */ | |
18 | +public class FS00001Form extends SampleForm implements FS00001Constants { | |
19 | + | |
20 | + /** | |
21 | + * フォームオブジェクトをリセットします。<br> | |
22 | + * @param servlet サーブレットコンテナオブジェクト | |
23 | + * @param session ウィンドウセッションオブジェクト | |
24 | + * @see org.phosphoresce.webcore.struts.action.AbstractForm#reset(org.phosphoresce.webcore.struts.action.ServletContainer, org.phosphoresce.webcore.struts.action.WindowSessionContainer) | |
25 | + */ | |
26 | + @Override | |
27 | + public void reset(ServletContainer<SMUser> servlet, WindowSessionContainer<SMUser> session) { | |
28 | + } | |
29 | + | |
30 | + /** | |
31 | + * フォームオブジェクトを初期化します。<br> | |
32 | + * @param servlet サーブレットコンテナオブジェクト | |
33 | + * @param session ウィンドウセッションオブジェクト | |
34 | + * @see org.phosphoresce.webcore.struts.action.AbstractForm#init(org.phosphoresce.webcore.struts.action.ServletContainer, org.phosphoresce.webcore.struts.action.WindowSessionContainer) | |
35 | + */ | |
36 | + @Override | |
37 | + public void init(ServletContainer<SMUser> servlet, WindowSessionContainer<SMUser> session) { | |
38 | + } | |
39 | +} |
@@ -0,0 +1,18 @@ | ||
1 | +package org.phosphoresce.webcore.struts.sample.function.FS00001; | |
2 | + | |
3 | +import org.phosphoresce.webcore.struts.action.ScreenSession; | |
4 | +import org.phosphoresce.webcore.struts.annotation.StrutsSession; | |
5 | + | |
6 | +/** | |
7 | + * サンプル機能セッションクラス(ログイン画面)<br> | |
8 | + * | |
9 | + * @author Kitagawa<br> | |
10 | + * | |
11 | + *<!-- | |
12 | + * 更新日 更新者 更新内容 | |
13 | + * 2010/07/03 Kitagawa 新規作成 | |
14 | + *--> | |
15 | + */ | |
16 | +@StrutsSession | |
17 | +public class FS00001Session implements ScreenSession, FS00001Constants { | |
18 | +} |
@@ -18,7 +18,7 @@ | ||
18 | 18 | |
19 | 19 | /** |
20 | 20 | * コンストラクタ<br> |
21 | - * @param servlet | |
21 | + * @param servlet サーブレットコンテナオブジェクト | |
22 | 22 | */ |
23 | 23 | protected SampleLogic(ServletContainer<SMUser> servlet) { |
24 | 24 | super(servlet); |
@@ -224,7 +224,7 @@ | ||
224 | 224 | */ |
225 | 225 | public static String createRandomHash() { |
226 | 226 | synchronized (randomSeedCharIndex) { |
227 | - if (RANDOM_SEED_CHARS.size() - 1 >= randomSeedCharIndex) { | |
227 | + if (RANDOM_SEED_CHARS.size() - 1 >= randomSeedCharIndex + 1) { | |
228 | 228 | randomSeedCharIndex++; |
229 | 229 | } else { |
230 | 230 | randomSeedCharIndex = 0; |
@@ -1058,7 +1058,7 @@ | ||
1058 | 1058 | |
1059 | 1059 | // 1byte目変換 |
1060 | 1060 | int rhb = 0; |
1061 | - int ihb = keis_hi_byte - 161; | |
1061 | + //int ihb = keis_hi_byte - 161; | |
1062 | 1062 | rhb += SJIS_HI_BYTES[index / SJIS_LO_BYTES.length]; |
1063 | 1063 | |
1064 | 1064 | // 2byte目変換 |
@@ -1,6 +1,7 @@ | ||
1 | 1 | package org.phosphoresce.webcore.servlet.filter; |
2 | 2 | |
3 | 3 | import java.io.IOException; |
4 | +import java.util.Date; | |
4 | 5 | |
5 | 6 | import javax.servlet.Filter; |
6 | 7 | import javax.servlet.FilterChain; |
@@ -11,8 +12,10 @@ | ||
11 | 12 | import javax.servlet.ServletRequest; |
12 | 13 | import javax.servlet.ServletResponse; |
13 | 14 | |
15 | +import org.phosphoresce.commons.util.ExceptionUtil; | |
14 | 16 | import org.phosphoresce.webcore.ConfigName; |
15 | 17 | import org.phosphoresce.webcore.Environment; |
18 | +import org.phosphoresce.webcore.GlobalConstants; | |
16 | 19 | import org.phosphoresce.webcore.config.Config; |
17 | 20 | import org.phosphoresce.webcore.logger.CodeConvertLogger; |
18 | 21 | import org.slf4j.LoggerFactory; |
@@ -27,7 +30,7 @@ | ||
27 | 30 | * 2012/07/06 Kitagawa 新規作成 |
28 | 31 | *--> |
29 | 32 | */ |
30 | -public class ExceptionFilter implements Filter { | |
33 | +public class ExceptionFilter implements Filter, GlobalConstants { | |
31 | 34 | |
32 | 35 | /** ロガーオブジェクト */ |
33 | 36 | private CodeConvertLogger log = new CodeConvertLogger(LoggerFactory.getLogger(getClass())); |
@@ -73,10 +76,12 @@ | ||
73 | 76 | chain.doFilter(servletRequest, servletResponse); |
74 | 77 | } catch (Throwable e) { |
75 | 78 | log.output(e, "FCRE00056"); |
76 | - servletRequest.setAttribute("environment", Environment.getMap()); | |
77 | - servletRequest.setAttribute("config", Config.getMap()); | |
78 | - servletRequest.setAttribute("request", servletRequest); | |
79 | - servletRequest.setAttribute("exception", e); | |
79 | + servletRequest.setAttribute(REQUEST_ATTR_KEY_PROCESSDATE, new Date()); | |
80 | + servletRequest.setAttribute(REQUEST_ATTR_KEY_ENVIRONMENT, Environment.getMap()); | |
81 | + servletRequest.setAttribute(REQUEST_ATTR_KEY_CONFIG, Config.getMap()); | |
82 | + servletRequest.setAttribute(REQUEST_ATTR_KEY_REQUEST, servletRequest); | |
83 | + servletRequest.setAttribute(REQUEST_ATTR_KEY_EXCEPTION, e); | |
84 | + servletRequest.setAttribute(REQUEST_ATTR_KEY_EXCEPTION_TRACE, ExceptionUtil.getStackTraceValue(e)); | |
80 | 85 | RequestDispatcher dispatcher = context.getRequestDispatcher(Config.getString(ConfigName.COMMON_JSP_SYSTEMERROR)); |
81 | 86 | dispatcher.forward(servletRequest, servletResponse); |
82 | 87 | } |
@@ -20,4 +20,25 @@ | ||
20 | 20 | |
21 | 21 | /** ディフォルトメッセージリソースバンドル */ |
22 | 22 | public static final String DEFAULT_MESSAGE_RESOURCE_BUNDLE = "application"; |
23 | + | |
24 | + /** リクエストアトリビュートキー(アプリケーション実行時刻) */ | |
25 | + public static final String REQUEST_ATTR_KEY_PROCESSDATE = "processDate"; | |
26 | + | |
27 | + /** リクエストアトリビュートキー(アプリケーション環境情報オブジェクト) */ | |
28 | + public static final String REQUEST_ATTR_KEY_ENVIRONMENT = "environment"; | |
29 | + | |
30 | + /** リクエストアトリビュートキー(アプリケーション環境定義オブジェクト) */ | |
31 | + public static final String REQUEST_ATTR_KEY_CONFIG = "config"; | |
32 | + | |
33 | + /** リクエストアトリビュートキー(リクエストオブジェクト) */ | |
34 | + public static final String REQUEST_ATTR_KEY_REQUEST = "request"; | |
35 | + | |
36 | + /** リクエストアトリビュートキー(例外オブジェクト) */ | |
37 | + public static final String REQUEST_ATTR_KEY_EXCEPTION = "exception"; | |
38 | + | |
39 | + /** リクエストアトリビュートキー(例外トレース情報) */ | |
40 | + public static final String REQUEST_ATTR_KEY_EXCEPTION_TRACE = "exceptionTrace"; | |
41 | + | |
42 | + /** リクエストアトリビュートキー(ステータスコード) */ | |
43 | + public static final String REQUEST_ATTR_KEY_STATUS_CODE = "statusCode"; | |
23 | 44 | } |
@@ -1,6 +1,5 @@ | ||
1 | 1 | package org.phosphoresce.webcore.exception; |
2 | 2 | |
3 | -import org.phosphoresce.webcore.config.StringResource; | |
4 | 3 | |
5 | 4 | /** |
6 | 5 | * アプリケーションコアモジュール例外クラス<br> |
@@ -20,7 +19,7 @@ | ||
20 | 19 | * @param cause 例外要因 |
21 | 20 | */ |
22 | 21 | public WebcoreCoreModuleException(String code, Throwable cause) { |
23 | - super(StringResource.getString(code), cause); | |
22 | + super(code, cause); | |
24 | 23 | } |
25 | 24 | |
26 | 25 | /** |
@@ -30,7 +29,7 @@ | ||
30 | 29 | * @param cause 例外要因 |
31 | 30 | */ |
32 | 31 | public WebcoreCoreModuleException(String code, Object[] binds, Throwable cause) { |
33 | - super(StringResource.getString(code, binds), cause); | |
32 | + super(code, binds, cause); | |
34 | 33 | } |
35 | 34 | |
36 | 35 | /** |
@@ -38,7 +37,7 @@ | ||
38 | 37 | * @param code 例外メッセージ |
39 | 38 | */ |
40 | 39 | public WebcoreCoreModuleException(String code) { |
41 | - super(StringResource.getString(code)); | |
40 | + super(code); | |
42 | 41 | } |
43 | 42 | |
44 | 43 | /** |
@@ -47,6 +46,6 @@ | ||
47 | 46 | * @param binds 例外メッセージバインドオブジェクト |
48 | 47 | */ |
49 | 48 | public WebcoreCoreModuleException(String code, Object[] binds) { |
50 | - super(StringResource.getString(code, binds)); | |
49 | + super(code, binds); | |
51 | 50 | } |
52 | 51 | } |
@@ -0,0 +1 @@ | ||
1 | +test | |
\ No newline at end of file |
@@ -52,7 +52,7 @@ | ||
52 | 52 | /** |
53 | 53 | * 右寄せレイアウトスタイル |
54 | 54 | */ |
55 | -.rfloat { | |
55 | +.floatRight { | |
56 | 56 | float: right !important; |
57 | 57 | } |
58 | 58 |
@@ -59,7 +59,7 @@ | ||
59 | 59 | /** |
60 | 60 | * 左寄せレイアウトスタイル |
61 | 61 | */ |
62 | -.lfloat { | |
62 | +.floatLeft { | |
63 | 63 | float: left !important; |
64 | 64 | } |
65 | 65 |
@@ -104,6 +104,40 @@ | ||
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
107 | + * 例外ページヘッダースタイル | |
108 | + */ | |
109 | +.exceptionHeader { | |
110 | + color: #2778ec; | |
111 | + font-size: 50px; | |
112 | + padding: 10px 0px 10px 0px; | |
113 | +} | |
114 | + | |
115 | +/** | |
116 | + * 例外ページサブヘッダースタイル | |
117 | + */ | |
118 | +.exceptionSubHeader { | |
119 | + color: #0758cc; | |
120 | + font-size: 18px; | |
121 | + padding: 0px 0px 3px 0px; | |
122 | +} | |
123 | + | |
124 | +/** | |
125 | + * 例外ページ説明文スタイル | |
126 | + */ | |
127 | +.exceptionNotice { | |
128 | + color: #0042a5; | |
129 | + font-size: 16px; | |
130 | + padding: 10px 0px 10px 0px; | |
131 | +} | |
132 | + | |
133 | +/** | |
134 | + * 例外詳細スタイル | |
135 | + */ | |
136 | +.exceptionDescription { | |
137 | + padding: 0px 0px 20px 15px; | |
138 | +} | |
139 | + | |
140 | +/** | |
107 | 141 | * 入力フィールドセットコンテナ部スタイル |
108 | 142 | */ |
109 | 143 | .fieldSet { |
@@ -22,7 +22,6 @@ | ||
22 | 22 | |
23 | 23 | <display-name>Untitled</display-name> |
24 | 24 | |
25 | - | |
26 | 25 | <!-- #===============================================================================================================================================# --> |
27 | 26 | <!-- |
28 | 27 | /** |
@@ -272,6 +271,31 @@ | ||
272 | 271 | </jsp-property-group> |
273 | 272 | </jsp-config> |
274 | 273 | |
274 | + <!-- #===============================================================================================================================================# --> | |
275 | + <!-- ※※基本的には変更不要な定義となります※※ --> | |
276 | + <!-- | |
277 | + /** | |
278 | + * エラーページ定義 (** 必須 **) | |
279 | + * Webアプリケーションを利用する上で必須のページ定義となります。 | |
280 | + * 任意のエラーページ遷移等を行う場合にのみ変更してください。 | |
281 | + */ | |
282 | + --> | |
283 | + <error-page> | |
284 | + <exception-type>java.lang.Throwable</exception-type> | |
285 | + <location>/WEB-INF/view/common/page_systemerror.jsp</location> | |
286 | + </error-page> | |
287 | + <error-page> | |
288 | + <error-code>403</error-code> | |
289 | + <location>/WEB-INF/view/common/page_systemerror.jsp</location> | |
290 | + </error-page> | |
291 | + <error-page> | |
292 | + <error-code>404</error-code> | |
293 | + <location>/WEB-INF/view/common/page_systemerror.jsp</location> | |
294 | + </error-page> | |
295 | + <error-page> | |
296 | + <error-code>500</error-code> | |
297 | + <location>/WEB-INF/view/common/page_systemerror.jsp</location> | |
298 | + </error-page> | |
275 | 299 | |
276 | 300 | <!-- #===============================================================================================================================================# --> |
277 | 301 | <!-- ※※基本的には変更不要な定義となります※※ --> |
@@ -286,5 +310,4 @@ | ||
286 | 310 | <welcome-file>index.jsp</welcome-file> |
287 | 311 | </welcome-file-list> |
288 | 312 | |
289 | - | |
290 | 313 | </web-app> |