com.github.datalking.web.servlet.handler.HandlerExceptionResolverComposite Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of play-mvc Show documentation
Show all versions of play-mvc Show documentation
simple mvc framework based on java servlet.
The newest version!
package com.github.datalking.web.servlet.handler;
import com.github.datalking.common.Ordered;
import com.github.datalking.web.mvc.ModelAndView;
import com.github.datalking.web.servlet.HandlerExceptionResolver;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Collections;
import java.util.List;
/**
* @author yaoo on 5/4/18
*/
public class HandlerExceptionResolverComposite implements HandlerExceptionResolver, Ordered {
private List resolvers;
private int order = Ordered.LOWEST_PRECEDENCE;
public void setOrder(int order) {
this.order = order;
}
public int getOrder() {
return this.order;
}
public void setExceptionResolvers(List exceptionResolvers) {
this.resolvers = exceptionResolvers;
}
public List getExceptionResolvers() {
return Collections.unmodifiableList(resolvers);
}
public ModelAndView resolveException(HttpServletRequest request,
HttpServletResponse response,
Object handler,
Exception ex) {
if (resolvers != null) {
for (HandlerExceptionResolver handlerExceptionResolver : resolvers) {
ModelAndView mav = handlerExceptionResolver.resolveException(request, response, handler, ex);
if (mav != null) {
return mav;
}
}
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy