View Javadoc

1   /*
2    * Copyright 2004-2008 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.cubby.controller.impl;
17  
18  import java.lang.reflect.Method;
19  
20  import javax.servlet.http.HttpServletRequest;
21  import javax.servlet.http.HttpServletResponse;
22  
23  import org.seasar.cubby.action.Action;
24  import org.seasar.cubby.action.ActionResult;
25  import org.seasar.cubby.controller.ActionResultWrapper;
26  
27  /**
28   * {@link org.seasar.cubby.action.ActionResult} のラッパの実装です。
29   * 
30   * @author baba
31   * @since 1.1.0
32   */
33  class ActionResultWrapperImpl implements ActionResultWrapper {
34  
35  	/** アクションの実行結果。 */
36  	private final ActionResult actionResult;
37  
38  	/** アクション。 */
39  	private final Action action;
40  
41  	/** アクションクラス。 */
42  	private final Class<? extends Action> actionClass;
43  
44  	/** アクションメソッド。 */
45  	private final Method method;
46  
47  	/**
48  	 * 指定されたアクションの実行結果をラップしたインスタンスを生成します。
49  	 * 
50  	 * @param actionResult
51  	 *            アクションの実行結果
52  	 * @param action
53  	 *            アクション
54  	 * @param actionClass
55  	 *            アクションクラス
56  	 * @param method
57  	 *            アクションメソッド
58  	 */
59  	public ActionResultWrapperImpl(ActionResult actionResult, Action action,
60  			Class<? extends Action> actionClass, Method method) {
61  		super();
62  		this.actionResult = actionResult;
63  		this.action = action;
64  		this.actionClass = actionClass;
65  		this.method = method;
66  	}
67  
68  	/**
69  	 * {@inheritDoc}
70  	 */
71  	public void execute(final HttpServletRequest request,
72  			final HttpServletResponse response) throws Exception {
73  		actionResult.execute(action, actionClass, method, request, response);
74  	}
75  
76  	/**
77  	 * {@inheritDoc}
78  	 */
79  	public ActionResult getActionResult() {
80  		return actionResult;
81  	}
82  
83  }