refactoring HeaderAdapter.java