List the Named Tiles In the Repository

This web page uses a JavaScript call to the Map Tiling Service's REST interface to list the named tiles in the repository. The list of named tiles that is returned in the response is then displayed in a JavaScript alert box.

Here is the code:


<html>
    <body>
        <script type="text/javascript">
            function submitform()
            {
                //Create an XMLHttpRequest object or try ActiveX
                var req;
                if (typeof XMLHttpRequest != "undefined")
                {
                    req = new XMLHttpRequest();
                }
                else
                {
                    try
                    {
                        req = new ActiveXObject("Msxml2.XMLHTTP");
                    }
                    catch (e)
                    {
                        req = new ActiveXObject("Microsoft.XHTTP");
                    }
                }

                // populate the request, username and password
                var reqString = document.getElementById('request').value;
                var userName = document.getElementById('user').value;
                var password = document.getElementById('password').value;

                //Execute the REST request against a server secured with Basic Authentication
                req.open("GET", reqString, false, userName, password);
                req.send();

                //Display the response
                resp = req.response;
                alert(resp);
            }
        </script>
        <form action="javascript: submitform()">
            User: <input type="text" name="User" id="user" value="admin"/> &nbsp; Password: <input type="password" name="Password" id="password" value="admin"/><br />
            Request: <input type="text" name="request" id="request" value="http://MyServer:8080/rest/Spatial/MapTilingService/mapList.json"/><br />
            <input type="submit" value="Submit" />
        </form>
    </body>
</html>