try to add a http server
This commit is contained in:
parent
eb4ee1b455
commit
b93859a4a5
@ -4,15 +4,6 @@
|
||||
For further reference, please consider the following sections:
|
||||
|
||||
* [Official Gradle documentation](https://docs.gradle.org)
|
||||
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.2/gradle-plugin/reference/html/)
|
||||
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.2/gradle-plugin/reference/html/#build-image)
|
||||
* [Flyway Migration](https://docs.spring.io/spring-boot/docs/2.7.2/reference/htmlsingle/#howto.data-initialization.migration-tool.flyway)
|
||||
* [Prometheus](https://docs.spring.io/spring-boot/docs/2.7.2/reference/htmlsingle/#actuator.metrics.export.prometheus)
|
||||
|
||||
### Guides
|
||||
The following guides illustrate how to use some features concretely:
|
||||
|
||||
* [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
|
||||
|
||||
### Additional Links
|
||||
These additional references should also help you:
|
||||
|
||||
Binary file not shown.
@ -1,7 +1,27 @@
|
||||
package ro.mihai;
|
||||
|
||||
import com.twitter.finagle.Service;
|
||||
import com.twitter.finagle.http.Http;
|
||||
import com.twitter.util.Future;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
Service<HttpRequest, HttpResponse> service = new Service<HttpRequest, HttpResponse>() {
|
||||
public Future<HttpResponse> apply(HttpRequest request) {
|
||||
return Future.value(
|
||||
new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK));
|
||||
}
|
||||
};
|
||||
|
||||
ServerBuilder.safeBuild(service, ServerBuilder.get()
|
||||
.codec(Http())
|
||||
.name("HttpServer")
|
||||
.bindTo(new InetSocketAddress("localhost", 5151)));
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user