[OmniFaces utilities] The
getMimeType() method returns the mime type for the given file name. The mime type is determined based on file extension and configureable by <mime-mapping> entries in web.xml. When the mime type is unknown, then a default of application/octet-stream will be returned.Method:
See also: Faces#getContext()
Usage:
import
org.omnifaces.util.Faces;
...
// e.g. image/png
String
mimetype = Faces.getMimeType("rafa.png");
You may need
the mime type of a file at download, in order to set the content type, as
below:
response.setContentType(mimetype);







JSF 2 Tutorials at www.mkyong.com
JavaServer Faces (JSF) Tutorial 

















Niciun comentariu :
Trimiteți un comentariu