-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebServer.java
More file actions
37 lines (32 loc) · 1.13 KB
/
WebServer.java
File metadata and controls
37 lines (32 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.io.*;
import java.net.*;
import configuration.Htpassword;
import java.util.Base64;
import java.nio.charset.Charset;
import configuration.HttpdConfData;
public class WebServer{
private static HttpdConfData httpdData = new HttpdConfData();
public static void main(String[] args) throws IOException{
ServerSocket server = null;
//Htpassword ht = new Htpassword("C:/Users/shane/Desktop/SFSU/csc667-internet-application-design-and-development/webserver-csc667_server_project-shanew-matthewm/public_html/.htpasswd");
try {
server = new ServerSocket(httpdData.getPort());
System.out.println(httpdData.getPort());
while(true){
new Thread(new Worker(server.accept())).start();
}
} catch (IOException e) {
e.printStackTrace();
} finally{
if(server!=null){
try {
server.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
public WebServer(){
}
}