Merge r1504290 from branch-2 to branch-2.1-beta for YARN-865. RM webservices can't query based on application Types. Contributed by Xuan Gong.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.1-beta@1504291 13f79535-47bb-0310-9956-ffa450edef68
HDFS-5005. Merging change r1504327 from branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.1-beta@1504328 13f79535-47bb-0310-9956-ffa450edef68