back port from trunk r1368433 (TILES-557) and r1422025


git-svn-id: https://svn.apache.org/repos/asf/tiles/framework/branches/TILES_3_0_X@1484309 13f79535-47bb-0310-9956-ffa450edef68