final FilterChain chain)
throws ServletException, IOException {
if (request instanceof HttpServletRequest) {
final String headerValue = ((HttpServletRequest) request).getHeader(headerName);
if (headerValue != null) {
final Tenant tenant = tenantService.lookupTenantByKey(headerValue);
if (tenant != null) {
LOGGER.debug("Tenant being set for tenant key {}", headerValue);
TenantContextHolder.push(tenant);
try {
chain.doFilter(request, response);