Convert ASP file to Java file with asp2java command
This section explains how to convert ASP file to Java file with asp2java command. Using this asp2java command, you can convert one ASP file as well as convert all ASP files under one folder or more folders. You can select to compile the java file to class file. Then when your ASP file running via your web server, it will invoke corresponding class file to run it. Therefore, the command can promote the running speed greatly. Following is the detail usage of the asp2java command:
Usage:
1. Convert ASP files to Java files.java asp2java [option0/option1] <target>
Remark
option0
-r <application root local path> (please refer to Example#1)
-r: This parameter is used in a ASP file or a ASP Project, If this Project is specified as DocumentRoot(e.g. DocumenRoot "c:/inetput/wwwroot") in Apache's property file or our Admin. -r parameter must be used here. Otherwise, use -a parameter. (Note: You must use one of -a or -r parameter).
application root local path: root directory correspond to URL.
-r parameter can be write as following: -r c:/inetpub/wwwroot.-v <virtual name1>=<local path1>[;<virtual name2>=<local path2>;...] (please refer to: Example#2)
-V: This parameter is used in the ASP file while it includes "#include" statement and there is "virtual" property in the staement. e.g: There is "virtual" property in ASP statement "<!--#include virtual=/iasp/a.asp-->", -v parameter must be used here. Otherwise need not.
virtual name1: virtual path name, it's also alias. it will be registered in our Admin, just like "iasp" in former ASP statement.
local path: virtual path,it is the native path correspond to virtual path name(iasp).
e.g: "c:/iasp/samples/". ";" character is used to separate two or more "-v" parameters.
It is to say, -v parameter can write as following: -v iasp=c:/iasp/samples/.-a <application name1>=<local path1>[;<application name2>=<local path2>;...] (please refer to: Example#3)
-a: This parameter is used to an ASP Project, which has a virtual path name(Alias). The Alias has been denfined in Apache's property file httpd.conf(e.g: Alias/iasp/ "c:/iasp/
samples/"), or registered in our Admin. If the correspond URL of ASP file is "http://host:
port/iasp/index.htm", "iasp" is the Alias. If the ASP Project has an Alias, -a parameter must be used here. Otherwise, use -r parameter. (Note: You must use one of -a or -r parameter).
application name1: Project name or virtual path name(Alias).
local path: virtual path, corresponding native path of virtual path name(iasp). e.g: "c:/iasp/samples/". ";" character is used to separate two or more "-a" parameters.
It is to say, -a parameter can write as following: -a iasp=c:/iasp/samples/.
Note: If there is a global.asa file in your ASP Project, you should use the abslute path of global.asa as -a parameter to make the global.asa file in effect.(please refer to:
Example#4)option1
-p <properties file> (please refer to: Example#5)-P: This parameter is used to analysis a property file, which includes all parameters of option0. (Note: option0 and option1 implement the same function, so each of them is ok)
properties file: The absolute path name where there is the property file. e.g: the property file name is "virtual.properties", please refer to virtual.properties for its content, its path should be "c:/iasp/properties/".
-p parameter can be write as following: -p c:/iasp/properties/virtual.properties.<target>:
Directories to set generated java files and class files('.' character express current directory).
Note: You can enter "java asp2java -?" or "java asp2java -help" to display simple help information.
Example#1:If this ASP Project has not Alias, and all ASP files don't include statement "<!==#include virtual=...-->", (we suppose that "DocumentRoot=c:/inetpub/wwwroot/", and generated target code is under directory"d:/iasp/servlet"), asp2java command line should be:
java asp2java -r c:/inetpub/wwwroot d:/iasp/servlets
Example#2:If this ASP Project has not Alias, and there is/are one or more ASP files include statement "<!==#include virtual=...-->", (we suppose that "DocumentRoot=c:/inetpub/wwwroot/", absolute path related to Alias "iasp" in former "#include" statement is "c:/iasp/samples/", and generated target code is under directory"d:/iasp/servlet"), asp2java command line should be:
java asp2java -v iasp=c:/iasp/samples -r c:/inetpub/wwwroot d:/iasp/servlets
If this ASP file include statement "<!#include virtual=/iasp0/a.asp-->", (we suppose that absolute path related to Alias "iasp0" is "c:/iasp0/samples/"), asp2java command line should be:
java asp2java -v iasp=c:/iasp/samples;iasp0=c:/iasp0/samples -r c:/inetpub/wwwroot d:/iasp/servletsIf this ASP Project has Alias, and there is no statement <!--#include virtual=...-->" in all ASP files. (we suppose that Alias name is "iasp" corresponding absolute path is "c:/iasp/samples/", and generated target code in under directory "d:/iasp/servlets"), asp2java command line should be:
java asp2java -a iasp=c:/iasp/samples d:/iasp/servlets
If it is need to convert two or more ASP Projects in the same time, (Project1 's Alias name is "iasp1", its absolute path is "c:/iasp1/samples/"; Project2 's Alias name is "iasp2", its absolute path is "c:/iasp2/samples/"; Project3 's Alias name is "iasp3", its absolute path is "c:/iasp3/samples/"; ...), asp2java command line should be:
java asp2java -a iasp1=c:/iasp1/samples;iasp2=c:/iasp2/samples;iasp3=c:/iasp3/samples d:/iasp/servletsIf you just want to convert one or more directories of an ASP Project, (we suppose that this ASP Project's Alias name is "iasp", its absolute path is "c:/iasp/samples/", If you just want to convert "test1" and "test2" sub-directory, and generated target code in under directory "d:/iasp/servlets"), asp2java command line should be:
java asp2java -a iasp/test1=c:/iasp/samples/test1;iasp/test2=c:/iasp/samples/test2 d:/iasp/servletsYou can implement the same task as option0 via defining property file "virtual.properties". (we suppose that this file is defined under directory "d:/iasp/propertes/", and generated target code is under directory "d:/iasp/servlets"), asp2java command line should be:
java asp2java -p d:/iasp/properties/virtual.properties d:/iasp/servletsFor Example#1, its property file "virtual.properties" can be writen as following:
-r c:/inetpub/wwwroot
For Example#2, its property file "virtual.properties" can be writen as following:
-v0 iasp=c:/iasp/samples
-v1 iasp0=c:/iasp0/samples
-r c:/inetpub/wwwrootFor Example#3, its property file "virtual.properties" can be writen as following:
-a1 iasp1=c:/iasp1/samples
-a2 iasp1=c:/iasp2/samples
-a3 iasp1=c:/iasp3/samplesFor Example#4, its property file "virtual.properties" can be writen as following:
-a0 iasp/test1=c:/iasp/samples/test1
-a1 iasp/test2=c:/iasp/samples/test2In a word, the content of its property file "virtual.properties" as following:
-v0 Alias0=corresponding path0
-v1 Alias1=corresponding path1
.
.
.
-a0 Alias0=corresponding path0
-a1 Alias1=corresponding path1
.
.
.
-r Root directory correspond to ASP Project2. Set classpath:
Set a classpath variable to your target directory(target) in your system. The target directory is the drectory where to generate java files or class file.
3. Run ASP file:
Restart your web server, run ASP files via your IE or Nescape explorer.
NOTE: 1) If an ASP file is changed, you should convert this ASP file with asp2java command again. and this time it just convert the changed ASP file. So, this is a helpful function for your debugging your ASP file after converting. 2) After convert one or more ASP Projects with asp2java command, it will generate one or more servlet files(each ASP Project correspond to a Servlet file). this Servlet file is an interface between Server side and Client side, can lead the implementation of ASP Project. You can change the setting of property file "iasp/properties/rules.properties" to make it connect with this Servlet directly. So, the running speed will be promoted more greatly. The name rule of this Servlet is '_'+vritualName+'_Servlet.java', and virtual is the Alias of the Project. If the ASP Project has no Alias, it needn't -a parameter, then its name rule is '_Application1_Servlet.java'. 3) If this Project associate with another of more other ASP Projects, you can change the setting of of the Servlet in property file "/iasp/properties/rules.properties" to make it connect with "util.ReleaseServlet". Therefore, you can run many ASP projects on one web server in the same time. 4) You can also convert single ASP file with asp2java command(use -r parameter), but it doesn't generate Servlet file, so this ASP can't run on explorer. If you encounter any problems or errors, please contact support@halcyonsoft.com
Copyright © 1998-2002, Halcyon Software Inc. All rights reserved.