RequestParserFactory.cs 997 B

123456789101112131415161718192021222324252627282930313233
  1. using OSHttpServer.Parser;
  2. namespace OSHttpServer
  3. {
  4. /// <summary>
  5. /// Creates request parsers when needed.
  6. /// </summary>
  7. public class RequestParserFactory : IRequestParserFactory
  8. {
  9. /// <summary>
  10. /// Create a new request parser.
  11. /// </summary>
  12. /// <param name="logWriter">Used when logging should be enabled.</param>
  13. /// <returns>A new request parser.</returns>
  14. public IHttpRequestParser CreateParser(ILogWriter logWriter)
  15. {
  16. return new HttpRequestParser(logWriter);
  17. }
  18. }
  19. /// <summary>
  20. /// Creates request parsers when needed.
  21. /// </summary>
  22. public interface IRequestParserFactory
  23. {
  24. /// <summary>
  25. /// Create a new request parser.
  26. /// </summary>
  27. /// <param name="logWriter">Used when logging should be enabled.</param>
  28. /// <returns>A new request parser.</returns>
  29. IHttpRequestParser CreateParser(ILogWriter logWriter);
  30. }
  31. }