[Mapserver-dev] MIME Types...
jhart at frw.uva.nl
Tue Nov 4 05:47:13 EST 2003
I still think that adding a MIMETYPE keyword would be the simplest
solution. MapServer sends back either a raw image (MODE=MAP, SCALEBAR,
LEGEND) or an interpolated template file (MODE=BROWSE, QUERY etc).
Preceding both is the http header, and one line in the header is the
"content-type" line, which tells the browser how to interpret the
following body (image, text, html etc). In case of a raw image,
Mapserver automatically deduces the content type from the OUTPUTFORMAT
driver (I guess). When a template is returned, MapServer has to specify
the content-type explicitly. It cannot do this from the OUTPUTFORMAT,
because this only describes the image format, only a part of the
template that is sent back. It could do this from the extension of the
original template, and I think it should do this for widely known output
types like svg, xml, swf or html. Gzip is another interesting option for
vector formats. To keep the door open for all other possible
content-types, the MIMETYPE keyword could override everything, when set
Steve Lime wrote:
> The only other thing I can think of is to leverage template file
> extensions. If I'm building up an SVG file from query results then I
> would name all involved templates .svg. So we'd get:
> .html or .htm => text/html
> .svg => image/svg+xml
> and so on but this list could get endless. I like Franks idea cause it
> opens the door for encoding operations like gzip. It's alot more complex
> to add to the code though, we'd need a default HTML driver. OutputFormat
> would be a more appropriate than ImageFormat...
>>>>Daniel Morissette <morissette at dmsolutions.ca> 11/3/2003 3:33:52 PM
> Steve Lime wrote:
>>Hi Folks: I/we need to be able to change MIME types for query
>>somehow. It's possible to output plain text, HTML, XML, SVG (with
>>shpxy tag) and even PHP code as a result of a query, but at the
>>everything is sent as text/html. I could add a msGetQueryMIMEType
>>function to examine template filename extensions and return a type,
>>I'm wondering if something more general for templates and images
>>might be warranted. Thoughts?
> FYI the WMS Server's GetFeatureInfo has a way to specify the MIME type
> returned by the query templates by setting the
> "wms_feature_info_mime_type" metadata in the top-level web object. I
> did this because there was no better mechanism in place but I would be
> very happy to change this to use a better mechanism if you create one.
> I've read both Frank and Jan's suggestions and I think they both have
> pros and cons... I'm not sure which one I prefer...
More information about the mapserver-dev