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.

This entry was posted in misc and tagged , , . Bookmark the permalink.

2 Responses to Building a Web-Based Java API Search

  1. Marc says:

    Hi Matthias,

    nice work as usual. Perhaps there is a new career opportunity for you (Web Developer ;-) What about adding a filter for the Java version/Guava?

    Best regards

    • Matthias says:

      Hey Marc,

      thanks! Filtering is a good idea, feel free to send a patch ;-)

      I think the static index approach is pretty much at its limit though, maybe I should port this thing to ElasticSearch :)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s