Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
4.2 Printing All Headers
97
Listing 4.1 ShowRequestHeaders.java (continued)
                "\n" +
                "
\n" +
                "
Header NameHeader Value");
    Enumeration headerNames = request.getHeaderNames();
    while(headerNames.hasMoreElements()) {
      String headerName = (String)headerNames.nextElement();
      out.println("
" + headerName);
      out.println("    
" + request.getHeader(headerName));
    }
    out.println("
\n");
  }
  /** Let the same servlet handle both GET and POST. */
  public void doPost(HttpServletRequest request,
                     HttpServletResponse response)
      throws ServletException, IOException {
    doGet(request, response);
  }
}
Figure 4 1
Request headers sent by Netscape 4.7 on Windows 98.
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved