Refactored .trim() to method

The falsy behaviour derives from two different apache-common versions, (1.4 vs 1.7) where the older one has multi-line chunking and the newer single-line non-chunking. This is hard to test and will not be tested as agreed upon with Tom Vollerthun