001/*
002 * Copyright 2002-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.web.servlet.handler;
018
019import javax.servlet.http.HttpServletRequest;
020import javax.servlet.http.HttpServletResponse;
021
022import org.springframework.lang.Nullable;
023import org.springframework.web.servlet.AsyncHandlerInterceptor;
024import org.springframework.web.servlet.ModelAndView;
025
026/**
027 * Abstract adapter class for the {@link AsyncHandlerInterceptor} interface,
028 * for simplified implementation of pre-only/post-only interceptors.
029 *
030 * @author Juergen Hoeller
031 * @since 05.12.2003
032 */
033public abstract class HandlerInterceptorAdapter implements AsyncHandlerInterceptor {
034
035        /**
036         * This implementation always returns {@code true}.
037         */
038        @Override
039        public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
040                        throws Exception {
041
042                return true;
043        }
044
045        /**
046         * This implementation is empty.
047         */
048        @Override
049        public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
050                        @Nullable ModelAndView modelAndView) throws Exception {
051        }
052
053        /**
054         * This implementation is empty.
055         */
056        @Override
057        public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,
058                        @Nullable Exception ex) throws Exception {
059        }
060
061        /**
062         * This implementation is empty.
063         */
064        @Override
065        public void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response,
066                        Object handler) throws Exception {
067        }
068
069}