Interface ErrorWebRouteInterceptorManager<A extends ExchangeContext,B extends ErrorWebRouteInterceptor<A>>

Type Parameters:
A - the exchange context type
B - the error Web route interceptor type

public interface ErrorWebRouteInterceptorManager<A extends ExchangeContext,B extends ErrorWebRouteInterceptor<A>>

Defines error Web route interceptors and creates decorated Web servers intercepting error Web routes.

An error Web route interceptor manager is obtained from WebServer.interceptError(), it allows to specify the criteria an error Web route must match to be intercepted by the exchange interceptors defined in interceptor(ExchangeInterceptor) or interceptors(List). These methods return the intercepted Web server which shall be used to define error Web routes intercepted when they are matching the defined criteria.

It is possible to specify multiple values for any given criteria resulting in multiple Web route interceptor definitions being created in the resulting Web route interceptor. For instance, the following code will result in two definitions being created:


 webServer
     .interceptError()
         .error(IllegalArgumentException.class)
         .error(BadRequestException.class)
         .interceptor(errorExchange -> {...})
 
Since:
1.12
Author:
Jeremy Kuhn
See Also:
  • Method Details

    • error

      Specifies the type of errors that must be matched by an error Web route to be intercepted.

      Parameters:
      error - an error type
      Returns:
      the interceptor manager
    • path

      Specifies the absolute path that must be matched by an error Web route to be intercepted.

      The specified path can be specified as a parameterized path and include path pattern like ?, *, ** as defined by URIBuilder. Note that this path is only meant to filter routes and as a result path parameters have no use.

      Parameters:
      path - a path
      Returns:
      the interceptor manager
      Throws:
      IllegalArgumentException - if the specified path is not absolute
    • path

      ErrorWebRouteInterceptorManager<A,B> path(String path, boolean matchTrailingSlash) throws IllegalArgumentException

      Specifies the absolute path that must be matched with or without trailing slash by an error Web route to be intercepted.

      The specified path can be specified as a parameterized path and include path pattern like ?, *, ** as defined by URIBuilder. Note that this path is only meant to filter routes and as a result path parameters have no use.

      Parameters:
      path - a path
      matchTrailingSlash - true to match path with or without trailing slash, false otherwise
      Returns:
      the interceptor manager
      Throws:
      IllegalArgumentException - if the specified path is not absolute
    • consume

      ErrorWebRouteInterceptorManager<A,B> consume(String mediaRange)

      Specifies the media range as defined by RFC 7231 Section 5.3.2 defining the content types accepted by an error Web route to be intercepted.

      Parameters:
      mediaRange - a media range (e.g. application/*)
      Returns:
      the interceptor manager
    • produce

      ErrorWebRouteInterceptorManager<A,B> produce(String mediaRange)

      Specifies the media range as defined by RFC 7231 Section 5.3.2 matching the content type produced by the error Web routes to intercept.

      Parameters:
      mediaRange - a media range (e.g. application/*)
      Returns:
      the interceptor manager
    • language

      ErrorWebRouteInterceptorManager<A,B> language(String languageRange)

      Specifies the language range as defined by RFC 7231 Section 5.3.5 matching the language produced by the error Web routes to intercept.

      Parameters:
      languageRange - a language range (e.g. *-FR)
      Returns:
      the interceptor manager
    • interceptor

      B interceptor(ExchangeInterceptor<? super A,ErrorWebExchange<A>> interceptor)

      Specifies the error Web exchange interceptor to apply to an error Web route matching the criteria specified in the route manager and returns an error Web route interceptor containing the newly defined interceptor definitions.

      The error Web route interceptor manager is usually obtained from WebServer.interceptError() in which case the resulting error Web route interceptor is a WebServer.Intercepted instance.

      Parameters:
      interceptor - an error Web exchange interceptor
      Returns:
      a new error Web route interceptor containing the configured interceptor
    • interceptors

      B interceptors(List<ExchangeInterceptor<? super A,ErrorWebExchange<A>>> interceptors)

      Specifies a list of error Web exchange interceptors to apply to an error Web route matching the criteria specified in the route manager and returns an error Web route interceptor containing the newly defined interceptor definitions.

      The error Web route interceptor manager is usually obtained from WebServer.interceptError() in which case the resulting error Web route interceptor is a WebServer.Intercepted instance.

      Parameters:
      interceptors - a list of error Web exchange interceptors
      Returns:
      a new error Web route interceptor containing the configured interceptor