I have a Java application that sometimes needs to generate a Content-Type header from a single file name. Is there a way to evaluate Content-Type for common extensions? (for example, ".pdf" displays "application / pdf", etc.)
Yes, URLConnection.guessContentTypeFromName does just that.
Yes, through the JavaBeans Activation Framework (javax.activation).
import java.io.File; import javax.activation.MimetypesFileTypeMap; ... return new MimetypesFileTypeMap().getContentType(new File("brognitz.jpg"));
, Java .
: , .
A hash table that you loaded using generic types ?
Source: https://habr.com/ru/post/1721227/More articles:Slurp - An INI file in CFML - initializationTrack form submission that doesn't submit anywhere - jqueryΠΡΠΈ ΡΠ΅Π΄Π°ΠΊΡΠΈΡΠΎΠ²Π°Π½ΠΈΠΈ ΡΠ΅ΠΊΡΡΠΎΠ²ΠΎΠ³ΠΎ Π²Π²ΠΎΠ΄Π°, ΠΊΠ°ΠΊ Ρ ΠΌΠΎΠ³Ρ Π²ΡΠΏΠΎΠ»Π½ΠΈΡΡ ΠΊΠΎΠ½ΠΊΡΠ΅ΡΠ½ΠΎΠ΅ Π΄Π΅ΠΉΡΡΠ²ΠΈΠ΅ JavaScript ΠΏΡΠΈ Π½Π°ΠΆΠ°ΡΠΈΠΈ ΠΊΠ»Π°Π²ΠΈΡΠΈ "Enter" Π±Π΅Π· ΡΠΎΡΠΌΡ onSubmit-ΠΎΠ±ΡΠ°Π±ΠΎΡΡΠΈΠΊΠ°? - javascriptSql Query First, Next, Last Rows in a set - sqlAdding data to Silverlight HTTP POST Async - http-postHow to create a primary key using SSIS? - sql-serverif a JAR is placed on a class of application classes, as we refer to it from the JSP - javaSQLAlchemy declarative concrete inheritance autoload table - pythonHow to determine which C / C ++ objects use the most memory - debuggingNamed Design Idiom and Inheritance - c ++All Articles