public class MockFilterChain extends java.lang.Object implements FilterChainEE
FilterChain
EE インターフェースのモック実装。MockFilterChain
は、1 つ以上のフィルターと呼び出すサーブレットを使用して構成できます。チェーンが初めて呼び出されると、すべてのフィルターとサーブレットが呼び出され、リクエストとレスポンスが保存されます。reset()
が呼び出されない限り、後続の呼び出しで IllegalStateException
が発生します。
MockFilterConfig
, PassThroughFilterChain
コンストラクターと説明 |
---|
MockFilterChain() 単一の何もしない Filter EE 実装を登録します。 |
MockFilterChain(ServletEE servlet) サーブレットで FilterChain を作成します。 |
MockFilterChain(ServletEE servlet, FilterEE... filters) フィルターとサーブレットで FilterChain を作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
void | doFilter(ServletRequestEE request, ServletResponseEE response) |
ServletRequestEE | getRequest() doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) が呼び出されたリクエストを返します。 |
ServletResponseEE | getResponse() doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) が呼び出されたレスポンスを返します。 |
void | reset() MockFilterChain をリセットして、再度呼び出せるようにします。 |
public MockFilterChain()
public MockFilterChain(ServletEE servlet)
servlet
- 呼び出すサーブレット public MockFilterChain(ServletEE servlet, FilterEE... filters)
FilterChain
を作成します。servlet
- この FilterChain
EE で呼び出す Servlet
EEfilters
- この FilterChain
EE で呼び出す Filter
EE@Nullable public ServletRequestEE getRequest()
doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
が呼び出されたリクエストを返します。@Nullable public ServletResponseEE getResponse()
doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
が呼び出されたレスポンスを返します。public void doFilter(ServletRequestEE request, ServletResponseEE response) throws java.io.IOException, ServletExceptionEE
FilterChainEE
の doFilterEE
request
- チェーンを渡すリクエスト。response
- チェーンに沿って渡すレスポンス。java.io.IOException
- 処理中に I/O 関連のエラーが発生した場合 ServletExceptionEE
- filterChain の通常の動作を妨げる例外が発生した場合 public void reset()
MockFilterChain
をリセットして、再度呼び出せるようにします。