001package org.apache.maven.wagon.tck.http.fixture; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.io.IOException; 023import java.util.Collections; 024import java.util.Enumeration; 025 026import javax.servlet.Filter; 027import javax.servlet.FilterChain; 028import javax.servlet.FilterConfig; 029import javax.servlet.ServletException; 030import javax.servlet.ServletRequest; 031import javax.servlet.ServletResponse; 032import javax.servlet.http.HttpServletRequest; 033 034import org.apache.log4j.Logger; 035 036/** 037 * 038 */ 039public class ProxyConnectionVerifierFilter 040 implements Filter 041{ 042 private static Logger logger = Logger.getLogger( ProxyConnectionVerifierFilter.class ); 043 044 public void destroy() 045 { 046 } 047 048 @SuppressWarnings( "unchecked" ) 049 public void doFilter( final ServletRequest req, final ServletResponse resp, final FilterChain chain ) 050 throws IOException, ServletException 051 { 052 HttpServletRequest request = (HttpServletRequest) req; 053 // HttpServletResponse response = (HttpServletResponse) resp; 054 055 Enumeration<String> kEn = request.getHeaderNames(); 056 for ( String key : Collections.list( kEn ) ) 057 { 058 if ( key == null ) 059 { 060 continue; 061 } 062 063 Enumeration<String> vEn = request.getHeaders( key ); 064 if ( vEn != null ) 065 { 066 for ( String val : Collections.list( vEn ) ) 067 { 068 logger.info( key + ": " + val ); 069 } 070 } 071 } 072 073 chain.doFilter( req, resp ); 074 } 075 076 public void init( final FilterConfig filterConfig ) 077 throws ServletException 078 { 079 } 080 081}