(empty log message)
@@ -1,5 +1,7 @@ | ||
1 | 1 | package org.phosphoresce.webcore.struts.config; |
2 | 2 | |
3 | +import java.io.Serializable; | |
4 | + | |
3 | 5 | import org.apache.struts.action.ActionMapping; |
4 | 6 | import org.apache.struts.config.ActionConfig; |
5 | 7 | import org.apache.struts.config.impl.ModuleConfigImpl; |
@@ -6,6 +8,7 @@ | ||
6 | 8 | import org.phosphoresce.webcore.config.Config; |
7 | 9 | import org.phosphoresce.webcore.logger.CodeConvertLogger; |
8 | 10 | import org.phosphoresce.webcore.struts.StrutsConfigNames; |
11 | +import org.phosphoresce.webcore.struts.action.AbstractForm; | |
9 | 12 | import org.phosphoresce.webcore.struts.exception.StrutsProcessInternalException; |
10 | 13 | import org.phosphoresce.webcore.struts.util.StrutsAnnotationUtil; |
11 | 14 | import org.phosphoresce.webcore.struts.util.StrutsUtil; |
@@ -72,8 +75,15 @@ | ||
72 | 75 | * アクションコンフィグが存在しない場合はインスタンス生成 |
73 | 76 | */ |
74 | 77 | 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 | + Class<? extends AbstractForm<? extends Serializable>> formClass = StrutsUtil.getFormClass(actionPath); | |
75 | 85 | String name = StrutsUtil.getFormClassSimpleName(actionPath); |
76 | - String scope = StrutsAnnotationUtil.getFormScope(StrutsUtil.getFormClass(actionPath)); | |
86 | + String scope = StrutsAnnotationUtil.getFormScope(formClass); | |
77 | 87 | String className = StrutsUtil.getActionClassName(actionPath); |
78 | 88 | actionConfig = new ActionMapping(); |
79 | 89 | actionConfig.setCancellable(false); |
@@ -83,13 +93,12 @@ | ||
83 | 93 | actionConfig.setScope(scope); |
84 | 94 | actionConfig.setType(className); |
85 | 95 | actionConfigs.put(actionPath, actionConfig); |
86 | - | |
87 | - log.output("FSTR00006", name, className); | |
96 | + log.output("FSTR00009", actionPath); | |
88 | 97 | } |
89 | 98 | |
90 | 99 | return actionConfig; |
91 | 100 | } catch (Throwable e) { |
92 | - throw new StrutsProcessInternalException("FSTR00004", e); | |
101 | + throw new StrutsProcessInternalException("FSTR00008", e); | |
93 | 102 | } |
94 | 103 | } |
95 | 104 |
@@ -26,7 +26,4 @@ | ||
26 | 26 | @Target({ ElementType.TYPE }) |
27 | 27 | @Documented |
28 | 28 | public @interface StrutsAction { |
29 | - | |
30 | - /** アクションフォームクラス */ | |
31 | - public abstract Class<? extends AbstractForm<? extends Serializable>> formClass(); | |
32 | 29 | } |
@@ -58,7 +58,7 @@ | ||
58 | 58 | String actionPath = StrutsUtil.getRequestActionPath(request, moduleConfig); |
59 | 59 | |
60 | 60 | // 指定されたリクエストパスに合致するアクションフォームが存在しない場合はダミーのフォームを返却 |
61 | - if (!StrutsUtil.isExistActionForm(actionPath)) { | |
61 | + if (!StrutsUtil.isExistFormClass(actionPath)) { | |
62 | 62 | return new DummyForm(); |
63 | 63 | } |
64 | 64 |
@@ -21,7 +21,6 @@ | ||
21 | 21 | import org.phosphoresce.webcore.struts.action.AbstractForm; |
22 | 22 | import org.phosphoresce.webcore.struts.action.ServletContainer; |
23 | 23 | import org.phosphoresce.webcore.struts.action.WindowSessionContainer; |
24 | -import org.phosphoresce.webcore.struts.annotation.StrutsAction; | |
25 | 24 | import org.phosphoresce.webcore.struts.annotation.StrutsMethod; |
26 | 25 | import org.phosphoresce.webcore.struts.exception.StrutsProcessInternalException; |
27 | 26 |
@@ -273,13 +272,9 @@ | ||
273 | 272 | * @param actionPath プロセスパス |
274 | 273 | * @return フォームクラスが存在する場合にtrueを返却 |
275 | 274 | */ |
276 | - public static boolean isExistActionForm(String actionPath) { | |
277 | - try { | |
278 | - Class<? extends AbstractForm<? extends Serializable>> clazz = getFormClass(actionPath); | |
279 | - return clazz != null; | |
280 | - } catch (ClassNotFoundException e) { | |
281 | - return false; | |
282 | - } | |
275 | + public static boolean isExistFormClass(String actionPath) { | |
276 | + Class<? extends AbstractForm<? extends Serializable>> clazz = getFormClass(actionPath); | |
277 | + return clazz != null; | |
283 | 278 | } |
284 | 279 | |
285 | 280 | /** |
@@ -340,14 +335,9 @@ | ||
340 | 335 | throw new StrutsProcessInternalException("FSTR09006", new Object[] { actionPath }); |
341 | 336 | } |
342 | 337 | |
343 | - StrutsAction strutsAction = StrutsAnnotationUtil.getStrutsActionAnnotation(actionClass); | |
344 | - if (strutsAction == null) { | |
345 | - throw new StrutsProcessInternalException("FSTR09004", new Object[] { actionClass.getName() }); | |
346 | - } | |
347 | - | |
348 | - Class<? extends AbstractForm<? extends Serializable>> actionFormClass = (Class<? extends AbstractForm<? extends Serializable>>) strutsAction.formClass(); | |
338 | + Class<? extends AbstractForm<? extends Serializable>> formClass = getFormClass(actionPath); | |
349 | 339 | String methodName = getRequestFunctionMethod(actionPath); |
350 | - Method method = ReflectionUtil.getMethod(actionClass, methodName, actionFormClass, WindowSessionContainer.class, ServletContainer.class); | |
340 | + Method method = ReflectionUtil.getMethod(actionClass, methodName, formClass, WindowSessionContainer.class, ServletContainer.class); | |
351 | 341 | |
352 | 342 | StrutsMethod strutsActionMethod = method.getAnnotation(StrutsMethod.class); |
353 | 343 | if (strutsActionMethod == null) { |
@@ -389,16 +379,19 @@ | ||
389 | 379 | * 指定されたアクションパスのフォームクラスを取得します。<br> |
390 | 380 | * @param actionPath アクションパス |
391 | 381 | * @return フォームクラス |
392 | - * @throws ClassNotFoundException フォームクラスが見つからなかった場合にスローされます | |
393 | 382 | */ |
394 | 383 | @SuppressWarnings("unchecked") |
395 | - public static Class<AbstractForm<? extends Serializable>> getFormClass(String actionPath) throws ClassNotFoundException { | |
396 | - Class<AbstractForm<? extends Serializable>> clazz = null; | |
397 | - String className = getFormClassName(actionPath); | |
398 | - if (!StringUtil.isEmpty(className)) { | |
399 | - clazz = (Class<AbstractForm<? extends Serializable>>) Class.forName(className); | |
384 | + public static Class<AbstractForm<? extends Serializable>> getFormClass(String actionPath) { | |
385 | + try { | |
386 | + Class<AbstractForm<? extends Serializable>> clazz = null; | |
387 | + String className = getFormClassName(actionPath); | |
388 | + if (!StringUtil.isEmpty(className)) { | |
389 | + clazz = (Class<AbstractForm<? extends Serializable>>) Class.forName(className); | |
390 | + } | |
391 | + return clazz; | |
392 | + } catch (ClassNotFoundException e) { | |
393 | + return null; | |
400 | 394 | } |
401 | - return clazz; | |
402 | 395 | } |
403 | 396 | |
404 | 397 | /** |
@@ -6,12 +6,9 @@ | ||
6 | 6 | import javax.servlet.http.HttpServletRequest; |
7 | 7 | |
8 | 8 | import org.apache.struts.config.ModuleConfig; |
9 | -import org.phosphoresce.commons.util.AnnotationUtil; | |
10 | 9 | import org.phosphoresce.webcore.struts.action.AbstractAction; |
11 | 10 | import org.phosphoresce.webcore.struts.action.AbstractForm; |
12 | 11 | import org.phosphoresce.webcore.struts.action.AbstractLogic; |
13 | -import org.phosphoresce.webcore.struts.action.ServletContainer; | |
14 | -import org.phosphoresce.webcore.struts.action.WindowSessionContainer; | |
15 | 12 | import org.phosphoresce.webcore.struts.annotation.StrutsAction; |
16 | 13 | import org.phosphoresce.webcore.struts.annotation.StrutsForm; |
17 | 14 | import org.phosphoresce.webcore.struts.annotation.StrutsLogic; |
@@ -90,21 +87,6 @@ | ||
90 | 87 | |
91 | 88 | /** |
92 | 89 | * StrutsMethodアノテーションを取得します。<br> |
93 | - * @param method メソッドオブジェクト | |
94 | - * @param name メソッド名 | |
95 | - * @return StrutsFormアノテーション | |
96 | - */ | |
97 | - @SuppressWarnings("unchecked") | |
98 | - public static StrutsMethod getStrutsMethodAnnotation(Class<? extends AbstractAction<? extends Serializable, ? extends AbstractForm<? extends Serializable>>> actionClass, String name) { | |
99 | - if (actionClass == null) { | |
100 | - return null; | |
101 | - } | |
102 | - StrutsAction strutsAction = getStrutsActionAnnotation((Class<? extends AbstractAction<? extends Serializable, AbstractForm<? extends Serializable>>>) actionClass); | |
103 | - return AnnotationUtil.getMethodAnnotation(StrutsMethod.class, actionClass, name, strutsAction.formClass(), WindowSessionContainer.class, ServletContainer.class); | |
104 | - } | |
105 | - | |
106 | - /** | |
107 | - * StrutsMethodアノテーションを取得します。<br> | |
108 | 90 | * @param request リクエストオブジェクト |
109 | 91 | * @param moduleConfig モジュール環境オブジェクト |
110 | 92 | * @return StrutsMethodアノテーション |
@@ -139,7 +121,7 @@ | ||
139 | 121 | * @param clazz アクションフォームクラス |
140 | 122 | * @return アクションフォームスコープ |
141 | 123 | */ |
142 | - public static String getFormScope(Class<AbstractForm<? extends Serializable>> clazz) { | |
124 | + public static String getFormScope(Class<? extends AbstractForm<? extends Serializable>> clazz) { | |
143 | 125 | StrutsForm strutsForm = getStrutsFormAnnotation(clazz); |
144 | 126 | if (strutsForm == null) { |
145 | 127 | return "request"; |
@@ -1,8 +1,6 @@ | ||
1 | 1 | package org.phosphoresce.webcore.struts.sample.function.C00001; |
2 | 2 | |
3 | -import org.phosphoresce.webcore.config.Config; | |
4 | 3 | import org.phosphoresce.webcore.hibernate4.model.SMUser; |
5 | -import org.phosphoresce.webcore.struts.StrutsConfigNames; | |
6 | 4 | import org.phosphoresce.webcore.struts.action.Forward; |
7 | 5 | import org.phosphoresce.webcore.struts.action.ServletContainer; |
8 | 6 | import org.phosphoresce.webcore.struts.action.WindowSessionContainer; |
@@ -21,7 +19,7 @@ | ||
21 | 19 | * 2012/07/03 Kitagawa 新規作成 |
22 | 20 | *--> |
23 | 21 | */ |
24 | -@StrutsAction(formClass = C00001Form.class) | |
22 | +@StrutsAction | |
25 | 23 | public class C00001Action extends SampleAction { |
26 | 24 | |
27 | 25 | /** |
@@ -0,0 +1,37 @@ | ||
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.Forward; | |
5 | +import org.phosphoresce.webcore.struts.action.ServletContainer; | |
6 | +import org.phosphoresce.webcore.struts.action.WindowSessionContainer; | |
7 | +import org.phosphoresce.webcore.struts.annotation.StrutsAction; | |
8 | +import org.phosphoresce.webcore.struts.sample.common.action.SampleAction; | |
9 | +import org.phosphoresce.webcore.struts.sample.common.action.SampleForm; | |
10 | + | |
11 | +/** | |
12 | + * サンプル機能アクションクラス(ログイン画面)<br> | |
13 | + * | |
14 | + * @author Kitagawa<br> | |
15 | + * | |
16 | + *<!-- | |
17 | + * 更新日 更新者 更新内容 | |
18 | + * 2010/07/03 Kitagawa 新規作成 | |
19 | + *--> | |
20 | + */ | |
21 | +@StrutsAction | |
22 | +public class FS00001Action extends SampleAction { | |
23 | + | |
24 | + /** | |
25 | + * 初期表示処理を行います。<br> | |
26 | + * @param form ActionFormオブジェクト | |
27 | + * @param session セッションコンテナオブジェクト | |
28 | + * @param servlet サーブレットコンテナオブジェクト | |
29 | + * @return 遷移先パス | |
30 | + * @throws Throwable 処理中に補足されない予期せぬエラーが発生した場合にスローされます | |
31 | + * @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 | + @Override | |
34 | + public Forward index(SampleForm form, WindowSessionContainer<SMUser> session, ServletContainer<SMUser> servlet) throws Throwable { | |
35 | + return new Forward(); | |
36 | + } | |
37 | +} |
@@ -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 { | |
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 | +} |
@@ -41,6 +41,7 @@ | ||
41 | 41 | .pageHeaderLower { |
42 | 42 | height: 30px; |
43 | 43 | background-color: #000000; |
44 | + background: #000000 url(../images/bg_content_header.png) 50% 50% repeat-x; | |
44 | 45 | } |
45 | 46 | |
46 | 47 | /** |