Alle Artikel der 'Java' Kategorie


Implementing HTTP/2 push in Java

This is another guest post by my friend Tobi. —Jörn The story: Some months ago I started to play around with HTTP/2 and wondered what should get better with this piece of technology, where are the limitations and pitfalls. So I first went to Wikipedia and read the Wikipedia article about HTTP/2 and the RFC […]

Security Trolls

Here’s how I imagine a security troll works: Google for “md5” or “sha1”. Look for blog posts that discuss those hashing algorithms in some security context, like storing passwords or checking file integrity. Then post a comment that’s barely more than this: “md5 is insecure!”, replacing “md5” accordingly. Make sure to never add anything useful, like details, context or alternatives.

Java Tricks: Find out who invoked you

There is a setting in the log4j framework that allows you to log the exact location of where the logger was invoked (I’d provide a link to the related documentation, but I can’t find it; the lo4j site is a horrible mess). I always wondered how that works, here’s how: public class Invoker { public […]

Undo/redo command stack in Java

Another fragment that turned out to be useless for the project, but may come handy in the future. A port to JavaScript should be easy enough, too: import java.util.ArrayList; import java.util.List; public class CommandStack { /** * Implement for each individual change that can occur in an editor. * * Both {@link #execute()} and {@link […]

Eclipse Dev: Custom Search Page

This is for the archive and due to lack of useful tutorials on writing custom search pages in your own Eclipse plugin. It turned out that the default text search is good enough for my purposes, so I’ll stick it here as a future reference. To start, your Eclipse plugin needs to add org.eclipse.search as […]

Testing SSL Java web apps with mails

The guide How to configure SSL on the Jetty wiki guides you through creating a self-signed certificate, required for developing and testing Java web applications that require SSL. The guide works fine, but causes a hard-to-debug side effect. By creating your own keystore, you exclude the default list of trusted certificates. This is a problem […]

Hotfixing Java frameworks

I’m currently working on a web application that uses the Apache Wicket web framework. While implementing a new feature related to file uploads, I stumbled about a problem that turned out to be a known issue. The bug was already fixed in Wicket’s trunk, though not yet released. The scheduled version for the release is […]

Barrier to entry for PHP and Java web applications

Jeff Atwood’s latest post on PHP sucking hard, while powering a very decent amount of the internet, got my attention. Not so much by the content itself, but rather because I was thinking about PHP and Java web applications a lot lately anyway. This blog is powered by PHP and I write little PHP scripts […]

Closures in Java and Scala

People argue that verbose code is easier to understand. Do you agree when reading these two? public List<Item> bought(User user) { List<Item> result = new ArrayList(); for (Item item : currentItems) { if (user.bought(item)) { result.add(item); } } return result; } def bought(user: User): List[Item] = { items.filter(user bought _) } If you are familiar […]

Why open source?

While glancing over Dr. Dobb’s article Getting Started With jQuery I read this: Whether the motivation behind making their labors freely available is a matter of seeking recognition, resume building, free advertising for other services, bragging rights, or just plain old-fashioned altruism, we can gratefully take advantage of these tools. jQuery is one such tool. […]

How would jQuery look like in… Java?

I was thinking about how jQuery would look like when implemented in other languages: Is it possible to offer the same API jQuery currently provides in JavaScript? Is it easier, or more difficult? What are the differences? Since I’m most familiar with Java, I started to mock up some classes. I’m relying on some of […]