Building a Web-Based Java API Search

From time to time I play with web technologies to keep up with recent developments. While I know my network protocols pretty well, I'm not a frontend developer so I'm pretty useless when it comes to JavaScript or CSS. I believe in learning by doing, so I decided to build a simple web-based search for my most often used Java APIs.

The design is quite simple. A Python script generates a JSON-based index file for all the Java APIs listed in a config file. JavaScript code in an HTML page queries this static index and dynamically adjusts the page to show the search results. This obviously doesn't scale to a large amount of APIs because the index file would get too big, but for Java SE, Java EE, and Guava it's just over 1 MB. Apache's gzip compression reduces it to about 90 KB which in my opinion is still acceptable considering that the ETag makes sure clients don't have to download the file each time.

For the web design part I used Bootstrap, a powerful CSS framework that everybody seems to be using these days. I couldn't design a good looking web page to save my life, but thanks to Bootstrap, I don't have to. The JavaScript part heavily relies on JQuery which makes DOM manipulation feel almost elegant. But since this is still JavaScript, there's only so much it can do.

I've published the code on Github in case you're interested and put a demo site online that I use quite often when developing Java code.

social