public class ViewControllerRegistry extends ObjectSE
コンストラクターと説明 |
---|
ViewControllerRegistry(ApplicationContext applicationContext) ApplicationContext を使用したクラスコンストラクター。 |
修飾子と型 | メソッドと説明 |
---|---|
RedirectViewControllerRegistration | addRedirectViewController(StringSE urlPath, StringSE redirectUrl) 別の URL にリダイレクトするために、ViewController を指定された URL パスまたはパターンにマップします。 |
void | addStatusController(StringSE urlPath, HttpStatus statusCode) 本文をレンダリングせずにレスポンスステータスを特定のコードに設定するには、単純なコントローラーを特定の URL パス(またはパターン)にマップします。 |
ViewControllerRegistration | addViewController(StringSE urlPathOrPattern) URL パスまたはパターンを ViewController にマップして、構成されたステータスコードとビューでレスポンスをレンダリングします。 |
protected SimpleUrlHandlerMapping | buildHandlerMapping() 登録済みの View Controller マッピングを含む HandlerMapping 、または登録なしの null を返します。 |
void | setOrder(int order) Spring MVC で構成された他のハンドラーマッピングに対してビューコントローラーをマップするために使用される HandlerMapping に使用する順序を指定します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public ViewControllerRegistry(@Nullable ApplicationContext applicationContext)
ApplicationContext
を使用したクラスコンストラクター。public ViewControllerRegistration addViewController(StringSE urlPathOrPattern)
"/admin/**"
や "/articles/{articlename:\\w+}"
などのパターンがサポートされています。パターン構文については、解析されたパターンが enabled
の場合は PathPattern
を、それ以外の場合は AntPathMatcher
を参照してください。構文はほぼ同じで、PathPattern
は Web の使用に合わせて調整され、より効率的です。
注意 : @RequestMapping
メソッドが HTTP メソッドの URL にマップされている場合、ビューコントローラーは同じ URL を処理できません。このため、アノテーション付きコントローラーとビューコントローラー間で URL 処理を分割しないことをお勧めします。
public RedirectViewControllerRegistration addRedirectViewController(StringSE urlPath, StringSE redirectUrl)
パターン構文については、解析されたパターンが enabled
の場合は PathPattern
を、それ以外の場合は AntPathMatcher
を参照してください。構文はほぼ同じで、PathPattern
は Web の使用に合わせて調整され、より効率的です。
デフォルトでは、リダイレクト URL は、現在の ServletContext に相対的である、つまり Web アプリケーションのルートに相対的であると想定されています。
public void addStatusController(StringSE urlPath, HttpStatus statusCode)
パターン構文については、解析されたパターンが enabled
の場合は PathPattern
を、それ以外の場合は AntPathMatcher
を参照してください。構文はほぼ同じで、PathPattern
は Web の使用に合わせて調整され、より効率的です。
public void setOrder(int order)
HandlerMapping
に使用する順序を指定します。デフォルトでは、これは 1 に設定されています。つまり、0 で並べられたアノテーション付きコントローラーの直後です。
@Nullable protected SimpleUrlHandlerMapping buildHandlerMapping()
HandlerMapping
、または登録なしの null
を返します。