AbstractHandlerExceptionResolver.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:spring4-understanding 作者:
/**
 * Check whether this resolver is supposed to apply to the given handler.
 * <p>The default implementation checks against the specified mapped handlers
 * and handler classes, if any, and also checks the window state (according
 * to the "renderWhenMinimize" property).
 * @param request current portlet request
 * @param handler the executed handler, or {@code null} if none chosen at the
 * time of the exception (for example, if multipart resolution failed)
 * @return whether this resolved should proceed with resolving the exception
 * for the given request and handler
 * @see #setMappedHandlers
 * @see #setMappedHandlerClasses
 */
protected boolean shouldApplyTo(PortletRequest request, Object handler) {
    // If the portlet is minimized and we don't want to render then return null.
    if (WindowState.MINIMIZED.equals(request.getWindowState()) && !this.renderWhenMinimized) {
        return false;
    }
    // Check mapped handlers...
    if (handler != null) {
        if (this.mappedHandlers != null && this.mappedHandlers.contains(handler)) {
            return true;
        }
        if (this.mappedHandlerClasses != null) {
            for (Class<?> mappedClass : this.mappedHandlerClasses) {
                if (mappedClass.isInstance(handler)) {
                    return true;
                }
            }
        }
    }
    // Else only apply if there are no explicit handler mappings.
    return (this.mappedHandlers == null && this.mappedHandlerClasses == null);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号