Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

Script Library

  Debugging HttpResponse
 
  chubbard posted this script:
  Here is a handy function for understanding exactly what a HTTP server returned in response to a HttpUserAgent request.  Note that you can use this in conjunction with HttpUserAgent.simpleRequest() to determine if the initial response is a redirect to another location.

function ShowResponse(resp)
    {
    response.write("<ul>");
    for (var p in resp)
        {
        if (p == "content")
            continue;
        response.write("<li>" + p + ": ");
        if (p != "headers")
            response.write(resp[p] + "</li>");
        else
            {
            response.write("<ul>");
            for (var h in resp[p])
                response.write("<li>" + h + ": " + response.encodeHTML(resp[p][h]) + "</li>");
               
            response.write("</ul>");
            }
        }
    response.write("<li>content: " + resp["content"]);
               
    response.write("</ul>");
    }

Sample usage:

ShowResponse(HttpUserAgent.request("http://www.yahoo.com/"));

or

ShowResponse(HttpUserAgent.simpleRequest("http://www.westside.com/"));
 
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us