Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PathResolver |
|
| 0.0;0 |
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.routing; | |
17 | ||
18 | import java.util.List; | |
19 | import java.util.Map; | |
20 | ||
21 | import org.seasar.cubby.action.Action; | |
22 | import org.seasar.cubby.action.RequestMethod; | |
23 | ||
24 | /** | |
25 | * {@link Router} がフォワードするための情報を抽出するクラス。 | |
26 | * | |
27 | * @author baba | |
28 | * @since 1.0.0 | |
29 | */ | |
30 | public interface PathResolver { | |
31 | ||
32 | /** | |
33 | * 指定されたパスとメソッドからフォワードするための情報を抽出します。 | |
34 | * <p> | |
35 | * パスにマッチするパターンがない場合は <code>null</code> を返します。 | |
36 | * </p> | |
37 | * | |
38 | * @param path | |
39 | * パス | |
40 | * @param requestMethod | |
41 | * HTTPメソッド | |
42 | * @return フォワード情報 | |
43 | */ | |
44 | InternalForwardInfo getInternalForwardInfo(String path, String requestMethod); | |
45 | ||
46 | /** | |
47 | * ルーティング情報の一覧を取得します。 ルーティング情報は優先度順にソートされています。 | |
48 | * | |
49 | * @return ルーティング情報の一覧 | |
50 | */ | |
51 | List<Routing> getRoutings(); | |
52 | ||
53 | /** | |
54 | * ルーティング情報を手動登録します。 | |
55 | * <p> | |
56 | * 手動登録の場合、優先度は0から連番で設定されます。 | |
57 | * </p> | |
58 | * | |
59 | * @param actionPath | |
60 | * アクションのパス | |
61 | * @param actionClass | |
62 | * アクションクラス | |
63 | * @param methodName | |
64 | * アクションメソッド名 | |
65 | * @param requestMethods | |
66 | * リクエストメソッド。<code>null</code> の場合、{@link RequestMethod#GET},{@link RequestMethod#POST} | |
67 | * がデフォルト値として設定されます。 | |
68 | * @see org.seasar.cubby.action.Path#priority() 自動設定の際のプライオリティ | |
69 | */ | |
70 | void add(final String actionPath, | |
71 | final Class<? extends Action> actionClass, final String methodName, | |
72 | final RequestMethod... requestMethods); | |
73 | ||
74 | /** | |
75 | * 指定されたアクションクラス、メソッド名、パラメータからパスを逆引きします。 | |
76 | * | |
77 | * @param actionClass | |
78 | * アクションクラス | |
79 | * @param methodName | |
80 | * メソッド名 | |
81 | * @param parameters | |
82 | * パラメータ | |
83 | * @return リダイレクト用のパス | |
84 | * @since 1.1.0 | |
85 | */ | |
86 | String reverseLookup(final Class<? extends Action> actionClass, | |
87 | String methodName, Map<String, String[]> parameters); | |
88 | ||
89 | /** | |
90 | * 内部フォワードパスを構築します。 | |
91 | * | |
92 | * @param parameters | |
93 | * パラメータ | |
94 | * @return 内部フォワードパス | |
95 | * @since 1.1.0 | |
96 | */ | |
97 | String buildInternalForwardPath(Map<String, String[]> parameters); | |
98 | ||
99 | } |