Showing posts with label human readable. Show all posts
Showing posts with label human readable. Show all posts

Tuesday, December 20, 2011

Adding a human readable media type to G-Reg

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.

  1. Open G-Reg-HOME/repository/conf/mime.types file. This will show you all the supported the mime.types. 
  2. Select a mime type which you need to be mapped to a name of your choice.
  3. 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.
  4. 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
    
    
  5. Save and close the file.
  6. Restart the server.
Lets follow these steps to witness the adjustment :)
  1. Login to G-Reg admin console
  2. Navigate to Resource > Browse
  3. Select to add a new resource.
  4. 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)




Featured

Selenium - Page Object Model and Action Methods

  How we change this code to PageObjectModel and action classes. 1 2 3 driver . findElement ( By . id ( "userEmail" )). sendKeys (...

Popular Posts