001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.access.common.pattern; 015 016import java.util.Enumeration; 017 018import ch.qos.logback.access.common.PatternLayout; 019import ch.qos.logback.access.common.spi.IAccessEvent; 020import ch.qos.logback.core.CoreConstants; 021 022/** 023 * This class is tied to the <code>fullRequest</code> conversion word. 024 * <p> 025 * It has been removed from the {@link PatternLayout} 026 * since it needs further testing before wide use. 027 * <p> 028 * 029 * @author Ceki Gülcü 030 * @author Sébastien Pennec 031 */ 032public class FullRequestConverter extends AccessConverter { 033 034 @Override 035 public String convert(IAccessEvent ae) { 036 StringBuilder buf = new StringBuilder(); 037 buf.append(ae.getRequestURL()); 038 buf.append(CoreConstants.LINE_SEPARATOR); 039 040 Enumeration<String> headerNames = ae.getRequestHeaderNames(); 041 while (headerNames.hasMoreElements()) { 042 String name = headerNames.nextElement(); 043 buf.append(name); 044 buf.append(": "); 045 buf.append(ae.getRequestHeader(name)); 046 buf.append(CoreConstants.LINE_SEPARATOR); 047 } 048 buf.append(CoreConstants.LINE_SEPARATOR); 049 buf.append(ae.getRequestContent()); 050 return buf.toString(); 051 } 052 053}