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 {
CreateRawRequest(clientOutput,statusCode,statusMsg,"text/html","\nWe're sorry, your webpage is in another castle!".getBytes());
System.out.println("Sent [404] "+statusMsg+" to client "+client+" for "+file+".");
}
} else {
CreateRawRequest(clientOutput,statusCode,statusMsg,"text/html","\nWe're sorry, your webpage exploded!".getBytes());
System.out.println("Sent ["+statusCode+"] "+statusMsg+" to client "+client+" for "+file+".");
}
clientOutput.write("\r\n\r\n".getBytes());
clientOutput.flush();
client.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}