improved debug dump

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2155 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-07-20 00:46:34 +00:00
parent ce7c80c92b
commit 6478b5ede7
9 changed files with 73 additions and 44 deletions

View File

@ -9,6 +9,7 @@ jetty-7.2-SNAPSHOT
+ JETTY-1245 Do not use direct buffers with NIO SSL
+ JETTY-1249 Apply max idle time to all connectors
+ Added ignore to Logger interface
+ Improved debug dump
jetty-7.1.6.v20100715
+ 319519 Warn about duplicate configuration files

View File

@ -401,6 +401,7 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
return ((RoleInfo)constraintInfo).isChecked();
}
@Override
protected boolean checkWebResourcePermissions(String pathInContext, Request request, Response response, Object constraintInfo, UserIdentity userIdentity)
throws IOException
{
@ -427,15 +428,16 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
}
/* ------------------------------------------------------------ */
protected void dump(StringBuilder b,String indent)
@Override
protected void dump(Appendable out,String indent) throws IOException
{
super.dump(b,indent);
b.append(indent).append(" +=roles=").append(_roles).append('\n');
super.dump(out,indent);
out.append(indent).append(" +=roles=").append(String.valueOf(_roles)).append('\n');
for (Object path : _constraintMap.keySet())
{
Object constraint = _constraintMap.get(path);
b.append(indent).append(" +=").append(path).append('=').append(constraint).append('\n');
out.append(indent).append(" +=").append(String.valueOf(path)).append('=').append(String.valueOf(constraint)).append('\n');
}
}
}

View File

@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpGenerator;
import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.Attributes;
@ -649,12 +650,25 @@ public class Server extends HandlerWrapper implements Attributes
_graceful=timeoutMS;
}
/* ------------------------------------------------------------ */
@Override
public String toString()
{
return this.getClass().getName()+"@"+Integer.toHexString(hashCode());
}
/* ------------------------------------------------------------ */
@Override
protected void dump(Appendable out,String indent) throws IOException
{
out.append(toString()).append(isStarted()?" started":" STOPPED").append('\n');
for (Connector c : _connectors)
out.append(" +-").append(String.valueOf(c)).append('\n');
out.append(" +-").append(String.valueOf(_threadPool)).append('\n');
dumpHandlers(out,indent);
}
/* ------------------------------------------------------------ */
/* A handler that can be gracefully shutdown.

View File

@ -14,6 +14,8 @@
package org.eclipse.jetty.server.handler;
import java.io.IOException;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
@ -106,16 +108,29 @@ public abstract class AbstractHandler extends AbstractLifeCycle implements Handl
public String dump()
{
StringBuilder b = new StringBuilder();
dump(b,"");
try
{
dump(b,"");
}
catch (IOException e)
{
Log.warn(e);
}
return b.toString();
}
/* ------------------------------------------------------------ */
protected void dump(StringBuilder b,String indent)
public void dump(Appendable out) throws IOException
{
b.append(toString());
b.append(isStarted()?" started":" STOPPED");
b.append('\n');
dump(out,"");
}
/* ------------------------------------------------------------ */
protected void dump(Appendable out,String indent) throws IOException
{
out.append(toString());
out.append(isStarted()?" started":" STOPPED");
out.append('\n');
}
}

View File

@ -14,6 +14,8 @@
package org.eclipse.jetty.server.handler;
import java.io.IOException;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HandlerContainer;
import org.eclipse.jetty.util.LazyList;
@ -84,10 +86,14 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
/* ------------------------------------------------------------ */
@Override
protected void dump(StringBuilder b,String indent)
protected void dump(Appendable out,String indent) throws IOException
{
super.dump(out,indent);
dumpHandlers(out,indent);
}
protected void dumpHandlers(Appendable out,String indent) throws IOException
{
super.dump(b,indent);
Handler[] handlers = getHandlers();
if (handlers!=null)
{
@ -96,14 +102,14 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
{
if (handlers[h]==null)
continue;
b.append(indent);
b.append(" +-");
out.append(indent);
out.append(" +-");
if (handlers[h] instanceof AbstractHandler)
((AbstractHandler)handlers[h]).dump(b,indent+((h==last)?" ":" | "));
((AbstractHandler)handlers[h]).dump(out,indent+((h==last)?" ":" | "));
else
{
b.append(handlers[h]);
b.append("\n");
out.append(String.valueOf(handlers[h]));
out.append("\n");
}
}
}

View File

@ -1409,19 +1409,19 @@ public class ServletHandler extends ScopedHandler
/* ------------------------------------------------------------ */
@Override
protected void dump(StringBuilder b,String indent)
protected void dump(Appendable out,String indent) throws IOException
{
super.dump(b,indent);
super.dump(out,indent);
if (getFilterMappings()!=null)
{
for (FilterMapping f : getFilterMappings())
{
b.append(indent);
b.append(" +-");
b.append(f);
b.append(f.getFilterHolder().getInitParameters());
b.append('\n');
out.append(indent);
out.append(" +-");
out.append(String.valueOf(f.toString()));
out.append(String.valueOf(f.getFilterHolder().getInitParameters()));
out.append('\n');
}
}
HashSet<String> servlets = new HashSet<String>();
@ -1430,13 +1430,13 @@ public class ServletHandler extends ScopedHandler
for (ServletMapping m : getServletMappings())
{
servlets.add(m.getServletName());
b.append(indent);
b.append(" +-");
b.append(m);
out.append(indent);
out.append(" +-");
out.append(String.valueOf(m));
ServletHolder h = getServlet(m.getServletName());
if (h!=null)
b.append(h.getInitParameters());
b.append('\n');
out.append(String.valueOf(h.getInitParameters()));
out.append('\n');
}
}
@ -1446,11 +1446,11 @@ public class ServletHandler extends ScopedHandler
{
if (servlets.contains(h.getName()))
continue;
b.append(indent);
b.append(" +-[]==>");
b.append(h.getName());
b.append(h.getInitParameters());
b.append('\n');
out.append(indent);
out.append(" +-[]==>");
out.append(h.getName());
out.append(String.valueOf(h.getInitParameters()));
out.append('\n');
}
}

View File

@ -136,7 +136,6 @@ public class MetaData
* Order the list of jars in WEB-INF/lib according to the ordering declarations in the descriptors
* @see org.eclipse.jetty.webapp.MetaData.Ordering#order(java.util.List)
*/
@Override
public List<Resource> order(List<Resource> jars)
{
List<Resource> orderedList = new ArrayList<Resource>();
@ -174,7 +173,6 @@ public class MetaData
return orderedList;
}
@Override
public boolean isAbsolute()
{
return true;
@ -194,7 +192,6 @@ public class MetaData
_order.add(OTHER);
}
@Override
public boolean hasOther ()
{
return _hasOther;
@ -218,7 +215,6 @@ public class MetaData
* in the various web-fragment.xml files.
* @see org.eclipse.jetty.webapp.MetaData.Ordering#order(java.util.List)
*/
@Override
public List<Resource> order(List<Resource> jars)
{
//for each jar, put it into the ordering according to the fragment ordering
@ -288,13 +284,11 @@ public class MetaData
return orderedList;
}
@Override
public boolean isAbsolute ()
{
return false;
}
@Override
public boolean hasOther ()
{
return !_beforeOthers.isEmpty() || !_afterOthers.isEmpty();

View File

@ -749,7 +749,6 @@ public class XmlParser
Node _node;
/* -------------------------------------------------- */
@Override
public boolean hasNext()
{
if (_node != null)
@ -772,7 +771,6 @@ public class XmlParser
}
/* -------------------------------------------------- */
@Override
public Node next()
{
try
@ -789,7 +787,6 @@ public class XmlParser
}
/* -------------------------------------------------- */
@Override
public void remove()
{
throw new UnsupportedOperationException("Not supported");

View File

@ -37,7 +37,7 @@ public class TestServer
{
public static void main(String[] args) throws Exception
{
Log.getLog().setDebugEnabled(false);
Log.getLog().setDebugEnabled(true);
((StdErrLog)Log.getLog()).setSource(false);
String jetty_root = "..";