1 24 package org.riotfamily.website.interceptor; 25 26 import javax.servlet.RequestDispatcher ; 27 import javax.servlet.http.HttpServletRequest ; 28 import javax.servlet.http.HttpServletResponse ; 29 30 import org.apache.commons.logging.Log; 31 import org.apache.commons.logging.LogFactory; 32 import org.riotfamily.common.web.util.PathMatchingInterceptor; 33 import org.springframework.web.util.WebUtils; 34 35 41 public class IncludeOnlyInterceptor extends PathMatchingInterceptor { 42 43 private static Log log = LogFactory.getLog(IncludeOnlyInterceptor.class); 44 45 protected boolean doPreHandle(HttpServletRequest request, 46 HttpServletResponse response, Object handler) throws Exception { 47 48 if (!WebUtils.isIncludeRequest(request)) { 49 response.sendError(HttpServletResponse.SC_NOT_FOUND); 50 log.warn("Direct access prevented by IncludeOnlyInterceptor"); 51 return false; 52 } 53 return true; 54 } 55 56 } 57 | Popular Tags |