using System; using System.Collections.Generic; using System.Web; namespace Apewer.Web { /// 选项。 public static class ApiOptions { #if DEBUG private static bool _allowexception = true; private static bool _jsonindent = true; #else private static bool _allowexception = false; private static bool _jsonindent = false; #endif private static bool _allowfavicon = false; private static bool _allowrobot = false; private static bool _allowenumerate = true; private static bool _showmodule = false; private static bool _showclass = false; private static int _port = 80; /// /// 允许 Invoker 解析 favicon.ico 请求。 /// 默认值:不允许,响应空。 public static bool AllowFavIcon { get { return _allowfavicon; } set { _allowfavicon = value; } } /// /// 允许 Invoker 解析 robot.txt 请求。 /// 默认值:不允许,拒绝搜索引擎收录根目录。 /// public static bool AllowRobot { get { return _allowrobot; } set { _allowrobot = value; } } /// /// 允许 Invoker 枚举输出 Applications 或 Functions。 /// 默认值:允许,输出列表。 /// public static bool AllowNumerate { get { return _allowenumerate; } set { _allowenumerate = value; } } /// /// 允许 Invoker 输出 Exception。 /// 默认值:允许,输出 Exception 对象的属性。 /// public static bool AllowException { get { return _allowexception; } set { _allowexception = value; } } /// /// 允许 Invoker 输出的 Json 对象缩进。 /// 默认值:不允许,不缩进。 /// public static bool JsonIndent { get { return _jsonindent; } set { _jsonindent = value; } } /// /// 允许 Invoker 输出 Application 列表时包含模块信息。 /// 默认值:不允许。 /// public static bool ShowModule { get { return _showmodule; } set { _showmodule = value; } } /// /// 允许 Invoker 输出 Application 列表时包含类型信息。 /// 默认值:不允许。 /// public static bool ShowClass { get { return _showclass; } set { _showclass = value; } } /// /// 获取或设置站点的端口,范围为 0 ~ 65535。 /// 默认值:80。 /// public static int Port { get { return _port; } set { _port = value < 0 ? 0 : (value > 65535 ? 65535 : value); } } } }