All Downloads are FREE. Search and download functionalities are using the official Maven repository.

config.handler.yml Maven / Gradle / Ivy

The newest version!


# Handler middleware chain configuration
#----------------------------------------
enabled: true

# Configuration for the LightHttpHandler. The handler is the base class  for all middleware, server and health handlers
# set the Status Object in the AUDIT_INFO, for auditing purposes
# default, if not set:false
auditOnError: ${handler.auditOnError:false}

# set the StackTrace in the AUDIT_INFO, for auditing purposes
# default, if not set:false
auditStackTrace: ${handler.auditStackTrace:false}

#------------------------------------------------------------------------------
# Support individual handler chains for each separate endpoint. It allows framework
# handlers like health check, server info to bypass majority of the middleware handlers
# and allows mixing multiple frameworks like OpenAPI and GraphQL in the same instance.
#
# handlers  --  list of handlers to be used across chains in this microservice
#               including the routing handlers for ALL endpoints
#           --  format: fully qualified handler class name@optional:given name
# chains    --  allows forming of [1..N] chains, which could be wholly or
#               used to form handler chains for each endpoint
#               ex.: default chain below, reused partially across multiple endpoints
# paths     --  list all the paths to be used for routing within the microservice
#           ----  path: the URI for the endpoint (ex.: path: '/v1/pets')
#           ----  method: the operation in use (ex.: 'post')
#           ----  exec: handlers to be executed -- this element forms the list and
#                       the order of execution for the handlers
#
# IMPORTANT NOTES:
# - to avoid executing a handler, it has to be removed/commented out in the chain
#   or change the enabled:boolean to false for a middleware handler configuration.
# - all handlers, routing handler included, are to be listed in the execution chain
# - for consistency, give a name to each handler; it is easier to refer to a name
#   vs a fully qualified class name and is more elegant
# - you can list in chains the fully qualified handler class names, and avoid using the
#   handlers element altogether
#------------------------------------------------------------------------------
handlers:
  # Light-framework cross-cutting concerns implemented in the microservice
  - com.networknt.exception.ExceptionHandler@exception
  - com.networknt.metrics.MetricsHandler@metrics
  - com.networknt.traceability.TraceabilityHandler@traceability
  - com.networknt.correlation.CorrelationHandler@correlation
  - com.networknt.openapi.OpenApiHandler@specification
  - com.networknt.openapi.JwtVerifyHandler@security
  - com.networknt.body.BodyHandler@body 
  - com.networknt.audit.AuditHandler@audit
  # DumpHandler is to dump detail request/response info to log, useful for troubleshooting but not suggested to use in production due to it may lower the performance
  # - com.networknt.dump.DumpHandler@dump 
  - com.networknt.sanitizer.SanitizerHandler@sanitizer
  - com.networknt.openapi.ValidatorHandler@validator
  # Customer business domain specific cross-cutting concerns handlers
  # - com.example.validator.CustomizedValidator@custvalidator
  # Framework endpoint handlers
  - com.networknt.health.HealthGetHandler@health
  - com.networknt.info.ServerInfoGetHandler@info
  - com.networknt.logging.handler.LoggerGetHandler@getLogger
  - com.networknt.logging.handler.LoggerPostHandler@postLogger
  - com.networknt.logging.handler.LoggerGetLogContentsHandler@getLogContents
  - com.networknt.config.reload.handler.ModuleRegistryGetHandler@modules
  - com.networknt.config.reload.handler.ConfigReloadHandler@configReload
  - com.networknt.specification.SpecDisplayHandler@spec
  - com.networknt.specification.SpecSwaggerUIHandler@swaggerui
  # - com.networknt.metrics.prometheus.PrometheusGetHandler@getprometheus
  - com.networknt.server.handler.ServerShutdownHandler@shutdown
  - com.networknt.cache.CacheExplorerHandler@cache
  # Business Handlers
  - com.networknt.market.handler.StoreProductsGetHandler
  - com.networknt.market.handler.StoreProductsPostHandler


chains:
  default:
    - exception
    - metrics
    - traceability
    - correlation 
    - specification
    - security
    - body 
    - audit
#    - dump 
    - sanitizer
    - validator

paths:
  - path: '/v1/market/{store}/products'
    method: 'GET'
    exec:
      - default
      - com.networknt.market.handler.StoreProductsGetHandler
  - path: '/v1/market/{store}/products'
    method: 'POST'
    exec:
      - default
      - com.networknt.market.handler.StoreProductsPostHandler


  - path: '/health'
    method: 'get'
    exec:
      - health

  - path: '/adm/health/${server.serviceId:com.networknt.market-1.0.0}'
    method: 'get'
    exec:
      - security
      - health

  - path: '/adm/server/info'
    method: 'get'
    exec:
      - security
      - info

  - path: '/adm/logger'
    method: 'get'
    exec:
      - security
      - getLogger

  - path: '/adm/logger'
    method: 'post'
    exec:
      - security
      - body
      - postLogger
  - path: '/adm/logger/content'
    method: 'get'
    exec:
      - security
      - getLogContents

  - path: '/adm/modules'
    method: 'get'
    exec:
      - security
      - modules

  - path: '/adm/modules'
    method: 'post'
    exec:
      - security
      - body
      - configReload

  - path: '/adm/shutdown'
    method: 'delete'
    exec:
      - security
      - shutdown

  - path: '/adm/cache/{name}'
    method: 'get'
    exec:
      - security
      - cache


  - path: '/spec.yaml'
    method: 'get'
    exec:
      - spec
  - path: '/specui.html'
    method: 'get'
    exec:
      - swaggerui




© 2015 - 2025 Weber Informatics LLC | Privacy Policy