|
|
@ -6,14 +6,12 @@ import com.teamdev.jxbrowser.chromium.BrowserContext; |
|
|
|
import com.teamdev.jxbrowser.chromium.ProtocolService; |
|
|
|
import com.teamdev.jxbrowser.chromium.ProtocolService; |
|
|
|
import com.teamdev.jxbrowser.chromium.URLResponse; |
|
|
|
import com.teamdev.jxbrowser.chromium.URLResponse; |
|
|
|
|
|
|
|
|
|
|
|
import javax.activation.MimetypesFileTypeMap; |
|
|
|
|
|
|
|
import java.io.DataInputStream; |
|
|
|
import java.io.DataInputStream; |
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.nio.file.Paths; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author richie |
|
|
|
* @author richie |
|
|
@ -50,6 +48,19 @@ public class Assistant { |
|
|
|
if (path.endsWith(".svg")) { |
|
|
|
if (path.endsWith(".svg")) { |
|
|
|
return "image/svg+xml"; |
|
|
|
return "image/svg+xml"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (path.endsWith(".png")) { |
|
|
|
|
|
|
|
return "image/png"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (path.endsWith(".woff")) { |
|
|
|
|
|
|
|
return "font/woff"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (path.endsWith(".ttf")) { |
|
|
|
|
|
|
|
return "truetype"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (path.endsWith(".eot")) { |
|
|
|
|
|
|
|
return "embedded-opentype"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Path file = new File(path).toPath(); |
|
|
|
Path file = new File(path).toPath(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
return Files.probeContentType(file); |
|
|
|
return Files.probeContentType(file); |
|
|
|