View Javadoc

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