From 2bb2605abf53663bb7a3dcaf910653865f2a7c3d Mon Sep 17 00:00:00 2001 From: bquintanaj Date: Sun, 19 Feb 2017 10:32:28 +0100 Subject: [PATCH 1/5] Use an address for the InetAddress if provided --- .../engine/connector/HttpServerHelper.java | 30 ++++++++++---- .../engine/connector/HttpsServerHelper.java | 40 ++++++++----------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/modules/org.restlet/src/org/restlet/engine/connector/HttpServerHelper.java b/modules/org.restlet/src/org/restlet/engine/connector/HttpServerHelper.java index 4c489a5ac7..74c730a623 100644 --- a/modules/org.restlet/src/org/restlet/engine/connector/HttpServerHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/connector/HttpServerHelper.java @@ -24,15 +24,15 @@ package org.restlet.engine.connector; -import java.io.IOException; -import java.net.InetSocketAddress; - -import org.restlet.Server; -import org.restlet.data.Protocol; - import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; +import org.restlet.Server; +import org.restlet.data.Protocol; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; /** * Internal HTTP server connector. @@ -56,8 +56,22 @@ public HttpServerHelper(Server server) { @Override public void start() throws Exception { - this.server = HttpServer.create(new InetSocketAddress(getHelped() - .getPort()), 0); + String addr = getHelped().getAddress(); + // Use ephemeral port + int port = getHelped().getPort() > 0 ? getHelped().getPort() : 0; + + if (addr != null) { + // This call may throw UnknownHostException and otherwise always + // returns an instance of INetAddress. + // Note: textual representation of inet addresses are supported + InetAddress iaddr = InetAddress.getByName(addr); + setAddress(new InetSocketAddress(iaddr, port)); + } else { + setAddress(new InetSocketAddress(port)); + } + + // Complete initialization + server = HttpServer.create(getAddress(), 0); server.createContext("/", new HttpHandler() { @Override public void handle(HttpExchange httpExchange) throws IOException { diff --git a/modules/org.restlet/src/org/restlet/engine/connector/HttpsServerHelper.java b/modules/org.restlet/src/org/restlet/engine/connector/HttpsServerHelper.java index 54f95e6cf6..e81577152e 100644 --- a/modules/org.restlet/src/org/restlet/engine/connector/HttpsServerHelper.java +++ b/modules/org.restlet/src/org/restlet/engine/connector/HttpsServerHelper.java @@ -24,24 +24,22 @@ package org.restlet.engine.connector; -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLParameters; - +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpsConfigurator; +import com.sun.net.httpserver.HttpsParameters; +import com.sun.net.httpserver.HttpsServer; import org.restlet.Server; import org.restlet.data.Protocol; import org.restlet.engine.ssl.DefaultSslContextFactory; import org.restlet.engine.ssl.SslContextFactory; import org.restlet.engine.ssl.SslUtils; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsParameters; -import com.sun.net.httpserver.HttpsServer; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLParameters; +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; /** * Internal HTTPS server connector. Here is the list of additional parameters @@ -90,28 +88,24 @@ public void start() throws Exception { SslContextFactory sslContextFactory = SslUtils .getSslContextFactory(this); SSLContext sslContext = sslContextFactory.createSslContext(); + String addr = getHelped().getAddress(); + // Use ephemeral port + int port = getHelped().getPort() > 0 ? getHelped().getPort() : 0; if (addr != null) { // This call may throw UnknownHostException and otherwise always // returns an instance of INetAddress. // Note: textual representation of inet addresses are supported InetAddress iaddr = InetAddress.getByName(addr); - - // Note: the backlog of 50 is the default - setAddress(new InetSocketAddress(iaddr, getHelped().getPort())); + setAddress(new InetSocketAddress(iaddr, port)); } else { - int port = getHelped().getPort(); - - // Use ephemeral port - if (port > 0) { - setAddress(new InetSocketAddress(getHelped().getPort())); - } + setAddress(new InetSocketAddress(port)); } // Complete initialization - this.server = HttpsServer.create(new InetSocketAddress(getHelped() - .getPort()), 0); + server = HttpsServer.create(getAddress(), 0); + final SSLParameters sslParams = sslContext.getDefaultSSLParameters(); server.setHttpsConfigurator(new HttpsConfigurator(sslContext) { public void configure(HttpsParameters params) { From 1c7b8f6ff1aa9de40bead9390e3d9a0805e5966b Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Mon, 2 Oct 2017 09:03:00 +0200 Subject: [PATCH 2/5] Fixed links to Restlet Framework documentation --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4698dbab2b..0844448c8a 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,11 @@ http://restlet.com To learn more about Restlet Framework, please have a look at the following resources: -* [User Guide](http://restlet.com/technical-resources/restlet-framework/guide/2.3) -* [Tutorials](http://restlet.com/technical-resources/restlet-framework/tutorials/2.3) -* [JavaDocs](http://restlet.com/technical-resources/restlet-framework/javadocs/3.0) -* [Change Log](http://restlet.com/technical-resources/restlet-framework/misc/3.0/changes) -* [Download](http://restlet.com/downloads/current/) +* [User Guide](https://restlet.com/open-source/documentation/user-guide/2.3) +* [Tutorials](https://restlet.com/open-source/documentation/tutorials/2.3) +* [JavaDocs](https://restlet.com/open-source/documentation/javadocs/2.3) +* [Change Log](https://restlet.com/open-source/documentation/2.3/changelog) +* [Download](https://restlet.com/open-source/downloads/current/) * [Issue Tracker](https://github.com/restlet/restlet-framework-java/issues) * [Mailing List](https://groups.google.com/a/restlet.org/forum/#!forum/framework-discuss) * [Stack Overflow](http://stackoverflow.com/questions/tagged/restlet) From 651c9856e55db30a73eeca1a4bdefb39db6da62d Mon Sep 17 00:00:00 2001 From: Jerome Louvel <374450+jlouvel@users.noreply.github.com> Date: Tue, 17 Dec 2019 14:48:00 +0100 Subject: [PATCH 3/5] Update README.md --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0844448c8a..a8ddf4c719 100644 --- a/README.md +++ b/README.md @@ -8,22 +8,21 @@ It is available in editions for all major platforms (Java SE/EE, Google App Engi It is available under the terms of either the Apache Software License 2.0 or the Eclipse Public License 1.0. -http://restlet.com +http://restlet.talend.com ## Learn more To learn more about Restlet Framework, please have a look at the following resources: -* [User Guide](https://restlet.com/open-source/documentation/user-guide/2.3) -* [Tutorials](https://restlet.com/open-source/documentation/tutorials/2.3) -* [JavaDocs](https://restlet.com/open-source/documentation/javadocs/2.3) -* [Change Log](https://restlet.com/open-source/documentation/2.3/changelog) -* [Download](https://restlet.com/open-source/downloads/current/) +* [User Guide](https://restlet.talend.com/documentation/user-guide/2.4/) +* [Tutorials](https://restlet.talend.com/documentation/tutorials/2.4/) +* [JavaDocs](https://restlet.talend.com/documentation/javadocs/2.4/) +* [Change Log](https://restlet.talend.com/documentation/2.4/changelog) +* [Download](https://restlet.talend.com/downloads/current/) * [Issue Tracker](https://github.com/restlet/restlet-framework-java/issues) * [Mailing List](https://groups.google.com/a/restlet.org/forum/#!forum/framework-discuss) * [Stack Overflow](http://stackoverflow.com/questions/tagged/restlet) -Copyright 2016 Restlet - -[![Build Status](https://travis-ci.org/restlet/restlet-framework-java.png?branch=master)](https://travis-ci.org/restlet/restlet-framework-java) +Copyright 2019 Talend +[![Build Status](https://travis-ci.org/restlet/restlet-framework-java.svg?branch=2.3)](https://travis-ci.org/restlet/restlet-framework-java) From a397f0824e2bb0d0073b79921703f0dee37165d2 Mon Sep 17 00:00:00 2001 From: Jerome Louvel <374450+jlouvel@users.noreply.github.com> Date: Tue, 17 Dec 2019 14:49:57 +0100 Subject: [PATCH 4/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8ddf4c719..c2d1f4c5d3 100644 --- a/README.md +++ b/README.md @@ -25,4 +25,4 @@ To learn more about Restlet Framework, please have a look at the following resou Copyright 2019 Talend -[![Build Status](https://travis-ci.org/restlet/restlet-framework-java.svg?branch=2.3)](https://travis-ci.org/restlet/restlet-framework-java) +[![Build Status](https://travis-ci.org/restlet/restlet-framework-java.svg?branch=master)](https://travis-ci.org/restlet/restlet-framework-java) From a967fa632e5c6bc583a952ce4cead591e13b86d3 Mon Sep 17 00:00:00 2001 From: Jerome Louvel <374450+jlouvel@users.noreply.github.com> Date: Fri, 3 May 2024 15:57:32 -0400 Subject: [PATCH 5/5] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c2d1f4c5d3..eabb7472a7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Restlet Framework -## The leading RESTful Web API framework for Java +## The first REST API framework for Java Thanks to Restlet Framework's powerful routing and filtering capabilities, unified client and server Java API, developers can build secure and scalable RESTful web APIs. @@ -23,6 +23,6 @@ To learn more about Restlet Framework, please have a look at the following resou * [Mailing List](https://groups.google.com/a/restlet.org/forum/#!forum/framework-discuss) * [Stack Overflow](http://stackoverflow.com/questions/tagged/restlet) -Copyright 2019 Talend +Copyright 2024 Qlik [![Build Status](https://travis-ci.org/restlet/restlet-framework-java.svg?branch=master)](https://travis-ci.org/restlet/restlet-framework-java)