You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2016/05/01 12:56:35 UTC
[33/50] [abbrv] maven-aether git commit: Improved usability of
HttpServer
Improved usability of HttpServer
Project: http://git-wip-us.apache.org/repos/asf/maven-aether/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-aether/commit/c6cf8d7b
Tree: http://git-wip-us.apache.org/repos/asf/maven-aether/tree/c6cf8d7b
Diff: http://git-wip-us.apache.org/repos/asf/maven-aether/diff/c6cf8d7b
Branch: refs/heads/master
Commit: c6cf8d7bc11f04bc1824c9f3a80836a6b54fd883
Parents: f718cfb
Author: Benjamin Bentmann <be...@sonatype.com>
Authored: Sun Sep 28 18:56:46 2014 +0200
Committer: Benjamin Bentmann <be...@sonatype.com>
Committed: Sun Sep 28 18:56:46 2014 +0200
----------------------------------------------------------------------
.../aether/transport/http/HttpServer.java | 31 ++++++++++++++------
1 file changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-aether/blob/c6cf8d7b/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 60f316a..5e2707a 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
@@ -163,14 +163,17 @@ public class HttpServer
ssl.setTrustStorePassword( "client-pwd" );
ssl.setNeedClientAuth( true );
httpsConnector = new SslSelectChannelConnector( ssl );
- server.addConnector( httpsConnector );
- try
- {
- httpsConnector.start();
- }
- catch ( Exception e )
+ if ( server != null )
{
- throw new IllegalStateException( e );
+ server.addConnector( httpsConnector );
+ try
+ {
+ httpsConnector.start();
+ }
+ catch ( Exception e )
+ {
+ throw new IllegalStateException( e );
+ }
}
}
return this;
@@ -257,6 +260,10 @@ public class HttpServer
server = new Server();
server.addConnector( httpConnector );
+ if ( httpsConnector != null )
+ {
+ server.addConnector( httpsConnector );
+ }
server.setHandler( handlers );
server.start();
@@ -495,11 +502,17 @@ public class HttpServer
req.setHandled( true );
StringBuilder location = new StringBuilder( 128 );
String scheme = req.getParameter( "scheme" );
+ String host = req.getParameter( "host" );
+ String port = req.getParameter( "port" );
location.append( scheme != null ? scheme : req.getScheme() );
location.append( "://" );
- location.append( req.getServerName() );
+ location.append( host != null ? host : req.getServerName() );
location.append( ":" );
- if ( "http".equalsIgnoreCase( scheme ) )
+ if ( port != null )
+ {
+ location.append( port );
+ }
+ else if ( "http".equalsIgnoreCase( scheme ) )
{
location.append( getHttpPort() );
}