code: protected void doTrace(HttpServletRequest req, HttpServletResponse resp) 
          throws ServletException, IOException
      {
          
          int responseLength;
  
          String CRLF = "\r\n";
          StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI())
              .append(" ").append(req.getProtocol());
  
          Enumeration<String> reqHeaderEnum = req.getHeaderNames();
  
          while( reqHeaderEnum.hasMoreElements() ) {
              String headerName = reqHeaderEnum.nextElement();
              buffer.append(CRLF).append(headerName).append(": ")
                  .append(req.getHeader(headerName));
          }
  
          buffer.append(CRLF);
  
          responseLength = buffer.length();
  
          resp.setContentType("message/http");
          resp.setContentLength(responseLength);
          ServletOutputStream out = resp.getOutputStream();
          out.print(buffer.toString());
      }
docs: Called by the server (via the <code>service</code> method)
  to allow a servlet to handle a TRACE request.
  
  A TRACE returns the headers sent with the TRACE
  request to the client, so that they can be used in
  debugging. There's no need to override this method.
  
  @param req   the {@link HttpServletRequest} object that
  contains the request the client made of
  the servlet
  
  
  @param resp  the {@link HttpServletResponse} object that
  contains the response the servlet returns
  to the client
  
  @throws IOException   if an input or output error occurs
  while the servlet is handling the
  TRACE request
  
  @throws ServletException  if the request for the
  TRACE cannot be handled