Inhaltsverzeichnis

Configuration#

ztemplates is a Filter.

Configuration is easy: look at the empty application tutorial for how to do it.

Maven

Spring

Build

Context Configuration

Classpath Filter#

(since 1.0.0)

ztemplate scans the classpath at startup for annotated classes. If your application contains many jars this is time-consuming. You may wish to speed things up by providing a filter that only includes jars and classes you need.

Do it as follows to ensure that the default ztemplates classes are included.

The default implementation only scans WEB-INF/lib and WEB-INF/classes.

ZClassPathFilter has changed to ZIClassPathFilter, note the 'I'

If no filter can be found ztemplates prints a warning to the console, so check the console to see if the filter is used or not.

    <context-param>
      <param-name>ZIClassPathFilter</param-name>
      <param-value>com.mycompany.MyClassPathFilter</param-value>
      <description>
      	Restrict classpath scan to jars/classes known to contain ztemplates-relevant classes.
      	Best MyClassPathFilter extends ZDefaultClassPathFilter
      </description>
    </context-param>


public class MyClassPathFilter extends ZDefaultClassPathFilter
{
  @Override
  public boolean acceptClass(String name) throws Exception
  {    
    //include the default ztemplates classes
    if(super.acceptClass(name))
    {
      return true;
    }
    
    //include your own classes here
    return name.startsWith("com.mycompany");
  }
}

The default implementation only scans WEB-INF/lib and WEB-INF/classes. To add more locations override acceptClasspathPart.


public class MyClassPathFilter extends ZDefaultClassPathFilter
{
  @Override
  public boolean acceptClasspathPart(String name) throws Exception
  {    
    //include the defaults
    if(super.acceptClasspathPart(name))
    {
      return true;
    }
    
    //include your own classpath locations here
    return ...;
  }
}

Neuen Anhang hinzuf�gen

Du bist nicht autorisiert, Anh�nge zu dieser Seite hochzuladen.
« Diese Seite (Version-) wurde zuletzt am 22-Dez-2013 13:18 von gerdziegler.de ge�ndert.