クラス ServletRequestUtils
java.lang.ObjectSE
org.springframework.web.bind.ServletRequestUtils
特定の型のパラメーターが必要なデータバインディングとは異なるアプローチのパラメーター抽出メソッド。
このアプローチは、リクエストパラメーターをコマンドオブジェクトにバインドするのがやり過ぎであるような、単純な送信に非常に役立ちます。
- 導入:
- 2.0
- 作成者:
- Juergen Hoeller, Keith Donald
コンストラクターのサマリー
方法の概要
修飾子と型メソッド説明static BooleanSE
getBooleanParameter
(ServletRequestEE request, StringSE name) ブールパラメーターを取得します。存在しない場合はnull
を取得します。static boolean
getBooleanParameter
(ServletRequestEE request, StringSE name, boolean defaultVal) フォールバック値を持つブールパラメーターを取得します。static boolean[]
getBooleanParameters
(ServletRequestEE request, StringSE name) ブールパラメーターの配列を取得し、見つからない場合は空の配列を返します。static DoubleSE
getDoubleParameter
(ServletRequestEE request, StringSE name) Double パラメーター、または存在しない場合はnull
を取得します。static double
getDoubleParameter
(ServletRequestEE request, StringSE name, double defaultVal) フォールバック値を持つ double パラメーターを取得します。static double[]
getDoubleParameters
(ServletRequestEE request, StringSE name) double パラメーターの配列を取得し、見つからない場合は空の配列を返します。static FloatSE
getFloatParameter
(ServletRequestEE request, StringSE name) Float パラメーターを取得するか、存在しない場合はnull
を取得します。static float
getFloatParameter
(ServletRequestEE request, StringSE name, float defaultVal) フォールバック値を持つ浮動小数点パラメーターを取得します。static float[]
getFloatParameters
(ServletRequestEE request, StringSE name) float パラメーターの配列を取得し、見つからない場合は空の配列を返します。static IntegerSE
getIntParameter
(ServletRequestEE request, StringSE name) 整数パラメーター、または存在しない場合はnull
を取得します。static int
getIntParameter
(ServletRequestEE request, StringSE name, int defaultVal) フォールバック値を持つ int パラメーターを取得します。static int[]
getIntParameters
(ServletRequestEE request, StringSE name) int パラメーターの配列を取得し、見つからない場合は空の配列を返します。static LongSE
getLongParameter
(ServletRequestEE request, StringSE name) Long パラメーターを取得するか、存在しない場合はnull
を取得します。static long
getLongParameter
(ServletRequestEE request, StringSE name, long defaultVal) フォールバック値を持つ長いパラメーターを取得します。static long[]
getLongParameters
(ServletRequestEE request, StringSE name) 長いパラメーターの配列を取得し、見つからない場合は空の配列を返します。static boolean
getRequiredBooleanParameter
(ServletRequestEE request, StringSE name) ブール値のパラメーターを取得し、見つからないかブール値でない場合は例外をスローします。static boolean[]
getRequiredBooleanParameters
(ServletRequestEE request, StringSE name) ブール値のパラメーターの配列を取得し、見つからないか、ブール値でない場合は例外をスローします。static double
getRequiredDoubleParameter
(ServletRequestEE request, StringSE name) double パラメーターを取得し、見つからない場合、数値でない場合は例外をスローします。static double[]
getRequiredDoubleParameters
(ServletRequestEE request, StringSE name) double パラメーターの配列を取得し、見つからない場合または例外が数値でない場合は例外をスローします。static float
getRequiredFloatParameter
(ServletRequestEE request, StringSE name) float パラメーターを取得し、見つからない場合、数値でない場合は例外をスローします。static float[]
getRequiredFloatParameters
(ServletRequestEE request, StringSE name) float パラメーターの配列を取得し、見つからない場合、例外が数値でない場合は例外をスローします。static int
getRequiredIntParameter
(ServletRequestEE request, StringSE name) int パラメーターを取得し、見つからない場合または数値でない場合は例外をスローします。static int[]
getRequiredIntParameters
(ServletRequestEE request, StringSE name) int パラメーターの配列を取得し、見つからない場合、1 つが数値でない場合は、例外をスローします。static long
getRequiredLongParameter
(ServletRequestEE request, StringSE name) 長いパラメーターを取得し、見つからない場合または数値でない場合は例外をスローします。static long[]
getRequiredLongParameters
(ServletRequestEE request, StringSE name) 長いパラメーターの配列を取得し、見つからないか、数値でない場合は例外をスローします。static StringSE
getRequiredStringParameter
(ServletRequestEE request, StringSE name) String パラメーターを取得し、見つからない場合は例外をスローします。static StringSE[]
getRequiredStringParameters
(ServletRequestEE request, StringSE name) 文字列パラメーターの配列を取得し、見つからない場合は例外をスローします。static StringSE
getStringParameter
(ServletRequestEE request, StringSE name) String パラメーターを取得します。存在しない場合はnull
を取得します。static StringSE
getStringParameter
(ServletRequestEE request, StringSE name, StringSE defaultVal) フォールバック値を含む文字列パラメーターを取得します。static StringSE[]
getStringParameters
(ServletRequestEE request, StringSE name) 文字列パラメーターの配列を取得し、見つからない場合は空の配列を返します。
コンストラクターの詳細
ServletRequestUtils
public ServletRequestUtils()
メソッドの詳細
getIntParameter
@Nullable public static IntegerSE getIntParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException 整数パラメーターを取得します。存在しない場合はnull
を取得します。パラメーター値が数値でない場合は、例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 戻り値:
- 整数値。存在しない場合は
null
- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getIntParameter
フォールバック値を持つ int パラメーターを取得します。例外をスローしません。識別値をデフォルトとして渡し、それが指定されたかどうかのチェックを有効にすることができます。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前defaultVal
- フォールバックとして使用するデフォルト値
getIntParameters
int パラメーターの配列を取得し、見つからない場合は空の配列を返します。- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前
getRequiredIntParameter
public static int getRequiredIntParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException int パラメーターを取得し、見つからない場合または数値でない場合は例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getRequiredIntParameters
public static int[] getRequiredIntParameters(ServletRequestEE request, StringSE name) throws ServletRequestBindingException int パラメーターの配列を取得し、見つからない場合、1 つが数値でない場合は、例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getLongParameter
@Nullable public static LongSE getLongParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException Long パラメーターを取得するか、存在しない場合はnull
を取得します。パラメーター値が数値でない場合は、例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 戻り値:
- Long 値。存在しない場合は
null
- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getLongParameter
フォールバック値を持つ長いパラメーターを取得します。例外をスローしません。識別値をデフォルトとして渡し、それが指定されたかどうかのチェックを有効にすることができます。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前defaultVal
- フォールバックとして使用するデフォルト値
getLongParameters
長いパラメーターの配列を取得し、見つからない場合は空の配列を返します。- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前
getRequiredLongParameter
public static long getRequiredLongParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException 長いパラメーターを取得し、見つからない場合または数値でない場合は例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getRequiredLongParameters
public static long[] getRequiredLongParameters(ServletRequestEE request, StringSE name) throws ServletRequestBindingException 長いパラメーターの配列を取得し、見つからないか、数値でない場合は例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getFloatParameter
@Nullable public static FloatSE getFloatParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException Float パラメーター、または存在しない場合はnull
を取得します。パラメーター値が数値でない場合は、例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 戻り値:
- Float 値。存在しない場合は
null
- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getFloatParameter
フォールバック値を持つ浮動小数点パラメーターを取得します。例外をスローしません。識別値をデフォルトとして渡し、それが指定されたかどうかのチェックを有効にすることができます。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前defaultVal
- フォールバックとして使用するデフォルト値
getFloatParameters
float パラメーターの配列を取得し、見つからない場合は空の配列を返します。- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前
getRequiredFloatParameter
public static float getRequiredFloatParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException float パラメーターを取得し、見つからない場合、数値でない場合は例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getRequiredFloatParameters
public static float[] getRequiredFloatParameters(ServletRequestEE request, StringSE name) throws ServletRequestBindingException float パラメーターの配列を取得し、見つからない場合、例外が数値でない場合は例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getDoubleParameter
@Nullable public static DoubleSE getDoubleParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException Double パラメーターを取得するか、存在しない場合はnull
を取得します。パラメーター値が数値でない場合は、例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 戻り値:
- Double 値。存在しない場合は
null
- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getDoubleParameter
フォールバック値を持つ double パラメーターを取得します。例外をスローしません。識別値をデフォルトとして渡し、それが指定されたかどうかのチェックを有効にすることができます。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前defaultVal
- フォールバックとして使用するデフォルト値
getDoubleParameters
double パラメーターの配列を取得し、見つからない場合は空の配列を返します。- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前
getRequiredDoubleParameter
public static double getRequiredDoubleParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException double パラメーターを取得し、見つからない場合、数値でない場合は例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getRequiredDoubleParameters
public static double[] getRequiredDoubleParameters(ServletRequestEE request, StringSE name) throws ServletRequestBindingException double パラメーターの配列を取得し、見つからない場合または例外が数値でない場合は例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getBooleanParameter
@Nullable public static BooleanSE getBooleanParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException ブールパラメーターを取得するか、存在しない場合はnull
を取得します。パラメーター値がブール値でない場合、例外をスローします。true の値として "true"、"on"、"yes" (すべてのケース)、"1" を受け入れます。空でない他のすべての値を false として扱います(つまり、緩やかに解析します)。
- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 戻り値:
- ブール値。存在しない場合は
null
- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getBooleanParameter
public static boolean getBooleanParameter(ServletRequestEE request, StringSE name, boolean defaultVal) フォールバック値を持つブールパラメーターを取得します。例外をスローしません。識別値をデフォルトとして渡し、それが指定されたかどうかのチェックを有効にすることができます。true の値として "true"、"on"、"yes" (すべてのケース)、"1" を受け入れます。空でない他のすべての値を false として扱います(つまり、緩やかに解析します)。
- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前defaultVal
- フォールバックとして使用するデフォルト値
getBooleanParameters
ブールパラメーターの配列を取得し、見つからない場合は空の配列を返します。true の値として "true"、"on"、"yes" (すべてのケース)、"1" を受け入れます。空でない他のすべての値を false として扱います(つまり、緩やかに解析します)。
- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前
getRequiredBooleanParameter
public static boolean getRequiredBooleanParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException ブール値のパラメーターを取得し、見つからないかブール値でない場合は例外をスローします。true の値として "true"、"on"、"yes" (すべてのケース)、"1" を受け入れます。空でない他のすべての値を false として扱います(つまり、緩やかに解析します)。
- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getRequiredBooleanParameters
public static boolean[] getRequiredBooleanParameters(ServletRequestEE request, StringSE name) throws ServletRequestBindingException ブール値のパラメーターの配列を取得し、見つからないか、ブール値でない場合は例外をスローします。true の値として "true"、"on"、"yes" (すべてのケース)、"1" を受け入れます。空でない他のすべての値を false として扱います(つまり、緩やかに解析します)。
- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getStringParameter
@Nullable public static StringSE getStringParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException String パラメーターを取得します。存在しない場合はnull
を取得します。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 戻り値:
- 文字列値。存在しない場合は
null
- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getStringParameter
public static StringSE getStringParameter(ServletRequestEE request, StringSE name, StringSE defaultVal) フォールバック値を含む文字列パラメーターを取得します。例外をスローしません。識別された値をデフォルトに渡して、それが提供されたかどうかのチェックを有効にすることができます。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前defaultVal
- フォールバックとして使用するデフォルト値
getStringParameters
文字列パラメーターの配列を取得し、見つからない場合は空の配列を返します。- パラメーター:
request
- 現在の HTTP リクエストname
- 複数の可能な値を持つパラメーターの名前
getRequiredStringParameter
public static StringSE getRequiredStringParameter(ServletRequestEE request, StringSE name) throws ServletRequestBindingException String パラメーターを取得し、見つからない場合は例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません
getRequiredStringParameters
public static StringSE[] getRequiredStringParameters(ServletRequestEE request, StringSE name) throws ServletRequestBindingException 文字列パラメーターの配列を取得し、見つからない場合は例外をスローします。- パラメーター:
request
- 現在の HTTP リクエストname
- パラメーターの名前- 例外:
ServletRequestBindingException
- ServletException のサブクラスなので、キャッチする必要はありません