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   */
32  public interface Router {
33  
34  	/**
35  	 * 対象外パターンを指定せずにルーティング処理を行い、内部フォワード情報を返します。
36  	 * 
37  	 * @param request
38  	 *            要求
39  	 * @param response
40  	 *            応答
41  	 * @return 要求 URI に対応する内部フォワード情報、URI に対応する内部フォワード情報がない場合は <code>null</code>
42  	 * @see #routing(HttpServletRequest, HttpServletResponse, List)
43  	 */
44  	PathInfo routing(HttpServletRequest request, 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#getPathInfo(String, String, String)
61  	 * @see org.seasar.cubby.action.Path
62  	 * @see org.seasar.cubby.action.Accept
63  	 */
64  	PathInfo routing(HttpServletRequest request, HttpServletResponse response,
65  			List<Pattern> ignorePathPatterns);
66  
67  }