-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update Dockerfile to use latest version of debian-ssh-12.6 imag…
…e and add dumb-init for process management
- Loading branch information
Showing
3 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
// Your First Program | ||
import com.sun.net.httpserver.HttpServer; | ||
import com.sun.net.httpserver.HttpHandler; | ||
import com.sun.net.httpserver.HttpExchange; | ||
|
||
class HelloWorld { | ||
public static void main(String[] args) { | ||
System.out.println("Hello, World!"); | ||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.net.InetSocketAddress; | ||
|
||
public class HelloWorld { | ||
public static void main(String[] args) throws IOException { | ||
HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0); | ||
server.createContext("/", new MyHandler()); | ||
server.setExecutor(null); | ||
server.start(); | ||
} | ||
|
||
static class MyHandler implements HttpHandler { | ||
public void handle(HttpExchange exchange) throws IOException { | ||
String response = "Hello, World!"; | ||
exchange.sendResponseHeaders(200, response.length()); | ||
OutputStream os = exchange.getResponseBody(); | ||
os.write(response.getBytes()); | ||
os.close(); | ||
} | ||
} | ||
} |
Empty file.