I have small embedded server supporting HTTPS using Spark. I also want to support/catch some HTTP calls; e.g. like a help page and some redirections.
For example a help page:
http://localhost:8088/help .... renders .... http::8088//localhost/help.html
or a login page:
http://localhost::8088/login ... renders .... https::8089//localhost/login.html
I have progressed to the stage where I have an embedded server that responds to either HTTP xor HTTPS -- One or the other, not both together. Is it possible to respond to both protocols with the same embedded Jetty (via Spark) server? If not, is it feasible to run two Jetty servers in the same embedded application? Can I run two Spark servers in the same application? (I'm taking it as 'read' that if Jetty won't do it asking Spark for that service will be a dead-end).
My preferred answer would be if I can use my Spark server to listen and handle both protocols. My investigation so far suggest that only one mode is possible, largely because Spark is actually a static library you can only set-one port; and you may only have one 'Spark' server. Has anyone used the same port for both HTTP and HTTPS? (That just doesn't seem 'good' to me).
I did find Unit Test code that looked like it was using both protocols, TestSparkUtil here:
However that's testing the server and uses lots of deprecated API-s. One final thought is, can I use a second (embedded) Jetty-only servlet to redirect HTTP calls to HTTPS? Would you recommend that?
I'm sure there's an elegant solution here. Thanks in advance for your time to consider the questions framed herewithin.