Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms\r\n").getBytes());
} else {
CreateRawRequest(clientOutput,statusCode,statusMsg,Files.probeContentType(file),Files.readAllBytes(file),Files.getLastModifiedTime(file));
String contentType = Files.probeContentType(file);
if (contentType!=null&&contentType.equals("text/html")) {
clientOutput.write(("Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms
\r\n").getBytes());
}
//System.out.println(contentType);
}
System.out.println("Sent "+file+" to client "+client+".");
} else {
System.out.println("Did not find "+file+". Sending an error instead.");
file=Paths.get(sigPlace.OUTDIR,"error.html");
CreateRawRequest(clientOutput,"404",statusMsg,Files.probeContentType(file),Files.readAllBytes(file),Files.getLastModifiedTime(file));
String contentType = Files.probeContentType(file);
if (contentType!=null&&contentType.equals("text/html")) {
clientOutput.write(("Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms
\r\n").getBytes());
}
}
} else {
CreateRawRequest(clientOutput,statusCode,statusMsg,Files.probeContentType(file),Files.readAllBytes(file),Files.getLastModifiedTime(file));
String contentType = Files.probeContentType(file);
if (contentType!=null&&contentType.equals("text/html")) {
clientOutput.write(("Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms
\r\n").getBytes());
}
}
clientOutput.write("\r\n\r\n".getBytes());
clientOutput.flush();
client.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}