001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.servlet.filters.ignore;
016    
017    import com.liferay.portal.NoSuchLayoutException;
018    import com.liferay.portal.kernel.log.Log;
019    import com.liferay.portal.kernel.log.LogFactoryUtil;
020    import com.liferay.portal.servlet.filters.BasePortalFilter;
021    import com.liferay.portal.util.PortalUtil;
022    
023    import javax.servlet.FilterChain;
024    import javax.servlet.http.HttpServletRequest;
025    import javax.servlet.http.HttpServletResponse;
026    
027    /**
028     * @author Brian Wing Shun Chan
029     */
030    public class IgnoreFilter extends BasePortalFilter {
031    
032            @Override
033            protected void processFilter(
034                            HttpServletRequest request, HttpServletResponse response,
035                            FilterChain filterChain)
036                    throws Exception {
037    
038                    String currentURL = PortalUtil.getCurrentURL(request);
039    
040                    if (_log.isDebugEnabled()) {
041                            _log.debug("Ignore " + currentURL);
042                    }
043    
044                    PortalUtil.sendError(
045                            HttpServletResponse.SC_NOT_FOUND, new NoSuchLayoutException(),
046                            request, response);
047            }
048    
049            private static Log _log = LogFactoryUtil.getLog(IgnoreFilter.class);
050    
051    }