Added factory method to create the HttpChannel.
This commit is contained in:
parent
cdfa515ca3
commit
4eef2a347f
|
@ -82,6 +82,11 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
|
||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Flusher getFlusher()
|
||||||
|
{
|
||||||
|
return flusher;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(Request request, Response.CompleteListener listener)
|
public void send(Request request, Response.CompleteListener listener)
|
||||||
{
|
{
|
||||||
|
@ -270,6 +275,11 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected HttpChannelOverFCGI newHttpChannel(int id, Request request)
|
||||||
|
{
|
||||||
|
return new HttpChannelOverFCGI(this, getFlusher(), id, request.getIdleTimeout());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
|
@ -295,7 +305,7 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
|
||||||
|
|
||||||
// FCGI may be multiplexed, so create one channel for each request.
|
// FCGI may be multiplexed, so create one channel for each request.
|
||||||
int id = acquireRequest();
|
int id = acquireRequest();
|
||||||
HttpChannelOverFCGI channel = new HttpChannelOverFCGI(HttpConnectionOverFCGI.this, flusher, id, request.getIdleTimeout());
|
HttpChannelOverFCGI channel = newHttpChannel(id, request);
|
||||||
channels.put(id, channel);
|
channels.put(id, channel);
|
||||||
if (channel.associate(exchange))
|
if (channel.associate(exchange))
|
||||||
channel.send();
|
channel.send();
|
||||||
|
|
|
@ -41,12 +41,17 @@ public class HttpConnectionOverHTTP2 extends HttpConnection
|
||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Session getSession()
|
||||||
|
{
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void send(HttpExchange exchange)
|
protected void send(HttpExchange exchange)
|
||||||
{
|
{
|
||||||
normalizeRequest(exchange.getRequest());
|
normalizeRequest(exchange.getRequest());
|
||||||
// One connection maps to N channels, so for each exchange we create a new channel.
|
// One connection maps to N channels, so for each exchange we create a new channel.
|
||||||
HttpChannel channel = new HttpChannelOverHTTP2(getHttpDestination(), this, session);
|
HttpChannel channel = newHttpChannel();
|
||||||
channels.add(channel);
|
channels.add(channel);
|
||||||
if (channel.associate(exchange))
|
if (channel.associate(exchange))
|
||||||
channel.send();
|
channel.send();
|
||||||
|
@ -54,6 +59,11 @@ public class HttpConnectionOverHTTP2 extends HttpConnection
|
||||||
channel.release();
|
channel.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected HttpChannelOverHTTP2 newHttpChannel()
|
||||||
|
{
|
||||||
|
return new HttpChannelOverHTTP2(getHttpDestination(), this, getSession());
|
||||||
|
}
|
||||||
|
|
||||||
protected void release(HttpChannel channel)
|
protected void release(HttpChannel channel)
|
||||||
{
|
{
|
||||||
channels.remove(channel);
|
channels.remove(channel);
|
||||||
|
|
Loading…
Reference in New Issue