public FastSlf4jLog( String name ) { super( name ); debugEnabled = super.isDebugEnabled(); }
@Override public void debug( String msg, Object... args ) { if ( debugEnabled ) { if ( args != null && args.length == 0 ) { args = null; } super.debug( msg, args ); } }
public void configure() throws Exception { // Configure webapp for (Configuration configuration : _configurations) { LOG.debug("configure {} with {}",this,configuration); configuration.configure(this); } }
@Override public boolean isSystemResource(String name, URL url) { if (_systemClasses == null) loadSystemClasses(); boolean result = _systemClasses.match(name,url); if (LOG.isDebugEnabled()) LOG.debug("isSystemResource=={} {} {}",result,name,url); return result; }
private void loadClass () { if (_clazz != null) return; if (_className == null) return; try { _clazz = Loader.loadClass(_className); } catch (Exception e) { LOG.warn(e); } } }
Log.setLog(new StdErrLog()); Log.getLog().setDebugEnabled(false);
private void dumpUrl() { Connector[] connectors = getServer().getConnectors(); for (int i=0;i<connectors.length;i++) { String displayName = getDisplayName(); if (displayName == null) displayName = "WebApp@"+Arrays.hashCode(connectors); LOG.info(displayName + " at http://" + connectors[i].toString() + getContextPath()); } }
@Override public boolean isSystemClass(Class<?> clazz) { if (_systemClasses == null) loadSystemClasses(); boolean result = _systemClasses.match(clazz); if (LOG.isDebugEnabled()) LOG.debug("isSystemClass=={} {}",result,clazz); return result; }
public void postConfigure() throws Exception { // Clean up after configuration for (Configuration configuration : _configurations) { LOG.debug("postConfigure {} with {}",this,configuration); configuration.postConfigure(this); } }
/** Set temporary directory for context. * The javax.servlet.context.tempdir attribute is also set. * @param dir Writable temporary directory. */ public void setTempDirectory(File dir) { if (isStarted()) throw new IllegalStateException("Started"); if (dir!=null) { try{dir=new File(dir.getCanonicalPath());} catch (IOException e){LOG.warn(Log.EXCEPTION,e);} } _tmpDir=dir; setAttribute(TEMPDIR,_tmpDir); }
Log.setLog(new StdErrLog()); Log.getLog().setDebugEnabled(false);
@Override public void debug( Throwable thrown ) { if ( debugEnabled ) { super.debug( thrown ); } }
@Override public boolean isServerClass(Class<?> clazz) { if (_serverClasses == null) loadServerClasses(); boolean result = _serverClasses.match(clazz); if (LOG.isDebugEnabled()) LOG.debug("isServerClass=={} {}",result,clazz); return result; }
@Override public void logout(UserIdentity user) { users.remove(user.getUserPrincipal().getName()); LOG.debug("logout {}", user); } }
/** * Servlet spec 3.1. When present in web.xml, this means that http methods that are * not covered by security constraints should have access denied. * <p> * See section 13.8.4, pg 145 * * @param context the of the processing * @param descriptor the descriptor * @param node the xml node */ public void visitDenyUncoveredHttpMethods(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { if (context.getSecurityHandler() == null) { LOG.warn("deny-uncovered-http-methods declared but SecurityHandler==null"); return; } ((ConstraintAware)context.getSecurityHandler()).setDenyUncoveredHttpMethods(true); } }
@Override public void debug( String msg, Throwable thrown ) { if ( debugEnabled ) { super.debug( msg, thrown ); } }
@Override public boolean isServerResource(String name, URL url) { if (_serverClasses == null) loadServerClasses(); boolean result = _serverClasses.match(name,url); if (LOG.isDebugEnabled()) LOG.debug("isServerResource=={} {} {}",result,name,url); return result; }
/** * Process web-default.xml, web.xml, override-web.xml * */ @Override public void configure (WebAppContext context) throws Exception { // cannot configure if the context is already started if (context.isStarted()) { LOG.debug("Cannot configure webapp after it is started"); return; } context.getMetaData().addDescriptorProcessor(new StandardDescriptorProcessor()); }
public void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { if (context.getSecurityHandler() == null) { LOG.warn("security-role declared but SecurityHandler==null"); return; } //ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged XmlParser.Node roleNode = node.get("role-name"); String role = roleNode.toString(false, true); ((ConstraintAware)context.getSecurityHandler()).addRole(role); }
protected Resource findWebXml(WebAppContext context) throws IOException, MalformedURLException { String descriptor = context.getDescriptor(); if (descriptor != null) { Resource web = context.newResource(descriptor); if (web.exists() && !web.isDirectory()) return web; } Resource web_inf = context.getWebInf(); if (web_inf != null && web_inf.isDirectory()) { // do web.xml file Resource web = web_inf.addPath("web.xml"); if (web.exists()) return web; if (LOG.isDebugEnabled()) LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only"); } return null; }