Merge remote-tracking branch 'origin/jetty-8'

Conflicts:
	jetty-server/src/main/java/org/eclipse/jetty/server/handler/RequestLogHandler.java
This commit is contained in:
Greg Wilkins 2013-07-04 17:28:22 +10:00
commit bce8eaabe0
2 changed files with 35 additions and 4 deletions

View File

@ -22,16 +22,15 @@ import java.io.IOException;
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;
import javax.servlet.DispatcherType;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.AsyncContextState;
import org.eclipse.jetty.server.HttpChannelState;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.RequestLog;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -46,6 +45,7 @@ import org.eclipse.jetty.util.log.Logger;
*/
public class RequestLogHandler extends HandlerWrapper
{
private static final Logger LOG = Log.getLogger(RequestLogHandler.class);
private RequestLog _requestLog;
private final AsyncListener _listener = new AsyncListener()
{
@ -114,5 +114,36 @@ public class RequestLogHandler extends HandlerWrapper
{
return _requestLog;
}
/* ------------------------------------------------------------ */
@Override
protected void doStart() throws Exception
{
if (_requestLog==null)
{
LOG.warn("!RequestLog");
_requestLog=new NullRequestLog();
}
super.doStart();
}
/* ------------------------------------------------------------ */
@Override
protected void doStop() throws Exception
{
super.doStop();
if (_requestLog instanceof NullRequestLog)
_requestLog=null;
}
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
private static class NullRequestLog extends AbstractLifeCycle implements RequestLog
{
@Override
public void log(Request request, Response response)
{
}
}
}

View File

@ -110,8 +110,8 @@ public class GzipTester
// Assert.assertThat("Response.status",response.getStatus(),is(HttpServletResponse.SC_OK));
// Response headers should have either a Transfer-Encoding indicating chunked OR a Content-Length
String contentLength = response.getHeader("Content-Length");
String transferEncoding = response.getHeader("Transfer-Encoding");
String contentLength = response.get("Content-Length");
String transferEncoding = response.get("Transfer-Encoding");
/* TODO need to check for the 3rd option of EOF content. To do this properly you might need to look at both HTTP/1.1 and HTTP/1.0 requests
boolean chunked = (transferEncoding != null) && (transferEncoding.indexOf("chunk") >= 0);