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.routing;
17  
18  import java.util.List;
19  import java.util.regex.Pattern;
20  
21  import javax.servlet.http.HttpServletRequest;
22  import javax.servlet.http.HttpServletResponse;
23  
24  /**
25   * ルーター。
26   * 
27   * @author baba
28   * @since 1.0.0
29   */
30  public interface Router {
31  
32  	/**
33  	 * 対象外パターンを指定せずにルーティング処理を行い、内部フォワード情報を返します。
34  	 * 
35  	 * @param request
36  	 *            リクエスト
37  	 * @param response
38  	 *            レスポンス
39  	 * @return リクエスト URI に対応する内部フォワード情報、URI に対応する内部フォワード情報がない場合は
40  	 *         <code>null</code>
41  	 * @see #routing(HttpServletRequest, HttpServletResponse, List)
42  	 */
43  	InternalForwardInfo routing(HttpServletRequest request,
44  			HttpServletResponse response);
45  
46  	/**
47  	 * リクエストのルーティング処理を行い、内部フォワード情報を返します。
48  	 * <p>
49  	 * このメソッドはリクエスト URI とメソッドに対応するフォワード情報を{@link PathResolver} によって決定します。
50  	 * </p>
51  	 * 
52  	 * @param request
53  	 *            リクエスト
54  	 * @param response
55  	 *            レスポンス
56  	 * @param ignorePathPatterns
57  	 *            対象外とするパスのパターン
58  	 * @return リクエストに対応する内部フォワード情報、URI とリクエストメソッドに対応する内部フォワード情報がない場合や URI
59  	 *         が対象外とするパスのパターンにマッチする場合は <code>null</code>
60  	 * @see PathResolver#getInternalForwardInfo(String, String)
61  	 * @see org.seasar.cubby.action.Path
62  	 * @see org.seasar.cubby.action.Accept
63  	 */
64  	InternalForwardInfo routing(HttpServletRequest request,
65  			HttpServletResponse response, List<Pattern> ignorePathPatterns);
66  
67  }