How to get the mime type of a file?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2006 11:32 AM
Hi,
I want to get the mime type of a file when I get a ResultSet from the WebService. I searched, but it's not in the columns of the row..
Here is my code :
Thanks in advance for your help !
Regards,
Samuel
I want to get the mime type of a file when I get a ResultSet from the WebService. I searched, but it's not in the columns of the row..
Here is my code :
QueryResult rootChildren = WebServiceFactory.getRepositoryService().queryChildren(refEspaceAlfresco); ResultSet rootChildrenResults = rootChildren.getResultSet(); ResultSetRow[] rowsElementsDuLot = rootChildrenResults.getRows(); ResultSetRow row = null; ResultSetRowNode rsNode = null; for (int i = 0; i < rowsElementsDuLot.length; i++) { row = rowsElementsDuLot[i]; if (row.getNode().getType().equals(Constants.TYPE_CONTENT)) { [b]Here I want to get the mime type of the file… [/b] }
Thanks in advance for your help !
Regards,
Samuel
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2006 08:51 AM
Nobody can answer me ? Or show me a ressource for webservice help.
Because I the Alfresco Webservice wiki page don't help me a lot. And I found the class structure not intuitive
The Web services sample are great, but not very complete.
Thanks in advance
Because I the Alfresco Webservice wiki page don't help me a lot. And I found the class structure not intuitive
The Web services sample are great, but not very complete.
Thanks in advance
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2006 11:00 AM
I manage to gess the mime type with the file extension, but it's not a really good way, if the mime type is stocked somewere..

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2006 06:33 AM
Hi,
You want to look at the value of the content property returned in the query results.
On a normal content type node this is {http://www.alfresco.org/model/content/1.0}content. Its value should look something like this …
As you can see it is a string made up of the content location URL, the encoding and mimetype.
Currently there is no helper in the client to extract this information for you ( perhaps you counld add it 😉 ) but you should be able to extract the mime type fairly easily.
Hope this helps,
Roy
You want to look at the value of the content property returned in the query results.
On a normal content type node this is {http://www.alfresco.org/model/content/1.0}content. Its value should look something like this …
contentUrl=store://2006/4/26/16/a874f499-d539-11da-a07f-7f7271fd4b4e.bin|mimetype=text/plain|size=652|encoding=UTF-8
As you can see it is a string made up of the content location URL, the encoding and mimetype.
Currently there is no helper in the client to extract this information for you ( perhaps you counld add it 😉 ) but you should be able to extract the mime type fairly easily.
Hope this helps,
Roy
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2006 07:00 AM
Thanks for your answer ! I already saw the mime-type here, but I though there was a better way…
Anymay, I keep the file-type extraction with the file extension, because it's enough for me, but maybe later 😉
Anymay, I keep the file-type extraction with the file extension, because it's enough for me, but maybe later 😉
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2006 08:14 AM
Is there any solution to open a file with the proper software ? The .bin extension launchs a specific program which can't read the file.
I've thought to create a copy of the file and rename the .bin with the mimetype informations, but I would like to know if there is a faster way to do it ?
I've thought to create a copy of the file and rename the .bin with the mimetype informations, but I would like to know if there is a faster way to do it ?
