1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 package org.apache.hc.core5.http.impl.io;
29
30 import org.apache.hc.core5.annotation.Contract;
31 import org.apache.hc.core5.annotation.ThreadingBehavior;
32 import org.apache.hc.core5.http.ClassicHttpRequest;
33 import org.apache.hc.core5.http.HttpRequestFactory;
34 import org.apache.hc.core5.http.config.Http1Config;
35 import org.apache.hc.core5.http.io.HttpMessageParser;
36 import org.apache.hc.core5.http.io.HttpMessageParserFactory;
37 import org.apache.hc.core5.http.message.LazyLineParser;
38 import org.apache.hc.core5.http.message.LineParser;
39
40
41
42
43
44
45 @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
46 public class DefaultHttpRequestParserFactory implements HttpMessageParserFactory<ClassicHttpRequest> {
47
48 public static final DefaultHttpRequestParserFactoryquestParserFactory.html#DefaultHttpRequestParserFactory">DefaultHttpRequestParserFactory INSTANCE = new DefaultHttpRequestParserFactory();
49
50 private final LineParser lineParser;
51 private final HttpRequestFactory<ClassicHttpRequest> requestFactory;
52
53 public DefaultHttpRequestParserFactory(final LineParser lineParser,
54 final HttpRequestFactory<ClassicHttpRequest> requestFactory) {
55 super();
56 this.lineParser = lineParser != null ? lineParser : LazyLineParser.INSTANCE;
57 this.requestFactory = requestFactory != null ? requestFactory : DefaultClassicHttpRequestFactory.INSTANCE;
58 }
59
60 public DefaultHttpRequestParserFactory() {
61 this(null, null);
62 }
63
64 @Override
65 public HttpMessageParser<ClassicHttpRequest> create(final Http1Config http1Config) {
66 return new DefaultHttpRequestParser(this.lineParser, this.requestFactory, http1Config);
67 }
68
69 }