diff --git a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/Http2Server.java b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/Http2Server.java index 8b1ceb3dc66..a837691fe86 100644 --- a/examples/embedded/src/main/java/org/eclipse/jetty/embedded/Http2Server.java +++ b/examples/embedded/src/main/java/org/eclipse/jetty/embedded/Http2Server.java @@ -40,6 +40,7 @@ import javax.servlet.http.HttpSession; import org.eclipse.jetty.alpn.ALPN; import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; +import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory; import org.eclipse.jetty.jmx.MBeanContainer; import org.eclipse.jetty.server.HttpConfiguration; @@ -86,7 +87,7 @@ public class Http2Server http_config.setSendServerVersion(true); // HTTP Connector - ServerConnector http = new ServerConnector(server,new HttpConnectionFactory(http_config)); + ServerConnector http = new ServerConnector(server,new HttpConnectionFactory(http_config), new HTTP2CServerConnectionFactory(http_config)); http.setPort(8080); server.addConnector(http); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 50d69a6cf94..25daa3c5042 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1308,7 +1308,8 @@ public class Request implements HttpServletRequest @Override public String getRequestURI() { - return _metadata.getURI().getPath(); + MetaData metadata = _metadata; + return (metadata==null)?null:_metadata.getURI().getPath(); } /* ------------------------------------------------------------ */ diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java index afc261d9ffe..ca2e910b221 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java @@ -495,7 +495,7 @@ public class Server extends HandlerWrapper implements Attributes final Response response=connection.getResponse(); if (LOG.isDebugEnabled()) - LOG.debug(request.getDispatcherType()+" "+request.getMethod()+" "+target+" on "+connection); + LOG.debug("{} on {}{}",request.getDispatcherType(),connection,"\n"+request.getMethod()+" "+request.getHttpURI()+"\n"+request.getHttpFields()); if ("*".equals(target)) { @@ -507,7 +507,7 @@ public class Server extends HandlerWrapper implements Attributes handle(target, request, request, response); if (LOG.isDebugEnabled()) - LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus()+" handled="+request.isHandled()); + LOG.debug("RESPONSE for {} h={}{}",target,request.isHandled(),"\n"+response.getStatus()+" "+response.getReason()+"\n"+response.getHttpFields()); } /* ------------------------------------------------------------ */