Index: src/Common/SharpMap/Web/Wms/WmsException.cs =================================================================== diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r5fc71a385897af92ccb092f2f969b5709afab85a --- src/Common/SharpMap/Web/Wms/WmsException.cs (.../WmsException.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9) +++ src/Common/SharpMap/Web/Wms/WmsException.cs (.../WmsException.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) @@ -15,100 +15,116 @@ // along with SharpMap; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +using System.Web; + namespace SharpMap.Web.Wms { - /// - /// Class for throwing WMS exceptions to client - /// - internal class WmsException - { - /// - /// WMS Exception codes - /// - internal enum WmsExceptionCode - { - /// - /// Request contains a Format not offered by the server. - /// - InvalidFormat, - /// - /// Request contains a CRS not offered by the server for one or more of the - /// Layers in the request. - /// - InvalidCRS, - /// - /// GetMap request is for a Layer not offered by the server, or GetFeatureInfo - /// request is for a Layer not shown on the map. - /// - LayerNotDefined, - /// - /// Request is for a Layer in a Style not offered by the server. - /// - StyleNotDefined, - /// - /// GetFeatureInfo request is applied to a Layer which is not declared queryable. - /// - LayerNotQueryable, - /// - /// GetFeatureInfo request contains invalid X or Y value. - /// - InvalidPoint, - /// - /// Value of (optional) UpdateSequence parameter in GetCapabilities request is - /// equal to current value of service metadata update sequence number. - /// - CurrentUpdateSequence, - /// - /// Value of (optional) UpdateSequence parameter in GetCapabilities request is - /// greater than current value of service metadata update sequence number. - /// - InvalidUpdateSequence, - /// - /// Request does not include a sample dimension value, and the server did not - /// declare a default value for that dimension. - /// - MissingDimensionValue, - /// - /// Request contains an invalid sample dimension value. - /// - InvalidDimensionValue, - /// - /// Request is for an optional operation that is not supported by the server. - /// - OperationNotSupported, - /// - /// No error code - /// - NotApplicable - } + /// + /// Class for throwing WMS exceptions to client + /// + internal class WmsException + { + /// + /// WMS Exception codes + /// + internal enum WmsExceptionCode + { + /// + /// Request contains a Format not offered by the server. + /// + InvalidFormat, - internal static void ThrowWmsException(string Message) - { - ThrowWmsException(WmsException.WmsExceptionCode.NotApplicable, Message); - } + /// + /// Request contains a CRS not offered by the server for one or more of the + /// Layers in the request. + /// + InvalidCRS, - internal static void ThrowWmsException(WmsExceptionCode code, string Message) - { - System.Web.HttpResponse Response = System.Web.HttpContext.Current.Response; - Response.Clear(); - Response.ContentType = "text/xml"; - Response.Write("\n"); - Response.Write("\n"); - Response.Write("" + Message + "\n"); - Response.Write(""); - Response.End(); - } + /// + /// GetMap request is for a Layer not offered by the server, or GetFeatureInfo + /// request is for a Layer not shown on the map. + /// + LayerNotDefined, - //private static System.Xml.Schema.XmlSchema GetExceptionSchema() - //{ - // //Get XML Schema - // System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("SharpMap.Web.Wms.Schemas._1._3._0.exceptions_1_3_0.xsd"); - // System.Xml.Schema.XmlSchema schema = System.Xml.Schema.XmlSchema.Read(stream, null); - // stream.Close(); - // return schema; - //} - } -} + /// + /// Request is for a Layer in a Style not offered by the server. + /// + StyleNotDefined, + + /// + /// GetFeatureInfo request is applied to a Layer which is not declared queryable. + /// + LayerNotQueryable, + + /// + /// GetFeatureInfo request contains invalid X or Y value. + /// + InvalidPoint, + + /// + /// Value of (optional) UpdateSequence parameter in GetCapabilities request is + /// equal to current value of service metadata update sequence number. + /// + CurrentUpdateSequence, + + /// + /// Value of (optional) UpdateSequence parameter in GetCapabilities request is + /// greater than current value of service metadata update sequence number. + /// + InvalidUpdateSequence, + + /// + /// Request does not include a sample dimension value, and the server did not + /// declare a default value for that dimension. + /// + MissingDimensionValue, + + /// + /// Request contains an invalid sample dimension value. + /// + InvalidDimensionValue, + + /// + /// Request is for an optional operation that is not supported by the server. + /// + OperationNotSupported, + + /// + /// No error code + /// + NotApplicable + } + + internal static void ThrowWmsException(string Message) + { + ThrowWmsException(WmsExceptionCode.NotApplicable, Message); + } + + internal static void ThrowWmsException(WmsExceptionCode code, string Message) + { + HttpResponse Response = HttpContext.Current.Response; + Response.Clear(); + Response.ContentType = "text/xml"; + Response.Write("\n"); + Response.Write("\n"); + Response.Write("" + Message + "\n"); + Response.Write(""); + Response.End(); + } + + // //Get XML Schema + //{ + + //private static System.Xml.Schema.XmlSchema GetExceptionSchema() + // System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("SharpMap.Web.Wms.Schemas._1._3._0.exceptions_1_3_0.xsd"); + // System.Xml.Schema.XmlSchema schema = System.Xml.Schema.XmlSchema.Read(stream, null); + // stream.Close(); + // return schema; + //} + } +} \ No newline at end of file