You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.9 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Web;
  4. namespace Apewer.Web
  5. {
  6. /// <summary>选项。</summary>
  7. public static class ApiOptions
  8. {
  9. #if DEBUG
  10. private static bool _allowexception = true;
  11. private static bool _jsonindent = true;
  12. #else
  13. private static bool _allowexception = false;
  14. private static bool _jsonindent = false;
  15. #endif
  16. private static bool _allowfavicon = false;
  17. private static bool _allowrobot = false;
  18. private static bool _allowenumerate = true;
  19. private static bool _showmodule = false;
  20. private static bool _showclass = false;
  21. private static int _port = 80;
  22. /// <summary>
  23. /// <para>允许 Invoker 解析 favicon.ico 请求。</para>
  24. /// <para>默认值:不允许,响应空。</para></summary>
  25. public static bool AllowFavIcon { get { return _allowfavicon; } set { _allowfavicon = value; } }
  26. /// <summary>
  27. /// <para>允许 Invoker 解析 robot.txt 请求。</para>
  28. /// <para>默认值:不允许,拒绝搜索引擎收录根目录。</para>
  29. /// </summary>
  30. public static bool AllowRobot { get { return _allowrobot; } set { _allowrobot = value; } }
  31. /// <summary>
  32. /// <para>允许 Invoker 枚举输出 Applications 或 Functions。</para>
  33. /// <para>默认值:允许,输出列表。</para>
  34. /// </summary>
  35. public static bool AllowNumerate { get { return _allowenumerate; } set { _allowenumerate = value; } }
  36. /// <summary>
  37. /// <para>允许 Invoker 输出 Exception。</para>
  38. /// <para>默认值:允许,输出 Exception 对象的属性。</para>
  39. /// </summary>
  40. public static bool AllowException { get { return _allowexception; } set { _allowexception = value; } }
  41. /// <summary>
  42. /// <para>允许 Invoker 输出的 Json 对象缩进。</para>
  43. /// <para>默认值:不允许,不缩进。</para>
  44. /// </summary>
  45. public static bool JsonIndent { get { return _jsonindent; } set { _jsonindent = value; } }
  46. /// <summary>
  47. /// <para>允许 Invoker 输出 Application 列表时包含模块信息。</para>
  48. /// <para>默认值:不允许。</para>
  49. /// </summary>
  50. public static bool ShowModule { get { return _showmodule; } set { _showmodule = value; } }
  51. /// <summary>
  52. /// <para>允许 Invoker 输出 Application 列表时包含类型信息。</para>
  53. /// <para>默认值:不允许。</para>
  54. /// </summary>
  55. public static bool ShowClass { get { return _showclass; } set { _showclass = value; } }
  56. /// <summary>
  57. /// <para>获取或设置站点的端口,范围为 0 ~ 65535。</para>
  58. /// <para>默认值:80。</para>
  59. /// </summary>
  60. public static int Port { get { return _port; } set { _port = value < 0 ? 0 : (value > 65535 ? 65535 : value); } }
  61. }
  62. }