%@ page import="java.util.*,javax.servlet.http.*,sun.misc.BASE64Decoder" %>
Sample Online Application
Sample Online Application
Request headers:
<%
/* collect parameters from request */
for (Enumeration enum = request.getHeaderNames(); enum.hasMoreElements(); ) {
String key = (String) enum.nextElement();
String value = request.getHeader(key); %>
<%=key%> | <%=value%> |
<% } %>
Request parameters:
<%
/* collect parameters from request */
for (Enumeration enum = request.getParameterNames(); enum.hasMoreElements(); ) {
String name = (String) enum.nextElement();
String value = request.getParameter(name); %>
<%=name%> | <%=value%> |
<% } %>
Cookies:
<%
/* collect attributes from request */
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i]; %>
<%=cookie.getName()%> | <%=cookie.getValue()%> |
<% }
} %>
<% String authHeader = request.getHeader("Authorization");
if (authHeader != null) {
authHeader = authHeader.substring(authHeader.indexOf(" ")+1);
String decAuthHeader = new String(new BASE64Decoder().decodeBuffer(authHeader));
%>
Basic authentication credentials: <%=decAuthHeader%>
<% } %>
Form sample