maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [21/50] [abbrv] maven-aether git commit: Extended HttpServer with customizable server response header
Date Sun, 01 May 2016 10:56:23 GMT
Extended HttpServer with customizable server response header


Project: http://git-wip-us.apache.org/repos/asf/maven-aether/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-aether/commit/6ac187b2
Tree: http://git-wip-us.apache.org/repos/asf/maven-aether/tree/6ac187b2
Diff: http://git-wip-us.apache.org/repos/asf/maven-aether/diff/6ac187b2

Branch: refs/heads/master
Commit: 6ac187b260ef6fcd795dc120f0392d0a6e649adc
Parents: d252910
Author: Benjamin Bentmann <bentmann@sonatype.com>
Authored: Fri Aug 29 17:48:25 2014 +0200
Committer: Benjamin Bentmann <bentmann@sonatype.com>
Committed: Fri Aug 29 17:48:25 2014 +0200

----------------------------------------------------------------------
 .../aether/transport/http/HttpServer.java       | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-aether/blob/6ac187b2/aether-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpServer.java
----------------------------------------------------------------------
diff --git a/aether-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpServer.java
b/aether-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpServer.java
index 5fee786..a0f6a54 100644
--- a/aether-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpServer.java
+++ b/aether-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpServer.java
@@ -84,6 +84,8 @@ public class HttpServer
 
     private static final Logger log = LoggerFactory.getLogger( HttpServer.class );
 
+    private String serverHeader = "Dummy";
+
     private File repoDir;
 
     private boolean rangeSupport = true;
@@ -166,6 +168,12 @@ public class HttpServer
         return logEntries;
     }
 
+    public HttpServer setServer( String server )
+    {
+        this.serverHeader = server;
+        return this;
+    }
+
     public HttpServer setRepoDir( File repoDir )
     {
         this.repoDir = repoDir;
@@ -227,6 +235,7 @@ public class HttpServer
         httpConnector = new SelectChannelConnector();
 
         HandlerList handlers = new HandlerList();
+        handlers.addHandler( new CommonHandler() );
         handlers.addHandler( new LogHandler() );
         handlers.addHandler( new ProxyAuthHandler() );
         handlers.addHandler( new AuthHandler() );
@@ -253,6 +262,18 @@ public class HttpServer
         }
     }
 
+    private class CommonHandler
+        extends AbstractHandler
+    {
+
+        public void handle( String target, Request req, HttpServletRequest request, HttpServletResponse
response )
+            throws IOException
+        {
+            response.setHeader( HttpHeaders.SERVER, serverHeader );
+        }
+
+    }
+
     private class LogHandler
         extends AbstractHandler
     {


Mime
View raw message