SHARE
TWEET

Untitled

a guest Mar 26th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%@ page import="java.util.*" %>
  2. <html>
  3.    <head>
  4.       <title>Echo</title>
  5.    </head>
  6.    <body>
  7.       <h1>HTTP Request Headers Received</h1>
  8.       <table border="1" cellpadding="4" cellspacing="0">
  9.       <%
  10.          Enumeration eNames = request.getHeaderNames();
  11.          while (eNames.hasMoreElements()) {
  12.             String name = (String) eNames.nextElement();
  13.             String value = normalize(request.getHeader(name));
  14.       %>
  15.          <tr><td><%= name %></td><td><%= value %></td></tr>
  16.       <%
  17.          }
  18.       %>
  19.       </table>
  20.    </body>
  21. </html>
  22. <%!
  23.    private String normalize(String value)
  24.    {
  25.       StringBuffer sb = new StringBuffer();
  26.       for (int i = 0; i < value.length(); i++) {
  27.          char c = value.charAt(i);
  28.          sb.append(c);
  29.          if (c == ';')
  30.             sb.append("<br>");
  31.       }
  32.       return sb.toString();
  33.    }
  34. %>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top