JspC (Apache Ant API)
Keywords: org.apache.tools.ant.taskdefs.optional.jsp.JspC,JspC class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.taskdefs.optional.jsp
Class JspC

    java.lang.Object
      |
      +--org.apache.tools.ant.ProjectComponent
            |
            +--org.apache.tools.ant.Task
                  |
                  +--org.apache.tools.ant.taskdefs.MatchingTask
                        |
                        +--org.apache.tools.ant.taskdefs.optional.jsp.JspC

All Implemented Interfaces:
  SelectorContainer

public class JspC
extends MatchingTask

Runs a JSP compiler.

This task takes the given jsp files and compiles them into java files. It is then up to the user to compile the java files into classes.

The task requires the srcdir and destdir attributes to be set. This Task is a MatchingTask, so the files to be compiled can be specified using includes/excludes attributes or nested include/exclude elements. Optional attributes are verbose (set the verbosity level passed to jasper), package (name of the destination package for generated java classes and classpath (the classpath to use when running the jsp compiler).

This task supports the nested elements classpath (A Path) and classpathref (A Reference) which can be used in preference to the attribute classpath, if the jsp compiler is not already in the ant classpath.

#### Usage

     <jspc srcdir="${basedir}/src/war"
           destdir="${basedir}/gensrc"
           package="com.i3sp.jsp"
           verbose="9">
       <include name="**\/*.jsp" />
     </jspc>

Since:
  1.5

Nested Class Summary
`static class` | `JspC.WebAppParameter` static inner class used as a parameter element

Field Summary
`protected java.util.Vector` | `compileList`
`protected boolean` | `failOnError` flag to control action on execution trouble
`protected JspC.WebAppParameter` | `webApp` web apps

Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
`fileset`

Fields inherited from class org.apache.tools.ant.Task
`description, location, target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`JspC()`

Method Summary
`void` | `addWebApp(JspC.WebAppParameter webappParam)` Adds a single webapp.
`Path` | `createClasspath()` Adds a path to the classpath.
`Path` | `createCompilerclasspath()` Support nested compiler classpath, used to locate compiler adapter
`void` | `deleteEmptyJavaFiles()` delete any java output files that are empty this is to get around a little defect in jasper: when it fails, it leaves incomplete files around.
`void` | `execute()` execute by building up a list of files that have changed and hand them off to a jsp compiler
`Path` | `getClasspath()`
`java.util.Vector` | `getCompileList()` get the list of files to compile
`Path` | `getCompilerclasspath()` get the classpath used to find the compiler adapter
`java.io.File` | `getDestdir()`
`boolean` | `getFailonerror()` Gets the failonerror flag.
`java.lang.String` | `getIeplugin()`
`java.lang.String` | `getPackage()`
`Path` | `getSrcDir()`
`java.io.File` | `getUribase()`
`java.io.File` | `getUriroot()`
`int` | `getVerbose()`
`JspC.WebAppParameter` | `getWebApp()`
`java.io.File` | `getWebinc()`
`java.io.File` | `getWebxml()` Filename for web.xml.
`boolean` | `isMapped()` If true, generate separate write() calls for each HTML line in the JSP.
`protected java.io.File` | `mapToJavaFile(JspMangler mangler, java.io.File srcFile, java.io.File srcDir, java.io.File dest)` get a filename from our jsp file
`protected void` | `resetFileLists()` Clear the list of files to be compiled and copied..
`protected void` | `scanDir(java.io.File srcDir, java.io.File dest, JspMangler mangler, java.lang.String[] files)` Scans the directory looking for source files to be compiled.
`void` | `setClasspath(Path cp)` Set the classpath to be used for this compilation.
`void` | `setClasspathRef(Reference r)` Adds a reference to a classpath defined elsewhere
`void` | `setCompiler(java.lang.String compiler)` Class name of a JSP compiler adapter.
`void` | `setCompilerclasspath(Path cp)` Set the classpath to be used to find this compiler adapter
`void` | `setDestdir(java.io.File destDir)` Set the destination directory into which the JSP source files should be compiled.
`void` | `setFailonerror(boolean fail)` Whether or not the build should halt if compilation fails.
`void` | `setIeplugin(java.lang.String iepluginid)` Java Plugin CLASSID for Internet Explorer
`void` | `setMapped(boolean mapped)` If true, generate separate write() calls for each HTML line in the JSP.
`void` | `setPackage(java.lang.String pkg)` Set the name of the package the compiled jsp files should be in.
`void` | `setSrcDir(Path srcDir)` Set the path for source JSP files.
`void` | `setUribase(java.io.File uribase)` The URI context of relative URI references in the JSP pages.
`void` | `setUriroot(java.io.File uriroot)` The root directory that uri files should be resolved against.
`void` | `setVerbose(int i)` Set the verbose level of the compiler
`void` | `setWebinc(java.io.File webinc)` output filename for the fraction of web.xml that lists servlets.
`void` | `setWebxml(java.io.File webxml)` Filename for web.xml.

Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
`add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems`

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### compileList

    protected java.util.Vector compileList

### failOnError

    protected boolean failOnError

  flag to control action on execution trouble

### webApp

    protected JspC.WebAppParameter webApp

  web apps

Constructor Detail

### JspC

    public JspC()

Method Detail

### setSrcDir

    public void setSrcDir(Path srcDir)

  Set the path for source JSP files.

### getSrcDir

    public Path getSrcDir()

### setDestdir

    public void setDestdir(java.io.File destDir)

  Set the destination directory into which the JSP source files should be compiled.

### getDestdir

    public java.io.File getDestdir()

### setPackage

    public void setPackage(java.lang.String pkg)

  Set the name of the package the compiled jsp files should be in.

### getPackage

    public java.lang.String getPackage()

### setVerbose

    public void setVerbose(int i)

  Set the verbose level of the compiler

### getVerbose

    public int getVerbose()

### setFailonerror

    public void setFailonerror(boolean fail)

  Whether or not the build should halt if compilation fails. Defaults to `true`.

### getFailonerror

    public boolean getFailonerror()

  Gets the failonerror flag.

### getIeplugin

    public java.lang.String getIeplugin()

### setIeplugin

    public void setIeplugin(java.lang.String iepluginid)

  Java Plugin CLASSID for Internet Explorer

### isMapped

    public boolean isMapped()

  If true, generate separate write() calls for each HTML line in the JSP.

  Returns:
    mapping status

### setMapped

    public void setMapped(boolean mapped)

  If true, generate separate write() calls for each HTML line in the JSP.

### setUribase

    public void setUribase(java.io.File uribase)

  The URI context of relative URI references in the JSP pages. If it does not exist then it is derived from the location of the file relative to the declared or derived value of uriroot.

  Parameters:
    `uribase` - The new Uribase value

### getUribase

    public java.io.File getUribase()

### setUriroot

    public void setUriroot(java.io.File uriroot)

  The root directory that uri files should be resolved against. (Default is the directory jspc is invoked from)

  Parameters:
    `uriroot` - The new Uribase value

### getUriroot

    public java.io.File getUriroot()

### setClasspath

    public void setClasspath(Path cp)

  Set the classpath to be used for this compilation.

### createClasspath

    public Path createClasspath()

  Adds a path to the classpath.

### setClasspathRef

    public void setClasspathRef(Reference r)

  Adds a reference to a classpath defined elsewhere

### getClasspath

    public Path getClasspath()

### setCompilerclasspath

    public void setCompilerclasspath(Path cp)

  Set the classpath to be used to find this compiler adapter

### getCompilerclasspath

    public Path getCompilerclasspath()

  get the classpath used to find the compiler adapter

### createCompilerclasspath

    public Path createCompilerclasspath()

  Support nested compiler classpath, used to locate compiler adapter

### setWebxml

    public void setWebxml(java.io.File webxml)

  Filename for web.xml.

  Parameters:
    `webxml` - The new Webxml value

### getWebxml

    public java.io.File getWebxml()

  Filename for web.xml.

  Returns:
    The filename for web.xml.

### setWebinc

    public void setWebinc(java.io.File webinc)

  output filename for the fraction of web.xml that lists servlets.

  Parameters:
    `webinc` - The new Webinc value

### getWebinc

    public java.io.File getWebinc()

### addWebApp

    public void addWebApp(JspC.WebAppParameter webappParam)
                   throws BuildException

  Adds a single webapp.

  Parameters:
    `webappParam` - add a web app parameter
    `BuildException`

### getWebApp

    public JspC.WebAppParameter getWebApp()

### setCompiler

    public void setCompiler(java.lang.String compiler)

  Class name of a JSP compiler adapter.

### getCompileList

    public java.util.Vector getCompileList()

  get the list of files to compile

### execute

    public void execute()
                 throws BuildException

  execute by building up a list of files that have changed and hand them off to a jsp compiler

  Overrides:
    `execute` in class `Task`
  Throws:
    `BuildException` - if something goes wrong with the build

### resetFileLists

    protected void resetFileLists()

  Clear the list of files to be compiled and copied..

### scanDir

    protected void scanDir(java.io.File srcDir,
                           java.io.File dest,
                           JspMangler mangler,
                           java.lang.String[] files)

  Scans the directory looking for source files to be compiled. The results are returned in the class variable compileList

### mapToJavaFile

    protected java.io.File mapToJavaFile(JspMangler mangler,
                                         java.io.File srcFile,
                                         java.io.File srcDir,
                                         java.io.File dest)

  get a filename from our jsp file

  To do:
    support packages and subdirs

### deleteEmptyJavaFiles

    public void deleteEmptyJavaFiles()

  delete any java output files that are empty this is to get around a little defect in jasper: when it fails, it leaves incomplete files around.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.