Coverage Report - org.seasar.cubby.action.Path
 
Classes in this File Line Coverage Branch Coverage Complexity
Path
N/A
N/A
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.action;
 17  
 
 18  
 import java.lang.annotation.ElementType;
 19  
 import java.lang.annotation.Retention;
 20  
 import java.lang.annotation.RetentionPolicy;
 21  
 import java.lang.annotation.Target;
 22  
 
 23  
 /**
 24  
  * アクションメソッドのパス。
 25  
  * <p>
 26  
  * アクションメソッドを起動するためのパスを指定するアノテーションです。
 27  
  * </p>
 28  
  * <p>
 29  
  * 使用例
 30  
  * 
 31  
  * <pre>
 32  
  * &#064;Path(&quot;fuga&quot;)
 33  
  * public class HogeAction {
 34  
  *         // -&gt; &quot;/fuga/index&quot;
 35  
  *         public ActionResult index() {
 36  
  *         }
 37  
  * 
 38  
  *         // -&gt; &quot;/fuga/m1&quot;
 39  
  *         public ActionResult m1() {
 40  
  *         }
 41  
  * 
 42  
  *         &#064;Path(&quot;list&quot;)
 43  
  *         // -&gt; &quot;/fuga/list&quot;
 44  
  *         public ActionResult m2() {
 45  
  *         }
 46  
  * 
 47  
  *         &#064;Path(&quot;/xxx/yyy&quot;)
 48  
  *         // -&gt; &quot;/xxx/yyy&quot;
 49  
  *         public ActionResult m3() {
 50  
  *         }
 51  
  * 
 52  
  *         &#064;Path(&quot;/{id}/edit&quot;)
 53  
  *         // {id}部分をリクエストパラメータに追加
 54  
  *         public ActionResult m4() {
 55  
  *         }
 56  
  * 
 57  
  *         &#064;Path(&quot;/{userId,a-z}/edit&quot;)
 58  
  *         // {userId}部分をリクエストパラメータに追加。ユーザID部分は小文字アルファベットのみ。
 59  
  *         public ActionResult m5() {
 60  
  *         }
 61  
  * }
 62  
  * 
 63  
  * &#064;Path(&quot;/&quot;)
 64  
  * public class RootAction {
 65  
  *         // -&gt; &quot;/&quot;
 66  
  *         public ActionResult index() {
 67  
  *         }
 68  
  * 
 69  
  *         // -&gt; &quot;/m1&quot;
 70  
  *         public ActionResult m1() {
 71  
  *         }
 72  
  * 
 73  
  *         &#064;Path(&quot;list&quot;)
 74  
  *         // -&gt; &quot;/list&quot;
 75  
  *         public ActionResult m2() {
 76  
  *         }
 77  
  * 
 78  
  *         &#064;Path(&quot;/xxx/yyy&quot;)
 79  
  *         // -&gt; &quot;/xxx/yyy&quot;
 80  
  *         public ActionResult m3() {
 81  
  *         }
 82  
  * }
 83  
  * </pre>
 84  
  * 
 85  
  * </p>
 86  
  * 
 87  
  * @author agata
 88  
  * @author baba
 89  
  * @since 1.0.0
 90  
  */
 91  
 @Retention(RetentionPolicy.RUNTIME)
 92  
 @Target( { ElementType.METHOD, ElementType.TYPE })
 93  
 public @interface Path {
 94  
 
 95  
         /**
 96  
          * アクションメソッドのバインディング用パスを指定します。
 97  
          * <p>
 98  
          * URLはアクションクラスのパス+アクションメソッドのパスで決定されます。
 99  
          * ただし、先頭が『/』の場合コンテキストルートからの絶対パスとして解釈されます。
 100  
          * </p>
 101  
          * <p>
 102  
          * {パラメータ名,正規表現}でプレースホルダーの指定ができます。
 103  
          * </p>
 104  
          * <p>
 105  
          * 正規表現にマッチした場合、マッチした箇所が指定されたパラメータ名に追加され、アクションメソッドが実行されます。
 106  
          * 正規表現は省略可能です。省略した場合「0-9a-zA-Z」と同じ意味になります。
 107  
          * </p>
 108  
          * <p>
 109  
          * アクションメソッドのパスは「パスの正規表現+{@link Accept リクエストメソッド}」で一意に特定できなければいけません。
 110  
          * 実行時に重複が発見されると例外が発生します。
 111  
          * </p>
 112  
          * 
 113  
          * @return アクションメソッドのバインディング用パス
 114  
          * @see Accept
 115  
          */
 116  
         String value() default "";
 117  
 
 118  
 }