0

Extending WSO2 ES with new assets implies adding new resource types. For example, distribution of Android apps require the download of apk files.

I've added new associations to the mime.types file (on repository/conf/etc), but the server always responds with an empty Content-Type header (even after reboot).

What is the correct method to add new MIME types?

Community
  • 1
  • 1
mimaen
  • 21
  • 2

1 Answers1

1

Could you provide a bit more information on your use case?

EDIT: Changed the answer using the information provided in the comments

When the file is uploaded we store the content type of the resource. The problem seems to be related to this logic.

switch(file){
              case 'jpg':
                  contentType='image/jpg';
                  break;
              case 'png':
                  contentType='image/png';
                  break;
          }

Please change this to:

switch(file){
              case 'jpg':
                  contentType='image/jpg';
                  break;
              case 'png':
                  contentType='image/png';
                  break;
              case  'apk':
                  contentType='application/vnd.android.package-archive'
                  break;
              default:
                  contentType='';
                  break;
          }

Please let me know if this helps :)

Thanks , Sameera

sameera
  • 31
  • 2
  • 1) Added association (application/vnd.android.package-archive apk) to mime.types. 2) Reboot server. 3) Access to an APK asset on ES. 4) Server responds with a 'Content-Type:' (empty) header. 5) Client rejects app due to MIME type – mimaen Feb 03 '14 at 09:55
  • Is this APK file a property of an asset? (i.e. Have you defined a new asset type to encapsulate the APK) Note: Sorry about the late reply :) – sameera Feb 04 '14 at 10:55
  • Yes, it is a property defined on mobileapp assets, like the URL property of ebooks. Thanks for your support. – mimaen Feb 04 '14 at 20:49
  • Hi mimaen, I have updated the answer with a possible solution. – sameera Feb 05 '14 at 09:37
  • Hi sameera. I located the file utility.js and adding a new MIME to the code solves this issue. I think this is a drawback: whenever a publisher introduces a new format for an asset the sys admin has to modify the code. For example: WS ES out-of the-box manages eBooks, but only on PDF format due to this issue. Thanks – mimaen Feb 05 '14 at 13:40
  • Hi mimaen, This will be an area we will be looking to improve in a future release of ES. I have created a JIRA to track this issue: https://wso2.org/jira/browse/STORE-384 – sameera Feb 06 '14 at 13:37