|
@@ -1,5 +1,5 @@
|
|
/*
|
|
/*
|
|
- * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
|
|
|
|
|
+ * Copyright 2002-2021 the original author or authors.
|
|
*
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -29,6 +29,7 @@ import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
import javax.servlet.FilterChain;
|
|
import javax.servlet.FilterChain;
|
|
|
|
+import javax.servlet.ServletContext;
|
|
import javax.servlet.ServletRequest;
|
|
import javax.servlet.ServletRequest;
|
|
import javax.servlet.ServletResponse;
|
|
import javax.servlet.ServletResponse;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -78,10 +79,19 @@ public class FilterInvocation {
|
|
}
|
|
}
|
|
|
|
|
|
public FilterInvocation(String contextPath, String servletPath, String method) {
|
|
public FilterInvocation(String contextPath, String servletPath, String method) {
|
|
- this(contextPath, servletPath, null, null, method);
|
|
|
|
|
|
+ this(contextPath, servletPath, method, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public FilterInvocation(String contextPath, String servletPath, String method, ServletContext servletContext) {
|
|
|
|
+ this(contextPath, servletPath, null, null, method, servletContext);
|
|
}
|
|
}
|
|
|
|
|
|
public FilterInvocation(String contextPath, String servletPath, String pathInfo, String query, String method) {
|
|
public FilterInvocation(String contextPath, String servletPath, String pathInfo, String query, String method) {
|
|
|
|
+ this(contextPath, servletPath, pathInfo, query, method, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public FilterInvocation(String contextPath, String servletPath, String pathInfo, String query, String method,
|
|
|
|
+ ServletContext servletContext) {
|
|
DummyRequest request = new DummyRequest();
|
|
DummyRequest request = new DummyRequest();
|
|
contextPath = (contextPath != null) ? contextPath : "/cp";
|
|
contextPath = (contextPath != null) ? contextPath : "/cp";
|
|
request.setContextPath(contextPath);
|
|
request.setContextPath(contextPath);
|
|
@@ -90,6 +100,7 @@ public class FilterInvocation {
|
|
request.setPathInfo(pathInfo);
|
|
request.setPathInfo(pathInfo);
|
|
request.setQueryString(query);
|
|
request.setQueryString(query);
|
|
request.setMethod(method);
|
|
request.setMethod(method);
|
|
|
|
+ request.setServletContext(servletContext);
|
|
this.request = request;
|
|
this.request = request;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -160,6 +171,8 @@ public class FilterInvocation {
|
|
|
|
|
|
private String method;
|
|
private String method;
|
|
|
|
|
|
|
|
+ private ServletContext servletContext;
|
|
|
|
+
|
|
private final HttpHeaders headers = new HttpHeaders();
|
|
private final HttpHeaders headers = new HttpHeaders();
|
|
|
|
|
|
private final Map<String, String[]> parameters = new LinkedHashMap<>();
|
|
private final Map<String, String[]> parameters = new LinkedHashMap<>();
|
|
@@ -290,6 +303,15 @@ public class FilterInvocation {
|
|
this.parameters.put(name, values);
|
|
this.parameters.put(name, values);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ServletContext getServletContext() {
|
|
|
|
+ return this.servletContext;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void setServletContext(ServletContext servletContext) {
|
|
|
|
+ this.servletContext = servletContext;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
static final class UnsupportedOperationExceptionInvocationHandler implements InvocationHandler {
|
|
static final class UnsupportedOperationExceptionInvocationHandler implements InvocationHandler {
|