DNS Redirection and URL Modification are two major ways to carry out dynamic replica selections in CDN. However, the two ways may overload DNS servers or dispatchers, and exhaust the network bandwidth while there are a large number of incoming requests. Meanwhile, the modification of DNS servers for DNS Redirection harms the compatibility and troubles the management. Moreover, the two ways do not give local administrators the flexibility to customize accesses to foreign CDN applications. In the paper we propose Java Application's Packet Eavesdropper (JAPE) for CDN to improve DNS Redirection and URL Modification, and for local administrators to control the accesses. JAPE utilizes packet interception technologies for Java objects to process packets. Besides, objects in JAPE are Java Application rather than Java Applet, which not only keeps the inherent portability but also has the flexibility to use various Java libraries for creating other applications not limited to CDN. We implement JAPE in Windows 2000 and develop a CDN application with an object doing DNS Redirection and URL Modification. The application with location-aware features can locally resolve clients' requests toward a virtual host name and redirect them to a nearby server customized by local administrators according to the movements of clients. It proves that JAPE for CDN can free DNS servers from modifications, alleviate DNS servers' and dispatchers' loads, conserve the network bandwidth, and permit local administrators to customize the accesses.