May 2018
Intermediate to advanced
390 pages
9h 31m
English
We can also add custom filters in the Zuul microservice for implementing some cross-cutting concerns, such as security and rate-limiting. In the API Gateway components section, we discussed four filters—pre, post, route, and error. We can create these filters by extending the com.netflix.zuul.ZuulFilter class. We have to override filterType, filterOrder, and shouldFilter, and run methods. Let's see the following PreFilter custom filter:
package com.dineshonjava.apizuulservice.filters;import java.util.UUID;import javax.servlet.http.HttpServletRequest;import com.netflix.zuul.ZuulFilter;import com.netflix.zuul.context.RequestContext;import com.netflix.zuul.exception.ZuulException;public class PreFilter extends ZuulFilter{ ...Read now
Unlock full access