<%@ page import="oracle.portal.provider.v1.*,oracle.portal.provider.v1.http.*" %>

<%
    PortletRenderRequest portletRequest = (PortletRenderRequest) request.getAttribute("oracle.portal.PortletRenderRequest");

    // render the portlet header
    PortletRendererUtil.renderPortletHeader(portletRequest, out, null);

    ProviderUser user = portletRequest.getUser();

    // set the content type for multibyte support
    String encoding = portletRequest.getCharacterEncoding();
    String contentType = "text/html;charset=" + encoding;
    response.setContentType(contentType);
%>


<h1> Request Information </h1>
<font size="2">
<table width=50% border="1">
<%if (portletRequest != null)
  {
   out.println("<tr><td>PortletReference: </td><td>" + portletRequest.getPortletReference().toString() + "</td></tr>");
   out.println("<tr><td>User: </td><td>" + user.getName() + "</td></tr>");
   out.println("<tr><td>Auth. Level: </td><td>" + user.getAuthenticationLevel() + "</td></tr>");
   out.println("<tr><td>isLoggedOn: </td><td>" + user.isLoggedOn() + "</td></tr>");
   out.println("<tr><td>isWeaklyAuth.: </td><td>" + user.isWeaklyAuthenticated() + "</td></tr>");
   out.println("<tr><td>isPublicUser.: </td><td>" + user.isPublicUser() + "</td></tr>");
   out.println("<tr><td>Request URL: </td><td>" + portletRequest.getRequestURL() + "</td></tr>");
   out.println("<tr><td>Page URL: </td><td>" + portletRequest.getPageURL() + "</td></tr>");
   out.println("<tr><td>Design URL: </td><td>" + portletRequest.getDesignURL() + "</td></tr>");
   out.println("<tr><td>Back URL: </td><td>" + portletRequest.getBackURL() + "</td></tr>");
   out.println("<tr><td>Login URL: </td><td>" + portletRequest.getLoginServerURL() + "</td></tr>");
   out.println("<tr><td>Title: </td><td>" + portletRequest.hasTitle() + "</td></tr>");
   out.println("<tr><td>Border: </td><td>" + portletRequest.hasBorder() + "</td></tr>");
  out.println("<tr><td>RenderMode: </td><td>" + PortletRendererUtil.getModeName(portletRequest.getMode()) + "</td></tr>");
  }
  else
  {
  out.println("<tr><td>No PortletRenderRequest </td><td></td></tr>");
  }
  %>
  <tr><td>JSP Request Method: </td><td><jsp:expr>  request.getMethod() </jsp:expr></td></tr>
  <tr><td>Request URI: </td><td><jsp:expr> request.getRequestURI()  </jsp:expr></td></tr>
  <tr><td>Request Protocol: </td><td><jsp:expr> request.getProtocol() </jsp:expr></td></tr>
  <tr><td>Servlet path: </td><td><jsp:expr> request.getServletPath() </jsp:expr></td></tr>
  <tr><td>Path info: </td><td><jsp:expr> request.getPathInfo() </jsp:expr></td></tr>
   <tr><td>Path translated: </td><td><jsp:expr> request.getPathTranslated() </jsp:expr></td></tr>
   <tr><td>Query string: </td><td><jsp:expr> request.getQueryString() </jsp:expr></td></tr>
   <%
    String attr;
    attr = (String) request.getAttribute("javax.servlet.include.request_uri");
    if (attr != null) {
        out.println("<tr><td>Included Request URI: </td><td>" + attr + "</td></tr>");
    }

    attr = (String) request.getAttribute("javax.servlet.include.servlet_path");
    if (attr != null) {
        out.println("<tr><td>Included Servlet path: </td><td>" + attr + "</td></tr>");
    }
    attr = (String) request.getAttribute("javax.servlet.include.path_info");
    if (attr != null) {
        out.println("<tr><td>Included Path info: </td><td>" + attr + "</td></tr>");
        attr = request.getRealPath(attr);
        if (attr != null) {
            out.println("<tr><td>Included path translated: </td><td>" + attr + "</td></tr>");
        }
    }
    attr = (String) request.getAttribute("javax.servlet.include.query_string");
    if (attr != null) {
        out.println("<tr><td>Included Query String: </td><td>" + attr + "</td></tr>");
    }

    java.util.Enumeration names = request.getParameterNames();
    while (names != null && names.hasMoreElements()) 
    {
        String name = (String) names.nextElement();
        out.print("<tr><td>" + name + "</td><td>");
        String[] values = request.getParameterValues(name);
        if (values != null) 
        {
            String outStr = "";
            for (int j = 0; j < values.length; j++) 
            {
                String tmp;
                if (values[j] == null)
                    tmp = "Parameter value is NULL (you should never see this)";
                else if (values[j].equals(""))
                    tmp = "Parameter has no value";
                else
                    tmp = values[j];
                    
                if (j > 0)
                {
                    outStr = outStr + ", ";
                }
                outStr = outStr + tmp;
            }
            out.println(outStr + " </td></tr>");
        }
    }
    
%>
<tr><td>Real Path: </td><td><%= request.getRealPath("/servlets/oracle.portal.provider.v1.HttpProvider") %> </td></tr>
<tr><td>Content length: </td><td><jsp:expr> request.getContentLength() </jsp:expr></td></tr>
<tr><td>Content type: </td><td><jsp:expr> request.getContentType() </jsp:expr></td></tr>
<tr><td>Server name: </td><td><jsp:expr> request.getServerName() </jsp:expr></td></tr>
<tr><td>Server port: </td><td><jsp:expr> request.getServerPort() </jsp:expr></td></tr>
<tr><td>Remote user: </td><td><jsp:expr> request.getRemoteUser() </jsp:expr></td></tr>
<tr><td>Remote address: </td><td><jsp:expr> request.getRemoteAddr() </jsp:expr></td></tr>
<tr><td>Remote host: </td><td><jsp:expr> request.getRemoteHost() </jsp:expr></td></tr>
<tr><td>Authorization scheme: </td><td><jsp:expr> request.getAuthType() </jsp:expr></td></tr> 
<tr><td>The browser you are using is </td><td><jsp:expr> request.getHeader("User-Agent") </jsp:expr></td></tr>
</table>
</font>

<%
    // render the portlet footer
    PortletRendererUtil.renderPortletFooter(portletRequest, out);
%>
