提交 c41c97b3 编写于 作者: J Jesse Glick

@stephenc requested documentation of the deprecated FullDuplexHttpStream...

@stephenc requested documentation of the deprecated FullDuplexHttpStream constructor, and as it turns out it did not work.
上级 49f03607
......@@ -48,9 +48,15 @@ public class FullDuplexHttpStream {
return null;
}
/**
* @param target something like {@code http://jenkins/cli?remoting=true}
* which we then need to split into {@code http://jenkins/} + {@code cli?remoting=true}
* in order to construct a crumb issuer request
* @deprecated use {@link #FullDuplexHttpStream(URL, String, String)} instead
*/
@Deprecated
public FullDuplexHttpStream(URL target, String authorization) throws IOException {
this(new URL(target.toString().replaceFirst("/cli.*$", "")), target.toString().replaceFirst("(.+)/cli.*$", "$1"), authorization);
this(new URL(target.toString().replaceFirst("/cli.*$", "/")), target.toString().replaceFirst("^.+/(cli.*)$", "$1"), authorization);
}
/**
......@@ -92,8 +98,9 @@ public class FullDuplexHttpStream {
con.getOutputStream().close();
input = con.getInputStream();
// make sure we hit the right URL
if(con.getHeaderField("Hudson-Duplex")==null)
throw new IOException(target+" doesn't look like Jenkins");
if (con.getHeaderField("Hudson-Duplex") == null) {
throw new IOException(target + " does not look like Jenkins, or is not serving the HTTP Duplex transport");
}
// client->server uses chunked encoded POST for unlimited capacity.
con = (HttpURLConnection) target.openConnection();
......
......@@ -68,7 +68,8 @@ public class CLIActionTest {
public void testDuplexHttp() throws Exception {
pool = Executors.newCachedThreadPool();
try {
FullDuplexHttpStream con = new FullDuplexHttpStream(j.getURL(), "cli", null);
@SuppressWarnings("deprecation") // to verify compatibility of original constructor
FullDuplexHttpStream con = new FullDuplexHttpStream(new URL(j.getURL(), "cli"), null);
Channel ch = new ChannelBuilder("test connection", pool).build(con.getInputStream(), con.getOutputStream());
ch.close();
} finally {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册