aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-07-26 11:51:02 (EDT)
committerThomas Becker2013-07-26 11:51:02 (EDT)
commitae785f034eac53d06414929d01f0110b7473cfdc (patch)
tree9d3879d0b7c45ee832b204150f4a9faadf42d8e6
parentaf82e49835a627d84839bbe5dbbc79916af49110 (diff)
downloadorg.eclipse.jetty.project-ae785f034eac53d06414929d01f0110b7473cfdc.zip
org.eclipse.jetty.project-ae785f034eac53d06414929d01f0110b7473cfdc.tar.gz
org.eclipse.jetty.project-ae785f034eac53d06414929d01f0110b7473cfdc.tar.bz2
Replace calls to deprecated HttpTransport.send(..) method in SPDY code
-rw-r--r--jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPSPDYConnection.java98
1 files changed, 48 insertions, 50 deletions
diff --git a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPSPDYConnection.java b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPSPDYConnection.java
index 2d3ac13..fad348e 100644
--- a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPSPDYConnection.java
+++ b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyHTTPSPDYConnection.java
@@ -232,51 +232,50 @@ public class ProxyHTTPSPDYConnection extends HttpConnection implements HttpParse
}
@Override
- public void reply(ReplyInfo replyInfo, Callback handler)
+ public void reply(ReplyInfo replyInfo, final Callback handler)
{
- try
- {
- Fields headers = new Fields(replyInfo.getHeaders(), false);
+ Fields headers = new Fields(replyInfo.getHeaders(), false);
- headers.remove(HTTPSPDYHeader.SCHEME.name(version));
+ headers.remove(HTTPSPDYHeader.SCHEME.name(version));
- String status = headers.remove(HTTPSPDYHeader.STATUS.name(version)).value();
- Matcher matcher = statusRegexp.matcher(status);
- matcher.matches();
- int code = Integer.parseInt(matcher.group(1));
- String reason = matcher.group(2).trim();
+ String status = headers.remove(HTTPSPDYHeader.STATUS.name(version)).value();
+ Matcher matcher = statusRegexp.matcher(status);
+ matcher.matches();
+ int code = Integer.parseInt(matcher.group(1));
+ String reason = matcher.group(2).trim();
- HttpVersion httpVersion = HttpVersion.fromString(headers.remove(HTTPSPDYHeader.VERSION.name(version)).value());
+ HttpVersion httpVersion = HttpVersion.fromString(headers.remove(HTTPSPDYHeader.VERSION.name(version)).value());
- // Convert the Host header from a SPDY special header to a normal header
- Fields.Field host = headers.remove(HTTPSPDYHeader.HOST.name(version));
- if (host != null)
- headers.put("host", host.value());
+ // Convert the Host header from a SPDY special header to a normal header
+ Fields.Field host = headers.remove(HTTPSPDYHeader.HOST.name(version));
+ if (host != null)
+ headers.put("host", host.value());
- HttpFields fields = new HttpFields();
- for (Fields.Field header : headers)
- {
- String name = camelize(header.name());
- fields.put(name, header.value());
- }
+ HttpFields fields = new HttpFields();
+ for (Fields.Field header : headers)
+ {
+ String name = camelize(header.name());
+ fields.put(name, header.value());
+ }
- // TODO: handle better the HEAD last parameter
- long contentLength = fields.getLongField(HttpHeader.CONTENT_LENGTH.asString());
- HttpGenerator.ResponseInfo info = new HttpGenerator.ResponseInfo(httpVersion, fields, contentLength, code,
- reason, false);
+ // TODO: handle better the HEAD last parameter
+ long contentLength = fields.getLongField(HttpHeader.CONTENT_LENGTH.asString());
+ HttpGenerator.ResponseInfo info = new HttpGenerator.ResponseInfo(httpVersion, fields, contentLength, code,
+ reason, false);
- // TODO use the async send
- send(info, null, replyInfo.isClose());
+ send(info, null, replyInfo.isClose(), new Adapter()
+ {
+ @Override
+ public void failed(Throwable x)
+ {
+ handler.failed(x);
+ }
+ });
- if (replyInfo.isClose())
- completed();
+ if (replyInfo.isClose())
+ completed();
- handler.succeeded();
- }
- catch (IOException x)
- {
- handler.failed(x);
- }
+ handler.succeeded();
}
private String camelize(String name)
@@ -295,25 +294,24 @@ public class ProxyHTTPSPDYConnection extends HttpConnection implements HttpParse
}
@Override
- public void data(DataInfo dataInfo, Callback handler)
+ public void data(DataInfo dataInfo, final Callback handler)
{
- try
- {
- // Data buffer must be copied, as the ByteBuffer is pooled
- ByteBuffer byteBuffer = dataInfo.asByteBuffer(false);
+ // Data buffer must be copied, as the ByteBuffer is pooled
+ ByteBuffer byteBuffer = dataInfo.asByteBuffer(false);
- // TODO use the async send with callback!
- send(null, byteBuffer, dataInfo.isClose());
+ send(null, byteBuffer, dataInfo.isClose(), new Adapter()
+ {
+ @Override
+ public void failed(Throwable x)
+ {
+ handler.failed(x);
+ }
+ });
- if (dataInfo.isClose())
- completed();
+ if (dataInfo.isClose())
+ completed();
- handler.succeeded();
- }
- catch (IOException x)
- {
- handler.failed(x);
- }
+ handler.succeeded();
}
}