Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[http] extract Multipart code into new ServletRequestMultipartWrapper #367

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,24 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
final ExtServletContext servletContext = pr.handler.getContext();
final RequestInfo requestInfo = new RequestInfo(pr.servletPath, pr.pathInfo, null, req.getRequestURI(),
pr.handler.getName(), pr.matchedPattern, pr.matchValue, pr.match, false);
final HttpServletRequest wrappedRequest = new ServletRequestWrapper(req, servletContext, requestInfo, null,
pr.handler.getServletInfo().isAsyncSupported(),
pr.handler.getMultipartConfig(),
pr.handler.getMultipartSecurityContext());

MultipartConfig multipartConfig = pr.handler.getMultipartConfig();
HttpServletRequest wrappedRequest;
if(multipartConfig==null){
wrappedRequest = new ServletRequestWrapper(req,
servletContext,
requestInfo,
null,
pr.handler.getServletInfo().isAsyncSupported());
}else {
wrappedRequest = new ServletRequestMultipartWrapper(req,
servletContext,
requestInfo,
null,
pr.handler.getServletInfo().isAsyncSupported(),
multipartConfig,
pr.handler.getMultipartSecurityContext());
}
final FilterHandler[] filterHandlers = handlerRegistry.getFilters(pr, req.getDispatcherType(), pr.requestURI);

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,24 @@ public void forward(ServletRequest request, ServletResponse response) throws Ser

try
{
final ServletRequestWrapper req = new ServletRequestWrapper((HttpServletRequest) request,
this.resolution.handler.getContext(),
this.requestInfo,
DispatcherType.FORWARD,
this.resolution.handler.getServletInfo().isAsyncSupported(),
this.resolution.handler.getMultipartConfig(),
this.resolution.handler.getMultipartSecurityContext());
MultipartConfig multipartConfig = this.resolution.handler.getMultipartConfig();
ServletRequestWrapper req;
if (multipartConfig == null) {
req = new ServletRequestWrapper((HttpServletRequest) request,
this.resolution.handler.getContext(),
this.requestInfo,
DispatcherType.FORWARD,
this.resolution.handler.getServletInfo().isAsyncSupported());

} else {
req = new ServletRequestMultipartWrapper((HttpServletRequest) request,
this.resolution.handler.getContext(),
this.requestInfo,
DispatcherType.FORWARD,
this.resolution.handler.getServletInfo().isAsyncSupported(),
multipartConfig,
this.resolution.handler.getMultipartSecurityContext());
}
final String requestURI = UriUtils.concat(this.requestInfo.servletPath, this.requestInfo.pathInfo);
final FilterHandler[] filterHandlers = this.resolution.handlerRegistry.getFilterHandlers(this.resolution.handler, DispatcherType.FORWARD, requestURI);

Expand Down Expand Up @@ -104,13 +115,25 @@ public void forward(ServletRequest request, ServletResponse response) throws Ser
@Override
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
final ServletRequestWrapper req = new ServletRequestWrapper((HttpServletRequest) request,
this.resolution.handler.getContext(),
this.requestInfo,
DispatcherType.INCLUDE,
this.resolution.handler.getServletInfo().isAsyncSupported(),
this.resolution.handler.getMultipartConfig(),
this.resolution.handler.getMultipartSecurityContext());
MultipartConfig multipartConfig = this.resolution.handler.getMultipartConfig();
ServletRequestWrapper req;
if (multipartConfig == null) {
req = new ServletRequestWrapper((HttpServletRequest) request,
this.resolution.handler.getContext(),
this.requestInfo,
DispatcherType.INCLUDE,
this.resolution.handler.getServletInfo().isAsyncSupported());
} else {
req = new ServletRequestMultipartWrapper((HttpServletRequest) request,
this.resolution.handler.getContext(),
this.requestInfo,
DispatcherType.INCLUDE,
this.resolution.handler.getServletInfo().isAsyncSupported(),
multipartConfig,
this.resolution.handler.getMultipartSecurityContext());

}

final String requestURI = UriUtils.concat(this.requestInfo.servletPath, this.requestInfo.pathInfo);
final FilterHandler[] filterHandlers = this.resolution.handlerRegistry.getFilterHandlers(this.resolution.handler, DispatcherType.INCLUDE, requestURI);

Expand Down
Loading
Loading