User: starksm 
  Date: 02/02/20 23:02:35

  Added:       src/resources/web/html/jbosstest classpath.jsp index.html
                        snoop.jsp
  Log:
  Add multiple wars to test mapping of the context-root
  
  Revision  Changes    Path
  1.1                  jbosstest/src/resources/web/html/jbosstest/classpath.jsp
  
  Index: classpath.jsp
  ===================================================================
  <%@page contentType="text/html"
     import="java.io.*,java.security.*,javax.naming.*,org.jboss.test.web.util.*"
  %>
  <%!
     private String formatException(Throwable t)
     {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        t.printStackTrace(pw);
        return sw.toString();
     }
  %>
  
  <html>
  <head><title>JSP Debug Page</title></head>
  <body>
  
  <h2>Classpath Access Tests</h2>
  <h3>Access WEB-INF/classes/org/jboss/test/web/util/ClassInClasses.class</h3>
  <pre>
  <%
     try
     {
        Class clazz = Class.forName("org.jboss.test.web.util.ClassInClasses");
        out.println("Successfully loaded class: "+clazz.getName());
        ClassLoader cl = clazz.getClassLoader();
        ProtectionDomain pd = clazz.getProtectionDomain();
        CodeSource cs = pd.getCodeSource();
        out.println("  ClassLoader : "+cl.getClass().getName()+':'+cl.hashCode());
        out.println("  CodeSource.location : "+cs.getLocation());
     }
     catch(Exception e)
     {
        out.println("Failed");
        String dump = formatException(e);
        out.println(dump);
     }
  %>
  </pre>
  <h3>Access WEB-INF/lib/util.jar!org/jboss/test/web/util/Util.class</h3>
  <pre>
  <%
     try
     {
        Class clazz = Class.forName("org.jboss.test.web.util.Util");
        out.println("Successfully loaded class: "+clazz.getName());
        ClassLoader cl = clazz.getClassLoader();
        ProtectionDomain pd = clazz.getProtectionDomain();
        CodeSource cs = pd.getCodeSource();
        out.println("  ClassLoader : "+cl.getClass().getName()+':'+cl.hashCode());
        out.println("  CodeSource.location : "+cs.getLocation());
     }
     catch(Exception e)
     {
        out.println("Failed");
        String dump = formatException(e);
        out.println(dump);
     }
  %>
  </pre>
  
  <jsp:useBean id="util" scope="session" class="org.jboss.test.web.util.Util" />
  <h2>JSP ClassLoaders</h2>
  <pre>
  <%
     try
     {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        String loaders = util.displayClassLoaders(loader);
        out.println(loaders);
     }
     catch(Exception e)
     {
        throw new ServletException();
     }
   %>
  </pre>
  <h2>JSP View of JNDI ENC</h2>
  <pre>
  <%
     try
     {
        String enc = util.displayENC();
        out.println(enc);
     }
     catch(NamingException e)
     {
        throw new ServletException(e.toString(true));
     }
   %>
  </pre>
  
  </body>
  </html>
  
  
  
  1.1                  jbosstest/src/resources/web/html/jbosstest/index.html
  
  Index: index.html
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <head>
     <title>JBoss Servlet Container Integration Tests</title>
  </head>
        <h1>JBoss Servlet Container Integration Tests</h1>
        <h2>Servlet Tests</h2>
        <ul>
                <li><a href="/jbosstest/DebugServlet">Try the DebugServlet</a>
                A debugging servlet that dumps out its request thread ClassLoaders
          and the JNDI InitialContext environment.
  
                <li><a href="/jbosstest/ENCServlet">Try the ENCServlet</a>
                A test of the servlet container integration into the JNDI namespace. 
This
                servlet accesses the java:comp/env namespace for JDBC 
javax.sql.DataSources,
                JMS QueueConnectionFactory, EJBs, env variables, etc.
                        
                </li>
                <li><a href="/jbosstest/EJBServlet">Try the EJBServlet</a>
                A test of the ability to access EJBs from a servlet using the
                ejb-ref tag in web.xml and jboss-web.xml.
                </li>
                <li><a href="/jbosstest/UserTransactionServlet">Try the 
UserTransactionServlet</a>
                A test of the ability to explicitly control transactions from a 
servlet.
                </li>
        </ul>
  
        <h2>JSP Tests</h2>
        <ul>
                <li><a href="/jbosstest/snoop.jsp">Try snoop.jsp</a>
                A basic test of a JSP page.
                </li>
                <li><a href="/jbosstest/classpath.jsp">Try classpath.jsp</a>
                A JSP page that access the org.jboss.test.web.util.Util class from the
        WEB-INF/lib/util.jar to dump its class loaders and display the JNDI ENC.
                </li>
                <li><a href="/jbosstest/restricted/include_ejb.jsp">Try 
include_ejb.jsp</a>
                A secured JSP page that includes the ejb.jsp multiple times
                </li>
        </ul>
  
        <h2>Security Tests</h2>
        <ul>
                <li><a href="/jbosstest/restricted/SecureServlet">Try SecureServlet</a>
                A test of securing servlet content using the JBoss JAAS authentication 
layer.
                </li>
  
                <li><a href="/jbosstest/restricted/SecureEJBAccess">Try 
SecureEJBAccess</a>
                A test of securing servlet content using the JBoss JAAS authentication 
layer
                as well as propagation of the servlet container identity to a secure 
EJB.
                </li>
  
                <li><a href="/jbosstest/restricted/SecureEJBAccessMT">Try 
SecureEJBAccessMT</a>
                A test of securing servlet content using the JBoss JAAS authentication 
layer
                as well as propagation of the servlet container identity to a secure 
EJB from
          a thread spawned within the servlet request.
                </li>
  
                <li><a 
href="/jbosstest/restricted/SecureEJBAccess?testPropagation=true">Try SecureEJBAccess 
with nested call</a>
                A test of securing servlet content using the JBoss JAAS authentication 
layer
                as well as propagation of the servlet container identity to an 
unsecure EJB
          which in turn calls a secure EJB to test principal propagation.
                </li>
  
                <li><a href="/jbosstest/ClientLoginServlet">Try ClientLoginServlet</a>
                An unsecure servlet that performs a JAAS login as jduke to access a
          secured EJB.
                </li>
                <li><a href="/jbosstest/UnsecureEJBAccess">Try UnsecureEJBServlet</a>
                An unsecure servlet that tries to access a secured EJB.
                </li>
                <li><a href="/jbosstest/IncludeServlet">Try IncludeServlet</a>
                An unsecure servlet that tries to include both secured and unsecured 
servlets
        which access a secured EJB.
                </li>
                <li><a href="/jbosstest/restricted/IncludeServlet">Try 
IncludeServlet</a>
                An secure servlet that tries to include both secured and unsecured 
servlets
        which access a secured EJB.
                </li>
        </ul>
  </body>
  </html>
  
  
  
  1.1                  jbosstest/src/resources/web/html/jbosstest/snoop.jsp
  
  Index: snoop.jsp
  ===================================================================
  <%@page import="java.io.*,javax.naming.*,javax.servlet.http.HttpUtils" %>
  <html>
  <%!
      private String initException;
      private String jndiEnvCtxInfo;
  
      public void jspInit()
      {
          StringBuffer tmp = new StringBuffer();
          try
          {
              InitialContext ctx = new InitialContext();
              Context envCtx = (Context) ctx.lookup("java:comp/env");
              list(envCtx, "", tmp, true);
              jndiEnvCtxInfo = tmp.toString();
          }
          catch(NamingException e)
          {
              formatException(tmp, e);
              initException = tmp.toString();
          }
      }
  
      private void list(Context ctx, String indent, StringBuffer buffer, boolean 
verbose)
      {
          ClassLoader loader = Thread.currentThread().getContextClassLoader();
          try
          {
               NamingEnumeration ne = ctx.list("");
               while( ne.hasMore() )
               {
                  NameClassPair pair = (NameClassPair) ne.next();
                  boolean recursive = false;
                  boolean isLinkRef = false;
                  try
                  {
                      Class c = loader.loadClass(pair.getClassName());
                      if( Context.class.isAssignableFrom(c) )
                          recursive = true;
                      if( LinkRef.class.isAssignableFrom(c) )
                          isLinkRef = true;
                  }
                  catch(ClassNotFoundException cnfe)
                  {
                  }
  
                  String name = pair.getName();
                  buffer.append(indent +  " +- " + name);
                  if( isLinkRef )
                  {
                      try
                      {
                          LinkRef link = (LinkRef) ctx.lookupLink(name);
                          buffer.append("[link -> ");
                          buffer.append(link.getLinkName());
                          buffer.append(']');
                      }
                      catch(Throwable e)
                      {
                          e.printStackTrace();
                          buffer.append("[invalid]");
                      }
                  }
                  if( verbose )
                      buffer.append(" (class: "+pair.getClassName()+")");
                  buffer.append('\n');
                  if( recursive )
                  {
                     try
                      {
                          Object value = ctx.lookup(name);
                          if( value instanceof Context )
                          {
                              Context subctx = (Context) value;
                              list(subctx, indent + " |  ", buffer, verbose);
                          }
                          else
                          {
                              buffer.append(indent + " |   NonContext: "+value);
                              buffer.append('\n');
                          }
                      }
                      catch(Throwable t)
                      {
                          buffer.append("Failed to lookup: "+name+", 
errmsg="+t.getMessage());
                          buffer.append('\n');
                      }
                 }
              }
              ne.close();
          }
          catch(NamingException ne)
          {
              buffer.append("error while listing context "+ctx.toString () + ": " + 
ne.toString(true));
              formatException(buffer, ne);
          }
      }
  
      private void formatException(StringBuffer buffer, Throwable t)
      {
          StringWriter sw = new StringWriter();
          PrintWriter pw = new PrintWriter(sw);
          buffer.append("<pre>\n");
          t.printStackTrace(pw);
          buffer.append(sw.toString());
          buffer.append("</pre>\n");
      }
  
  %>
  
  <body bgcolor="white">
  <h1> JNDI java:comp/env Context Info</h1>
  <pre>
  <%
      if( initException != null )
          out.println(initException);
      else
          out.println(jndiEnvCtxInfo);
  %>
  </pre>
  <h1> Request Information </h1>
  <font size="4">
  JSP Request Method: <%= request.getMethod() %>
  <br>
  Request URL: <%= HttpUtils.getRequestURL(request) %>
  <br>
  Request URI: <%= request.getRequestURI() %>
  <br>
  Request Protocol: <%= request.getProtocol() %>
  <br>
  Servlet path: <%= request.getServletPath() %>
  <br>
  Path info: <%= request.getPathInfo() %>
  <br>
  Path translated: <%= request.getPathTranslated() %>
  <br>
  Query string: <%= request.getQueryString() %>
  <br>
  Content length: <%= request.getContentLength() %>
  <br>
  Content type: <%= request.getContentType() %>
  <br>
  Server name: <%= request.getServerName() %>
  <br>
  Server port: <%= request.getServerPort() %>
  <br>
  Remote user: <%= request.getRemoteUser() %>
  <br>
  Remote address: <%= request.getRemoteAddr() %>
  <br>
  Remote host: <%= request.getRemoteHost() %>
  <br>
  Authorization scheme: <%= request.getAuthType() %> 
  <br>
  Locale: <%= request.getLocale() %>
  <hr>
  The browser you are using is <%= request.getHeader("User-Agent") %>
  <hr>
  </font>
  </body>
  </html>
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to