-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHttpRunnableRequestHandler.java
More file actions
37 lines (32 loc) · 1.13 KB
/
HttpRunnableRequestHandler.java
File metadata and controls
37 lines (32 loc) · 1.13 KB
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
29
30
31
32
33
34
35
36
37
import java.io.IOException;
import org.apache.http.ConnectionClosedException;
import org.apache.http.HttpException;
import org.apache.http.HttpServerConnection;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpService;
public class HttpRunnableRequestHandler implements Runnable {
private final HttpService httpservice;
private final HttpServerConnection conn;
public HttpRunnableRequestHandler(
final HttpService httpservice,
final HttpServerConnection conn) {
this.httpservice = httpservice;
this.conn = conn;
}
public void run() {
HttpContext context = new BasicHttpContext(null);
try {
while (!Thread.interrupted() && this.conn.isOpen()) {
this.httpservice.handleRequest(this.conn, context);
}
} catch (ConnectionClosedException ex) {
} catch (IOException ex) {
} catch (HttpException ex) {
} finally {
try {
this.conn.shutdown();
} catch (IOException ignore) {}
}
}
}