• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1944
  • Last Modified:

How to display ALL Request/Response headers in JSP

What JSP code would I use if I want ALL of the Request and Response headers to be displayed on the page?  In other words, just looking to get a dump of all headers and to display them on the page for debugging. Running Apache, WebLogic and RHEL.
0
gmahler5th
Asked:
gmahler5th
  • 4
  • 2
  • 2
  • +1
1 Solution
 
CEHJCommented:
You would be better off using a proxy for debugging. There's a pretty good one written in Java called 'Charles'

For the response. You can use wget in debug mode

man wget
0
 
gmahler5thAuthor Commented:
I just want to see the code, so I can put it in a JSP and have them ALL display.

is it required to put Apache in Debug mode?
0
 
gmahler5thAuthor Commented:
For example, in ASP code I use the following.  How would I do the same thing in JSP?

<% For Each item In Request.ServerVariables %>
     
                <span class="bgcolorsmallcapsnoborder"><%= item %></strong>: &nbsp;</span>
       
                <span  class="bodyfine"><%= Request.ServerVariables(item) %></span><br /><br />
     
      <% Next %>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
CEHJCommented:
Personally i wouldn't alter the code, but just use a proxy
0
 
mrcoffee365Commented:
You do this:

<%           Enumeration params = request.getParameterNames();
            while (params.hasMoreElements())
            {
                  String pName = (String) params.nextElement();
                  String pValue = null;
                  if( pName != null ) {
                             pValue = request.getParameter(pName);
                        }
%>
                       <br/><%=pName%> = <%=pValue%>
<%          }    %>
0
 
gmahler5thAuthor Commented:
CEH, it is specifically required to test authz rules on a URL, and I need the vars to be displayed on this page only.

MrCoffee, does that code also display the server variables such as header vars?  I.e. just want to be sure that request.getParameter will have server variables, and not just URL parameters.

thanks.
0
 
gmahler5thAuthor Commented:
Wouldn't Enumeration e = request.getHeaderNames(); be the function to use, instead of enumeration of Params?
0
 
mrcoffee365Commented:
gmahler5th - you're right.  I misread the request, and assumed that they wanted request parameters.

The same code, with getHeaderNames() and individual getHeader(pName) would get the header names and values.

The real answer is to look at the API and get the information you want from the HttpServletRequest:
http://java.sun.com/products/servlet/2.3/javadoc/index.html
0
 
Ajay-SinghCommented:
If you are using tomcat as web-container, you can use request dumper value.
More, http://tomcat.apache.org/tomcat-5.0-doc/config/valve.html
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now