URI suffix and Media type |
SuperMap iServer determines a media type through requesting the URI suffix. The default relations between them are shown as follows:
Table The relations between URI suffix and media type
| URI suffix | Media type |
| html | text/html |
| xml | application/xml |
| kml | application/kml |
| georss | application/georss |
| json | application/json |
| jsonp | application/jsonp |
| rjson | application/rjson |
| png | image/png |
| bmp | image/bmp |
| gif | image/gif |
| jpg | image/jpg |
| jpeg | image/jpeg |
| 3D | application/realspace |
| javascript | application/javascript |
| ijs | application/ijs |
| flex | application/flex |
| flash3d | application/flash3d |
| ifx | application/ifx |
| silverlight | application/silverlight |
| isl | application/isl |
|
supermapcloud |
application/supermapcloud |
|
smc |
application/smc |
|
tianditu |
application/tianditu |
|
tdt |
application/tdt |
By default, the server determines the media type according to the URI suffix. The form is like " application/suffix". For example, if the suffix is cjson, the server will match the suffix to the media type of "application/cjson" so as to select a corresponding encoder for processing. The return media type is the HTTP response of application/cjson.
When you extend a new encoder, a new media type should be corresponding to the URI suffix. You can configure it in the following position:
1,iserver-rest-appContext.xml
iserver-rest-appContext.xml is in %SuperMap iServer_HOME%/webapps/iserver/WEB-INF/iserver-rest-appContext.xml. You can configure the relations at the <entry/> node(s).
<!-- The relations between the type and the URI suffix. -->
<util:map id="MediaTypeMappingInfoBean">
<!-- <entry key="xml" value="application/xml" /> -->
</util:map>
2. Jar:///META-INF/extensions/services/urlmapping/*.properties
The *.properties configuration file is in the Jar package. The content format is "* = *". The left side is URI suffix, and the right side is the media type. The configuration items are separated by by Enter.
Note: If you configure the relations at both two positions, the two are all valid. If the URI suffix (key value) repeats, the priority in iserver-rest-appContext.xml is highest.
For example, if you add a testurlmapping.properties file:
abc=application/xml
In Jar package, testurlmapping.properties is in test.jar:///META-INF/extensions/services/urlmapping/testurlmapping.properties, and test.jar is put into %SuperMap iServer Java_HOME%\webapps\iserver\WEB-INF\lib.
Start SuperMap iServer service, and open http://supermapiserver:8090/iserver/services/map-world/rest. The output format is "abc".

Click abc or type http://supermapiserver:8090/iserver/services/realspace-sample/rest/realspace.abc, the XML media type that corresponds to the abc suffix is shown in the web.