Allow me to show off my neat request debugger method then, it's what I use for logging the stuff. I have it in my base action class and switch it on or off by the logger level. But you could put it in a JSP instead (with HTML). Specify if you want to see the request params, headers or attributes, and if you want plain text or HTML.

/**
* Extracts all request properties and values from request and puts
* them in
* an UL for display or in plain text
*
* @param request the HTTP Request
* @param doParams enumerate the request parameters or attributes
* @param inHtml compile with HTML tags or not
* @return a String containing each param name-value pair, in an >UL<
*/
public static synchronized String debugRequest(HttpServletRequest request,
int doWhat,
boolean inHtml)
{
StringBuffer temp = new StringBuffer("\n");
String temp2, temp3 = "", sepBegin, sepEnd;
Enumeration enums = null;
Object obj3 = null;
int x;


        if (inHtml)
        {
            sepBegin = "<li>";
            sepEnd = "</li>";
        }
        else
        {
            sepBegin = "";
            sepEnd = "\n";
        }

        if (inHtml) temp.append("<ul>" + sepBegin);
        switch (doWhat)
        {
        case SHOW_ATTRS:
            enums = request.getAttributeNames();
            temp.append("REQUEST ATTRIBUTES");
            break;
        case SHOW_HDRS:
            enums = request.getHeaderNames();
            temp.append("REQUEST HEADERS");
            break;
        case SHOW_PARAMS:
        default:
            enums = request.getParameterNames();
            temp.append("REQUEST PARAMS");
            break;
        }
        if (inHtml) temp.append(sepEnd);

        for (x = 0; enums.hasMoreElements(); x++)
        {
            temp2 = (String) enums.nextElement();
            switch (doWhat)
            {
            case SHOW_ATTRS:
                obj3 = request.getAttribute(temp2);
                break;
            case SHOW_HDRS:
                obj3 = request.getHeader(temp2);
                break;
            case SHOW_PARAMS:
            default:
                obj3 = request.getParameter(temp2);
                break;
            }
            if (obj3 != null)
                temp3 = obj3.toString();
            else
                temp3 = "" + obj3;
            temp.append(sepBegin + temp2 + "==" + temp3 + sepEnd);
        }
        if (inHtml) temp.append(sepBegin);
        temp.append("\nTOTAL: " + x);
        if (inHtml) temp.append(sepEnd + "</ul>");
        return temp.toString();
    }

    /**
     * To specify to debugRequest() to display request
     * parameters.
     */
    public static final int SHOW_PARAMS = 0;

    /**
     * To specify to debugRequest() to display request
     * attributes.
     */
    public static final int SHOW_ATTRS = 1;

    /**
     * To specify to debugRequest() to display request
     * headers
     */
    public static final int SHOW_HDRS = 2;




On 02/07/2004 04:00 PM Robert Taylor wrote:
Adam, thanks. I did that. The problem is that I need to see request and
response headers from different browsers.

robert


-----Original Message-----
From: Adam Hardy [mailto:[EMAIL PROTECTED]
Sent: Saturday, February 07, 2004 5:59 AM
To: Struts Users Mailing List
Subject: Re: [OT] Examining Response Headers


here's my suggestion: Firebird or Mozilla browser with LiveHttpHeaders extension.

On 02/07/2004 12:35 AM Mike Duffy wrote:

Robert,

DevProxy is a great program for monitoring the request and

response headers:


http://www.widgetbuilders.com/

I recently did some socket programming. DevProxy was an

invaluable tool. You can see exactly


what flows through the socket between browser and host. Very

good GUI interface.


Mike


--- Robert Taylor <[EMAIL PROTECTED]> wrote:



Sorry for the OT post, but Googling and searching the mailing

list archives are not producing


much.
I may not be asking the right question though.

Anyhow, I need a tool (free) to examine the request and

response headers.


Any suggestions?

robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to