org.apache.tools.ant.taskdefs.optional.jsp

Class WLJspc

public class WLJspc extends MatchingTask

Precompiles JSP's using WebLogic's JSP compiler (weblogic.jspc). Tested only on Weblogic 4.5.1 - NT4.0 and Solaris 5.7 required attributes src : root of source tree for JSP, ie, the document root for your weblogic server dest : root of destination directory, what you have set as WorkingDir in the weblogic properties package : start package name under which your JSP's would be compiled other attributes classpath A classpath should be set which contains the weblogic classes as well as all application classes referenced by the JSP. The system classpath is also appended when the jspc is called, so you may choose to put everything in the classpath while calling Ant. However, since presumably the JSP's will reference classes being build by Ant, it would be better to explicitly add the classpath in the task The task checks timestamps on the JSP's and the generated classes, and compiles only those files that have changed. It follows the weblogic naming convention of putting classes in _dirName/_fileName.class for dirname/fileName.jsp Limitation: It compiles the files thru the Classic compiler only. Limitation: Since it is my experience that weblogic jspc throws out of memory error on being given too many files at one go, it is called multiple times with one jsp file each.
 example
 <target name="jspcompile" depends="compile">
   <wljspc src="c:\\weblogic\\myserver\\public_html"
           dest="c:\\weblogic\\myserver\\serverclasses" package="myapp.jsp">
   <classpath>
          <pathelement location="${weblogic.classpath}" />
           <pathelement path="${compile.dest}" />
      </classpath>

   </wljspc>
 </target>
 
Method Summary
PathcreateClasspath()
Maybe creates a nested classpath element.
voidexecute()
protected StringreplaceString(String inpString, String escapeChars, String replaceChars)
protected voidscanDir(String[] files)
voidsetClasspath(Path classpath)
Set the classpath to be used for this compilation.
voidsetDest(File dirName)
Set the directory containing the source jsp's
voidsetPackage(String packageName)
Set the package under which the compiled classes go
voidsetSrc(File dirName)
Set the directory containing the source jsp's

Method Detail

createClasspath

public Path createClasspath()
Maybe creates a nested classpath element.

execute

public void execute()

replaceString

protected String replaceString(String inpString, String escapeChars, String replaceChars)

scanDir

protected void scanDir(String[] files)

setClasspath

public void setClasspath(Path classpath)
Set the classpath to be used for this compilation.

setDest

public void setDest(File dirName)
Set the directory containing the source jsp's

Parameters: dirName the directory containg the source jsp's

setPackage

public void setPackage(String packageName)
Set the package under which the compiled classes go

Parameters: packageName the package name for the clases

setSrc

public void setSrc(File dirName)
Set the directory containing the source jsp's

Parameters: dirName the directory containg the source jsp's

Copyright