<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">On 1/16/14 7:27 AM, Ian Young wrote:<br>
</div>
<blockquote
cite="mid:A106211F-7458-4D9F-BC6C-A2256647AF88@iay.org.uk"
type="cite">
<pre wrap="">
</pre>
<br>
<pre wrap="">
That's interesting. I know Chad looked at a more fluent-style API, or at least the method chaining part of it, for some of our stuff (e.g., see <a class="moz-txt-link-freetext" href="https://issues.shibboleth.net/jira/browse/MDA-72">https://issues.shibboleth.net/jira/browse/MDA-72</a>). I'm not a big fan of the style myself, </pre>
</blockquote>
<br>
Me either really. Or at least, I'd prefer the option to do both
fluent style as well as Java bean style property setting for Spring
IoC, etc. Some of the Apache stuff doesn't support the latter
currently (below).<br>
<br>
<blockquote
cite="mid:A106211F-7458-4D9F-BC6C-A2256647AF88@iay.org.uk"
type="cite">
<pre wrap="">
For HttpClient, I found this:
        <a class="moz-txt-link-freetext" href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fluent.html">http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fluent.html</a>
That seems to imply it's an optional facade layer for the simplest use cases, though, not a general replacement. Is there some more information available?</pre>
</blockquote>
<br>
Ah, forgot about that. That's actually something else entirely, not
what I was referring to. That's their whole new Fluent API for the
entire request execution, etc. I believe that's even in a separate
project and Maven artifact from the main HttpClient stuff
(fluent-hc). Haven't looked at it much other than what is in that
section of the tutorial. I definitely didn't see us making use of
that...<br>
<br>
What I was referring to is that the "fluent mindset" seems to have
influenced (infected?) their main library in terms of how many of
these new mandatory builders work. For example, with their main
HttpClient builder you might do something like the following.
Most/all the methods there do a "return this" so you can chain in
fluent style:<br>
<br>
HttpClient httpClient =
HttpClientBuilder.create().addInterceptorLast(ri1).addInterceptorLast(ri2).disableContentCompression().disableRedirectHandling().build();<br>
<br>
<br>
Works the same for the regular setter methods on the builder, but I
picked those specific method examples because for those, there is
*not* a setter style for them. It does not for example support
something like the Java bean style that you'd need for it to work
with Spring XML directly:<br>
<br>
HttpClientBuilder builder = HttpClientBuilder.create()<br>
<br>
// These don't exist<br>
builder.setRequestInterceptors(listOfInterceptors);<br>
builder.setUseContentCompression(false)<br>
builder.setRedirectHandling(false)<br>
<br>
HttpClient httpClient = builder.build()<br>
<br>
<br>
So if you actually wanted to be able to wire those sorts of things
via Spring using their native builder, you'd have to write a Spring
factory bean that took those properties and invoked the builder
methods accordingly. Kind of annoying IMHO, since the 2 approaches
could exist side-by-side. But solvable easily enough with a little
code.<br>
<br>
Anyway, that implies to me that they seem to be skewing to the
fluent style (at least so far), and that's what I meant.<br>
<br>
--Brent<br>
<br>
<br>
<br>
</body>
</html>