Laurent Hinoul

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - John F. Woods

Category: Java

How to create a stream from an iterator in java 8

Hi guys! In this post I’ll show you how to convert an java iterator to a java 8 stream. The code is really simple:

Just copy paste this static method in any class you like. It’s generic so you can use this method for all types of iterators. Enjoy!

How to fix Unirest General SSLEngine problem

I tried to post data to a rest service using Unirest ( But when I tried to post to an HTTPS url, I got the following error:

To fix this, you could use the following code:

Then, you need to execute the code below before useing Unirest itself:

Hopefully this works for you too. Enjoy

How to create a vertx fat-jar with maven

If you use Vertx, It could be helpful to create a jar or war where Vertx is included. If you use maven. You can add the following code in your pom.xml:

If you integrated Spring, you need to add extra transformers. You can use the following code in your pom.xml for that:

Don’t forget to change ‘com.laurenthinoul….ApplicationMainClass’ to…

How to enable CORS in Solr

If you are using Solr with Angular or something like that. The browser can be anoying about cross site scripting. To enable CORS in Solr you just have to add the code below in solr-x.x.x/server/solr-webapp/webapp/WEB-INF/web.xml (x.x.x stands for the solr version). Just after the <web-app> tag.