Fork me on GitHub

what's a good way to consume everything currently in an input stream and return a string, while leaving the input stream open?


The Java Reader class has a ready method that returns true if the next read of a single character is guaranteed not to block. You could call that in a loop, append'ing characters read to a StringBuilder, and when ready returns false, call toString on the StringBuilder:

👍 4

hi wonderful clojure people,,, i was wondering, what version of java do you use locally and in live when you deploy? having a debate internally about all this


for example, do we feel openjdk 11's TLS support doesnt generally inhibit dev


Consistency between dev and deployed is more important that which version


If you are preparing for an upgrade you probably have to juggle multiple versions


what are you using @ghadi?


It varies by project. 8 or 11 for production purposes. Develop against 13 & trunk for work on Clojure itself


I deploy using 11.


actually, same as Ghadi 🙂


We've migrated all our services to Java 11 where fesible.


were the ones where it wasnt possible based on internal or external factors to your codebase?


As in, dependencies?


for instance, we had one service where we couldn't go to 11 based on a http clojar we were using not being up to speed with openjdk 11 tls


external, some things we're not touching as we're considering rewriting...and some things have dependencies that are so old that we thought - best leave alone for now, and rewrite later...perhaps 🙂


but in principle all new code targets 11.


we those, like moiself, on 13 as we like to live at the edge 🙂


found a prev convo on this from august t7th


Possibly impossible question, does anyone know off-hand how to grab the remote address of a get request in aleph? I've been reading all morning and can't seem to find a sane way to do this, the idea would be to have it returned in the response map. I'm open to using a different library as well.


@case sounds like the GET url is something your program would have to know about to make the request. You could just merge it into the response, right?


@denik sorry, my question wasn't formed very well. I want the final ipv4/v6 of the request. I have the URL, yes, but I don't want to sideband another DNS resolution to get the A record, which may not be the final one, since there could be a redirect on the HTTP server there.


@case In Ring, there's :remote-addr but if you're behind a load balancer, you may need to check headers, such as X-Forwarded-For. I suspect that depends on the HTTP server adapter in use, so I don't know if that's any help with aleph...

💯 4

Thanks @seancorfield, this is also for a client request, not a server accepting a connection.


Ah, so you want to resolve the domain name used in a get back to an IP address?


Correct, that would be ideal. I know Netty is doing it behind the scenes, just no clear way to propagate the value.


@case And this approach is not suitable?

user=> (map #(.getHostAddress %) ( ""))
("" "" "2620:1ec:c11:0:0:0:0:200")

👍 4

(the JVM caches DNS resolution, I believe, so if you've already reached out to a server via its domain name, the above should be low cost?)


I wasn't aware of the DNS cache! That's awesome, that's the main reason I wrote a solution like that off above. I'll keep looking for a middle-ware path and use that as an alternate. Thanks!