1

ESAPIクラスの下にある of メソッドを使用できませんでした」

    java.lang.String getValidInput(java.lang.String context,
                                  java.lang.String input,
                                  java.lang.String type,
                                  int maxLength,
                                  boolean allowNull)
                                      throws ValidationException,
                                       IntrusionException

      Parameters:
         type - The regular expression name that maps to the actual regular expression from "ESAPI.properties". 

ESAPI.propertiesファイルからパラメータ型を渡すには? 私が参照できるプロパティファイルの値を使用する例はありますか?

4

2 に答える 2

6

「宛先」アドレス フィールドを検証する呼び出しの例を次に示します。

validator.getValidInput("toAddress", it.next(), "Email", Email.MAX_ADDRESS_SIZE, true)

ESAPI は、IDE を使用しているか、直接ソースにアクセスできることを前提としています。Eclipse を使用している場合は、メソッド名の上にマウスを置くだけで、パラメーターの型が表示されます。

===更新===

これは、javadoc から直接抜粋したものです。

/**
     * Returns canonicalized and validated input as a String. Invalid input will generate a descriptive ValidationException,
     * and input that is clearly an attack will generate a descriptive IntrusionException.
     *
     * @param context
     *      A descriptive name of the parameter that you are validating (e.g., LoginPage_UsernameField). This value is used by any logging or error handling that is done with respect to the value passed in.
     * @param input
     *      The actual user input data to validate.
     * @param type
     *      The regular expression name that maps to the actual regular expression from "ESAPI.properties".
     * @param maxLength
     *      The maximum post-canonicalized String length allowed.
     * @param allowNull
     *      If allowNull is true then an input that is NULL or an empty string will be legal. If allowNull is false then NULL or an empty String will throw a ValidationException.
     *
     * @return The canonicalized user input.
     *
     * @throws ValidationException
     * @throws IntrusionException
     */
于 2014-03-26T18:06:31.983 に答える