001/*
002 * Copyright 2002-2016 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.web.servlet.AsyncHandlerInterceptor;
023import org.springframework.web.servlet.ModelAndView;
024
025/**
026 * Abstract adapter class for the {@link AsyncHandlerInterceptor} interface,
027 * for simplified implementation of pre-only/post-only interceptors.
028 *
029 * @author Juergen Hoeller
030 * @since 05.12.2003
031 */
032public abstract class HandlerInterceptorAdapter implements AsyncHandlerInterceptor {
033
034        /**
035         * This implementation always returns {@code true}.
036         */
037        @Override
038        public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
039                        throws Exception {
040
041                return true;
042        }
043
044        /**
045         * This implementation is empty.
046         */
047        @Override
048        public void postHandle(
049                        HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView)
050                        throws Exception {
051        }
052
053        /**
054         * This implementation is empty.
055         */
056        @Override
057        public void afterCompletion(
058                        HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
059                        throws Exception {
060        }
061
062        /**
063         * This implementation is empty.
064         */
065        @Override
066        public void afterConcurrentHandlingStarted(
067                        HttpServletRequest request, HttpServletResponse response, Object handler)
068                        throws Exception {
069        }
070
071}