All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.frameworkset.web.servlet.handler.LoggerExceptionHandlerInterceptor Maven / Gradle / Ivy

Go to download

bboss is a j2ee framework include aop/ioc,mvc,persistent,taglib,rpc,event ,bean-xml serializable and so on.http://www.bbossgroups.com

The newest version!
package org.frameworkset.web.servlet.handler;
/**
 * Copyright 2020 bboss
 * 

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *

* http://www.apache.org/licenses/LICENSE-2.0 *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import org.frameworkset.web.servlet.HandlerInterceptor; import org.frameworkset.web.servlet.ModelAndView; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** *

Description:

*

*

Copyright (c) 2020

* @Date 2020/8/3 11:51 * @author biaoping.yin * @version 1.0 */ public class LoggerExceptionHandlerInterceptor implements HandlerInterceptor { private Logger logger = LoggerFactory.getLogger(LoggerExceptionHandlerInterceptor.class); @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, HandlerMeta handlerMeta) throws Exception { return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, HandlerMeta handlerMeta, ModelAndView modelAndView) throws Exception { } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, HandlerMeta handlerMeta, Exception ex) throws Exception { if(ex != null && logger.isErrorEnabled()){ StringBuilder builder = new StringBuilder(); builder.append("Request[").append(request.getRequestURI()).append("@").append(handlerMeta.toString()).append("] failed!"); logger.error(builder.toString(),ex); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy