Coverage Report - org.seasar.cubby.routing.PathResolver
 
Classes in this File Line Coverage Branch Coverage Complexity
PathResolver
N/A
N/A
1
 
 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.routing;
 17  
 
 18  
 import java.util.Collection;
 19  
 import java.util.Map;
 20  
 
 21  
 import org.seasar.cubby.action.RequestMethod;
 22  
 
 23  
 /**
 24  
  * パスに対応するアクションメソッドを解決するためのクラスです。
 25  
  * 
 26  
  * @author baba
 27  
  */
 28  
 public interface PathResolver {
 29  
 
 30  
         /**
 31  
          * 指定されたパスとメソッドからフォワードするための情報を抽出します。
 32  
          * <p>
 33  
          * パスにマッチするパターンがない場合は <code>null</code> を返します。
 34  
          * </p>
 35  
          * 
 36  
          * @param path
 37  
          *            パス
 38  
          * @param requestMethod
 39  
          *            HTTPメソッド
 40  
          * @param characterEncoding
 41  
          *            URI のエンコーディング
 42  
          * @return フォワード情報
 43  
          */
 44  
         PathInfo getPathInfo(String path, String requestMethod,
 45  
                         String characterEncoding);
 46  
 
 47  
         /**
 48  
          * ルーティング情報の一覧を取得します。 ルーティング情報は優先度順にソートされています。
 49  
          * 
 50  
          * @return ルーティング情報の一覧
 51  
          */
 52  
         Collection<Routing> getRoutings();
 53  
 
 54  
         /**
 55  
          * 指定されたアクションクラスのルーティング情報を登録します。
 56  
          * 
 57  
          * @param actionClass
 58  
          *            アクションクラス
 59  
          * @throws RoutingException
 60  
          *             ルーティング情報の登録に失敗した場合
 61  
          */
 62  
         void add(Class<?> actionClass);
 63  
 
 64  
         /**
 65  
          * 指定されたアクションクラスのコレクションからすべてのルーティング情報を登録します。
 66  
          * 
 67  
          * @param actionClasses
 68  
          *            アクションクラスのコレクション
 69  
          * @throws RoutingException
 70  
          *             ルーティング情報の登録に失敗した場合
 71  
          */
 72  
         void addAll(Collection<Class<?>> actionClasses);
 73  
 
 74  
         /**
 75  
          * ルーティング情報を手動登録します。
 76  
          * 
 77  
          * @param actionPath
 78  
          *            アクションのパス
 79  
          * @param actionClass
 80  
          *            アクションクラス
 81  
          * @param actionMethodName
 82  
          *            アクションメソッド名
 83  
          * @param requestMethod
 84  
          *            要求メソッド
 85  
          * @param onSubmit
 86  
          *            アクションメソッドへ振り分けるための要求パラメータ名
 87  
          * @param priority
 88  
          *            プライオリティ
 89  
          * @throws RoutingException
 90  
          *             ルーティング情報の登録に失敗した場合
 91  
          */
 92  
         void add(String actionPath, Class<?> actionClass, String actionMethodName,
 93  
                         RequestMethod requestMethod, String onSubmit, int priority);
 94  
 
 95  
         /**
 96  
          * 登録されたルーティング情報をクリアします。
 97  
          */
 98  
         void clear();
 99  
 
 100  
         /**
 101  
          * 指定されたアクションクラス、メソッド名、パラメータからパスを逆引きします。
 102  
          * 
 103  
          * @param actionClass
 104  
          *            アクションクラス
 105  
          * @param methodName
 106  
          *            メソッド名
 107  
          * @param parameters
 108  
          *            パラメータ
 109  
          * @param characterEncoding
 110  
          *            URI のエンコーディング
 111  
          * @return リダイレクト用のパス
 112  
          * @throws RoutingException
 113  
          *             ルーティング情報の逆引きに失敗した場合
 114  
          */
 115  
         String reverseLookup(Class<?> actionClass, String methodName,
 116  
                         Map<String, String[]> parameters, String characterEncoding);
 117  
 
 118  
 }