User: starksm
Date: 01/12/10 20:52:18
Modified: src/resources/web Tag: Branch_2_4 classpath.jsp snoop.jsp
Log:
Update access of ENC
Revision Changes Path
No revision
No revision
1.1.2.2 +0 -14 jbosstest/src/resources/web/classpath.jsp
Index: classpath.jsp
===================================================================
RCS file: /cvsroot/jboss/jbosstest/src/resources/web/classpath.jsp,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- classpath.jsp 2001/07/09 01:06:08 1.1.2.1
+++ classpath.jsp 2001/12/11 04:52:18 1.1.2.2
@@ -75,20 +75,6 @@
}
%>
</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.2.2.2 +16 -112 jbosstest/src/resources/web/snoop.jsp
Index: snoop.jsp
===================================================================
RCS file: /cvsroot/jboss/jbosstest/src/resources/web/snoop.jsp,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- snoop.jsp 2001/07/09 01:06:08 1.2.2.1
+++ snoop.jsp 2001/12/11 04:52:18 1.2.2.2
@@ -1,121 +1,25 @@
-<%@page import="java.io.*,javax.naming.*,javax.servlet.http.HttpUtils" %>
+<%@page import="java.io.*,javax.naming.*,
+org.jboss.test.web.util.Util,
+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);
+ try
+ {
+ String enc = Util.displayENC();
+ out.println(enc);
+ }
+ catch(Exception e)
+ {
+ out.println("Failed to load ENC\n");
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ e.printStackTrace(pw);
+ out.println(sw.toString());
+ }
%>
</pre>
<h1> Request Information </h1>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development