MCPcopy Index your code
hub / github.com/MapServer/MapServer / msWMSException

Function msWMSException

mapwms.c:70–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68*/
69
70int msWMSException(mapObj *map, int nVersion, const char *exception_code,
71 char *wms_exception_format)
72{
73 const char *encoding;
74 char *schemalocation = NULL;
75
76 /* Default to WMS 1.3.0 exceptions if version not set yet */
77 if (nVersion <= 0)
78 nVersion = OWS_1_3_0;
79
80 /* get scheam location */
81 schemalocation = msEncodeHTMLEntities( msOWSGetSchemasLocation(map) );
82
83 encoding = msOWSLookupMetadata(&(map->web.metadata), "MO", "encoding");
84
85 /* Establish default exception format depending on VERSION */
86 if (wms_exception_format == NULL)
87 {
88 if (nVersion <= OWS_1_0_0)
89 wms_exception_format = "INIMAGE"; /* WMS 1.0.0 */
90 else if (nVersion <= OWS_1_0_7)
91 wms_exception_format = "SE_XML"; /* WMS 1.0.1 to 1.0.7 */
92 else if (nVersion <= OWS_1_1_1)
93 wms_exception_format = "application/vnd.ogc.se_xml"; /* WMS 1.1.0 and later */
94 else
95 wms_exception_format = "text/xml";
96 }
97
98 if (strcasecmp(wms_exception_format, "INIMAGE") == 0 ||
99 strcasecmp(wms_exception_format, "BLANK") == 0 ||
100 strcasecmp(wms_exception_format, "application/vnd.ogc.se_inimage")== 0 ||
101 strcasecmp(wms_exception_format, "application/vnd.ogc.se_blank") == 0)
102 {
103 int blank = 0;
104
105 if (strcasecmp(wms_exception_format, "BLANK") == 0 ||
106 strcasecmp(wms_exception_format, "application/vnd.ogc.se_blank") == 0)
107 {
108 blank = 1;
109 }
110
111 msWriteErrorImage(map, NULL, blank);
112
113 }
114 else if (strcasecmp(wms_exception_format, "WMS_XML") == 0) /* Only in V1.0.0 */
115 {
116 if (encoding)
117 msIO_printf("Content-type: text/xml; charset=%s%c%c", encoding,10,10);
118 else
119 msIO_printf("Content-type: text/xml%c%c",10,10);
120
121 msIO_printf("<WMTException version=\"1.0.0\">\n");
122 msWriteErrorXML(stdout);
123 msIO_printf("</WMTException>\n");
124 }
125 else /* XML error, the default: SE_XML (1.0.1 to 1.0.7) */
126 /* or application/vnd.ogc.se_xml (1.1.0 and later) */
127 {

Callers 10

msWMSApplyTimeFunction · 0.85
msWMSLoadGetMapParamsFunction · 0.85
msWMSGetCapabilitiesFunction · 0.85
msWMSGetMapFunction · 0.85
msDumpResultFunction · 0.85
msWMSFeatureInfoFunction · 0.85
msWMSDescribeLayerFunction · 0.85
mapwms.cFile · 0.85
msWMSGetStylesFunction · 0.85
msWMSDispatchFunction · 0.85

Calls 8

msEncodeHTMLEntitiesFunction · 0.85
msOWSGetSchemasLocationFunction · 0.85
msOWSLookupMetadataFunction · 0.85
strcasecmpFunction · 0.85
msWriteErrorImageFunction · 0.85
msIO_printfFunction · 0.85
msWriteErrorXMLFunction · 0.85
msOWSPrintEncodeMetadataFunction · 0.85

Tested by

no test coverage detected