I have a simple Java application that accepts an HTTP GET request and then if needed, makes another HTTP GET request to another external server, the application is very simple and it's using JDK HttpServer to manage the request and JDK HTTP Client to make the request. I need to run the application jar on a windows server and make it able to receive requests from other clients, I wouldn't install tomcat or similar and neither use an embedded server like Jetty, the most important thing for this application is to be the simplest as possible, with few rows of code and without using libraries or framework, this is the reason why I'm not using Spring or Jersey and I'm not running application on Servlet container like tomcat and so on. How can I expose the endpoint? Should I need to use IIS or is not required? Thanks in advance for your support!
Asked
Active
Viewed 33 times
0
-
You should keep in mind that the HTTP protocol was written in about 10 days, BUT the entire world of HTTP developers have spent the last 30 years trying to _secure_ it and make it work better. Good luck to you. – Randy Casburn Dec 16 '21 at 14:23
-
@RandyCasburn not at all, I've already developed the application as described in the answer you posted me, now what I need to do is to deploy it on windows server and make the http request accessible. On my machine is working fine, if I run the application and make a request to localhost:8000 I successfully get the right response. I want do the same but with the application hosten on a server and calling it from outside. – Lillo Dec 16 '21 at 14:41
-
@RandyCasburn I know it and I won't miss to implement all the security requirements, basic HttpServer from java JDK support TLS – Lillo Dec 16 '21 at 14:45
-
_How can I expose the endpoint_ - I don't understand this. Sounds like it is already exposed as part of running `HttpServer` – OneCricketeer Dec 16 '21 at 21:21
-
@OneCricketeer yes it is, because if I make a request to localhost:8080/myservice it answers successfully, but it is working on my local machina, how can I make it works on server windows? Opening traffic on 8080 port will be enough? Shold I use an IIS to do, I don't know, a bridge to the application using a connector? – Lillo Dec 17 '21 at 06:28
-
1You shouldn't need IIS. A reverse proxy would be useful (Nginx, Apache, Traefik, etc) but you've said that you don't want one. Just ensure the firewall allows incoming traffic to port 8080. – OneCricketeer Dec 17 '21 at 14:57
-
1Also make sure you're listening 0.0.0.0:8080, not 127.0.0.1:8080 – yyyy Dec 17 '21 at 15:11