Adding a human readable media type is a new feature that will be available in the latest WSO2 G-Reg 4.1.1 packs.
The use of this feature comes in when you need to name you media types using something that is more readable than a technical term. For an example say we have media types such as image/x-coreldrawpattern with .pat extension and chemical/x-vamas-iso14976 with .vms extension or
application/vnd.symbian.install with .sis extension. It is really hard to remember these names.
This difficulty can be eliminated using human readable media types feature.
Following is how to configure this feature.
The use of this feature comes in when you need to name you media types using something that is more readable than a technical term. For an example say we have media types such as image/x-coreldrawpattern with .pat extension and chemical/x-vamas-iso14976 with .vms extension or
application/vnd.symbian.install with .sis extension. It is really hard to remember these names.
This difficulty can be eliminated using human readable media types feature.
Following is how to configure this feature.
- Open G-Reg-HOME/repository/conf/mime.types file. This will show you all the supported the mime.types.
- Select a mime type which you need to be mapped to a name of your choice.
- Open G-Reg-HOME/repository/conf/mime.mappings file. This is where we are going to add the new name that we are going to use for the given mime type. The new name you add in this file will map the extension given in the mime.type file.
- In mime.mappings file, copy the mime-type wanted to change and tab 5 times and type the custom name. See below for an example: line 20
# # Copyright 2005-2011 WSO2, Inc. (http://wso2.com) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # This file is to define the human readable media type for a mime type. # Eg:- # text/plain txt text application/wsdl+xml mywsdl
- Save and close the file.
- Restart the server.
- Login to G-Reg admin console
- Navigate to Resource > Browse
- Select to add a new resource.
- Add a new resource of the type that you adjusted above. When you select the resource you will see the media type that you gave appear in the 'media type' field. (see image below)