1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.jetty.spdy.client.http;
20
21 import org.eclipse.jetty.client.HttpChannel;
22 import org.eclipse.jetty.client.HttpDestination;
23 import org.eclipse.jetty.client.HttpExchange;
24 import org.eclipse.jetty.client.api.Result;
25 import org.eclipse.jetty.spdy.api.Session;
26
27 public class HttpChannelOverSPDY extends HttpChannel
28 {
29 private final HttpConnectionOverSPDY connection;
30 private final Session session;
31 private final HttpSenderOverSPDY sender;
32 private final HttpReceiverOverSPDY receiver;
33
34 public HttpChannelOverSPDY(HttpDestination destination, HttpConnectionOverSPDY connection, Session session)
35 {
36 super(destination);
37 this.connection = connection;
38 this.session = session;
39 this.sender = new HttpSenderOverSPDY(this);
40 this.receiver = new HttpReceiverOverSPDY(this);
41 }
42
43 public Session getSession()
44 {
45 return session;
46 }
47
48 public HttpSenderOverSPDY getHttpSender()
49 {
50 return sender;
51 }
52
53 public HttpReceiverOverSPDY getHttpReceiver()
54 {
55 return receiver;
56 }
57
58 @Override
59 public void send()
60 {
61 HttpExchange exchange = getHttpExchange();
62 if (exchange != null)
63 sender.send(exchange);
64 }
65
66 @Override
67 public void release()
68 {
69 connection.release(this);
70 }
71
72 @Override
73 public void exchangeTerminated(HttpExchange exchange, Result result)
74 {
75 super.exchangeTerminated(exchange, result);
76 release();
77 }
78 }