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.urlrewrite;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.servlet.filters.BasePortalFilter;
020    
021    import javax.servlet.FilterChain;
022    import javax.servlet.FilterConfig;
023    import javax.servlet.http.HttpServletRequest;
024    import javax.servlet.http.HttpServletResponse;
025    
026    /**
027     * @author L??szl?? Csontos
028     */
029    public class UrlRewriteFilter extends BasePortalFilter {
030    
031            @Override
032            public void destroy() {
033                    if (_urlRewriteFilter != null) {
034                            _urlRewriteFilter.destroy();
035                    }
036    
037                    super.destroy();
038            }
039    
040            @Override
041            public void init(FilterConfig filterConfig) {
042                    super.init(filterConfig);
043    
044                    _urlRewriteFilter =
045                            new org.tuckey.web.filters.urlrewrite.UrlRewriteFilter();
046    
047                    _urlRewriteFilter.init(filterConfig);
048            }
049    
050            @Override
051            protected void processFilter(
052                            HttpServletRequest request, HttpServletResponse response,
053                            FilterChain filterChain)
054                    throws Exception {
055    
056                    if (_urlRewriteFilter != null) {
057                            _urlRewriteFilter.doFilter(request, response, filterChain);
058                    }
059            }
060    
061            private static Log _log = LogFactoryUtil.getLog(UrlRewriteFilter.class);
062    
063            private org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
064                    _urlRewriteFilter;
065    
066    }