if you write the equals statements the other way around you don't ever risk NullPointerExceptions: "POST".equals(method)..