import java.util.ListIterator;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.opendaylight.controller.filtervalve.cors.jaxb.Context;
throws IOException, ServletException {
String contextPath = request.getContext().getPath();
- String pathInfo = request.getPathInfo();
+ String path = request.getDecodedRequestURI();
Optional<Context> maybeContext = host.findContext(contextPath);
- logger.trace("Processing context {} path {}, found {}", contextPath, pathInfo, maybeContext);
+ logger.trace("Processing context {} path {}, found {}", contextPath, path, maybeContext);
if (maybeContext.isPresent()) {
// process filters
Context context = maybeContext.get();
- List<Filter> matchingFilters = context.findMatchingFilters(pathInfo);
+ List<Filter> matchingFilters = context.findMatchingFilters(path);
FilterChain fromLast = nextValveFilterChain;
ListIterator<Filter> it = matchingFilters.listIterator(matchingFilters.size());
final boolean trace = logger.isTraceEnabled();
while (it.hasPrevious()) {
final Filter currentFilter = it.previous();
final FilterChain copy = fromLast;
- fromLast = new FilterChain() {
- @Override
- public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
- if (trace) {
- logger.trace("Applying {}", currentFilter);
- }
- javax.servlet.Filter actualFilter = currentFilter.getActualFilter();
- actualFilter.doFilter(request, response, copy);
+ fromLast = (request1, response1) -> {
+ if (trace) {
+ logger.trace("Applying {}", currentFilter);
}
+ javax.servlet.Filter actualFilter = currentFilter.getActualFilter();
+ actualFilter.doFilter(request1, response1, copy);
};
}
// call first filter