various debugging logging improvements
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@118 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
bc8756a404
commit
5223f5b8bd
|
@ -1,10 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-project</artifactId>
|
||||
<version>7.0.0.M0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-assembly-descriptor</artifactId>
|
||||
<name>Jetty :: Assembly Descriptor</name>
|
||||
</project>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly>
|
||||
<id>config</id>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<formats>
|
||||
<format>jar</format>
|
||||
</formats>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/config</directory>
|
||||
<outputDirectory></outputDirectory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -1,14 +0,0 @@
|
|||
<assembly>
|
||||
<id>site-component</id>
|
||||
<formats>
|
||||
<format>jar</format>
|
||||
</formats>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${basedir}</directory>
|
||||
<includes>
|
||||
<include>src/main/resources/org/eclipse/**</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -22,15 +22,15 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
|||
*/
|
||||
public abstract class AbstractBuffers extends AbstractLifeCycle implements Buffers
|
||||
{
|
||||
private int _headerBufferSize=4*1024;
|
||||
private int _headerBufferSize=6*1024;
|
||||
private int _requestBufferSize=8*1024;
|
||||
private int _responseBufferSize=24*1024;
|
||||
private int _responseBufferSize=12*1024;
|
||||
|
||||
final static private int __HEADER=0;
|
||||
final static private int __REQUEST=1;
|
||||
final static private int __RESPONSE=2;
|
||||
final static private int __OTHER=3;
|
||||
final private int[] _pool={2,1,1,2};
|
||||
final private int[] _pool={2,1,1,1};
|
||||
|
||||
private final ThreadLocal _buffers=new ThreadLocal()
|
||||
{
|
||||
|
@ -45,8 +45,6 @@ public abstract class AbstractBuffers extends AbstractLifeCycle implements Buffe
|
|||
super();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Buffer getBuffer(final int size )
|
||||
{
|
||||
final int set = (size==_headerBufferSize)?__HEADER
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
package org.eclipse.jetty.security;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -84,6 +85,20 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
|
|||
return _roles;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Process the constraints following the combining rules in Servlet 3.0 EA
|
||||
* spec section 13.7.1 Note that much of the logic is in the RoleInfo class.
|
||||
*
|
||||
* @param constraintMappings
|
||||
* The contraintMappings to set, from which the set of known roles
|
||||
* is determined.
|
||||
*/
|
||||
public void setConstraintMappings(ConstraintMapping[] constraintMappings)
|
||||
{
|
||||
setConstraintMappings(constraintMappings,null);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Process the constraints following the combining rules in Servlet 3.0 EA
|
||||
|
@ -91,13 +106,29 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
|
|||
*
|
||||
* @param constraintMappings
|
||||
* The contraintMappings to set.
|
||||
* @param roles
|
||||
* @param roles The known roles (or null to determine them from the mappings)
|
||||
*/
|
||||
public void setConstraintMappings(ConstraintMapping[] constraintMappings, Set<String> roles)
|
||||
{
|
||||
if (isStarted())
|
||||
throw new IllegalStateException("Started");
|
||||
_constraintMappings = constraintMappings;
|
||||
|
||||
if (roles==null)
|
||||
{
|
||||
roles = new HashSet<String>();
|
||||
for (ConstraintMapping cm : constraintMappings)
|
||||
{
|
||||
String[] cmr = cm.getConstraint().getRoles();
|
||||
if (cmr!=null)
|
||||
{
|
||||
for (String r : cmr)
|
||||
if (!"*".equals(r))
|
||||
roles.add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._roles = roles;
|
||||
|
||||
}
|
||||
|
@ -110,7 +141,7 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
|
|||
protected void doStart() throws Exception
|
||||
{
|
||||
_constraintMap.clear();
|
||||
if (_constraintMappings != null)
|
||||
if (_constraintMappings!=null)
|
||||
{
|
||||
for (ConstraintMapping mapping : _constraintMappings)
|
||||
{
|
||||
|
|
|
@ -300,7 +300,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
|
|||
if (_identityService==null)
|
||||
_identityService=findIdentityService();
|
||||
|
||||
if (_identityService==null)
|
||||
if (_identityService==null && _realmName!=null)
|
||||
_identityService=new DefaultIdentityService();
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
|
|||
if (!_loginServiceShared && _loginService instanceof LifeCycle)
|
||||
((LifeCycle)_loginService).start();
|
||||
|
||||
if (_authenticator==null && _authenticatorFactory!=null)
|
||||
if (_authenticator==null && _authenticatorFactory!=null && _identityService!=null)
|
||||
{
|
||||
_authenticator=_authenticatorFactory.getAuthenticator(getServer(),ContextHandler.getCurrentContext(),this);
|
||||
if (_authenticator!=null)
|
||||
|
@ -323,15 +323,19 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
|
|||
}
|
||||
|
||||
if (_authenticator==null)
|
||||
{
|
||||
if (_realmName!=null)
|
||||
{
|
||||
Log.warn("No ServerAuthentication for "+this);
|
||||
throw new IllegalStateException("No ServerAuthentication");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_authenticator.setConfiguration(this);
|
||||
if (_authenticator instanceof LifeCycle)
|
||||
((LifeCycle)_authenticator).start();
|
||||
|
||||
}
|
||||
|
||||
super.doStart();
|
||||
}
|
||||
|
@ -384,7 +388,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti
|
|||
if (handler==null)
|
||||
return;
|
||||
|
||||
if (checkSecurity(base_request))
|
||||
if (_authenticator!=null && checkSecurity(base_request))
|
||||
{
|
||||
Object constraintInfo = prepareConstraintInfo(pathInContext, base_request);
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ public abstract class LoginAuthenticator implements Authenticator
|
|||
{
|
||||
_loginService=configuration.getLoginService();
|
||||
if (_loginService==null)
|
||||
throw new IllegalStateException("No LoginService for "+this);
|
||||
throw new IllegalStateException("No LoginService for "+this+" in "+configuration);
|
||||
_identityService=configuration.getIdentityService();
|
||||
if (_identityService==null)
|
||||
throw new IllegalStateException("No IdentityService for "+this);
|
||||
throw new IllegalStateException("No IdentityService for "+this+" in "+configuration);
|
||||
}
|
||||
|
||||
public LoginService getLoginService()
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.jetty.util.component.LifeCycle;
|
|||
*/
|
||||
public interface HandlerContainer extends LifeCycle
|
||||
{
|
||||
public Handler[] getHandlers();
|
||||
public Handler[] getChildHandlers();
|
||||
public Handler[] getChildHandlersByClass(Class<?> byclass);
|
||||
public Handler getChildHandlerByClass(Class<?> byclass);
|
||||
|
|
|
@ -236,6 +236,8 @@ public class Server extends HandlerWrapper implements Attributes
|
|||
}
|
||||
}
|
||||
}
|
||||
if (Log.isDebugEnabled())
|
||||
Log.debug(dump());
|
||||
mex.ifExceptionThrow();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.eclipse.jetty.util.log.Log;
|
|||
*/
|
||||
public abstract class AbstractHandler extends AbstractLifeCycle implements Handler
|
||||
{
|
||||
protected String _string;
|
||||
private Server _server;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -59,12 +58,17 @@ public abstract class AbstractHandler extends AbstractLifeCycle implements Handl
|
|||
/* ------------------------------------------------------------ */
|
||||
public String toString()
|
||||
{
|
||||
if (_string==null)
|
||||
StringBuilder b=new StringBuilder();
|
||||
String s=super.toString();
|
||||
b.append(s,s.lastIndexOf('.')+1,s.length());
|
||||
ContextHandler.Context ctx = ContextHandler.getCurrentContext();
|
||||
if (ctx!=null && ctx.getContextPath()!=null && !(this instanceof ContextHandler))
|
||||
{
|
||||
_string=super.toString();
|
||||
_string=_string.substring(_string.lastIndexOf('.')+1);
|
||||
b.append('@');
|
||||
b.append(ctx.getContextPath());
|
||||
|
||||
}
|
||||
return _string;
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -84,5 +84,32 @@ public abstract class AbstractHandlerContainer extends AbstractHandler implement
|
|||
return list;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String dump()
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
dump(b,this,0);
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected void dump(StringBuilder b,Handler handler,int indent)
|
||||
{
|
||||
for (int i=0;i<indent;i++)
|
||||
b.append("| ");
|
||||
if (handler==null)
|
||||
b.append("NULL");
|
||||
else
|
||||
{
|
||||
b.append(handler.toString());
|
||||
b.append(handler.isStarted()?" started":" STOPPED");
|
||||
b.append('\n');
|
||||
|
||||
indent++;
|
||||
if (handler instanceof HandlerContainer)
|
||||
for (Handler h : ((HandlerContainer)handler).getHandlers())
|
||||
dump(b,h,indent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1195,7 +1195,7 @@ public class ContextHandler extends HandlerWrapper implements Attributes, Server
|
|||
public String toString()
|
||||
{
|
||||
|
||||
return this.getClass().getName()+"@"+Integer.toHexString(hashCode())+"{"+getContextPath()+","+getBaseResource()+"}";
|
||||
return super.toString()+"@"+Integer.toHexString(hashCode())+getContextPath()+","+getBaseResource();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -50,6 +50,15 @@ public class HandlerWrapper extends AbstractHandlerContainer
|
|||
return _handler;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return Returns the handlers.
|
||||
*/
|
||||
public Handler[] getHandlers()
|
||||
{
|
||||
return new Handler[] {_handler};
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param handler Set the {@link Handler} which should be wrapped.
|
||||
|
|
|
@ -50,6 +50,15 @@ public class HotSwapHandler extends AbstractHandlerContainer
|
|||
return _handler;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return Returns the handlers.
|
||||
*/
|
||||
public Handler[] getHandlers()
|
||||
{
|
||||
return new Handler[] {_handler};
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param handler Set the {@link Handler} which should be wrapped.
|
||||
|
|
|
@ -23,6 +23,9 @@ public class DemoServer
|
|||
server.addBean(login);
|
||||
|
||||
server.start();
|
||||
|
||||
System.err.println(server.dump());
|
||||
|
||||
server.join();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,13 +58,13 @@ public abstract class AbstractLifeCycle implements LifeCycle
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.warn(FAILED+" " + this,e);
|
||||
Log.debug(FAILED+" " + this,e);
|
||||
setFailed(e);
|
||||
throw e;
|
||||
}
|
||||
catch (Error e)
|
||||
{
|
||||
Log.warn(FAILED+" " + this,e);
|
||||
Log.debug(FAILED+" " + this,e);
|
||||
setFailed(e);
|
||||
throw e;
|
||||
}
|
||||
|
@ -86,13 +86,13 @@ public abstract class AbstractLifeCycle implements LifeCycle
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.warn(FAILED+" " + this,e);
|
||||
Log.debug(FAILED+" " + this,e);
|
||||
setFailed(e);
|
||||
throw e;
|
||||
}
|
||||
catch (Error e)
|
||||
{
|
||||
Log.warn(FAILED+" " + this,e);
|
||||
Log.debug(FAILED+" " + this,e);
|
||||
setFailed(e);
|
||||
throw e;
|
||||
}
|
||||
|
|
|
@ -826,7 +826,7 @@ public class WebAppContext extends ServletContextHandler
|
|||
/* ------------------------------------------------------------ */
|
||||
public String toString()
|
||||
{
|
||||
return this.getClass().getName()+"@"+Integer.toHexString(hashCode())+"{"+getContextPath()+","+(_war==null?getResourceBase():_war)+"}";
|
||||
return super.toString()+(_war==null?"":(","+_war));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
Loading…
Reference in New Issue