You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2002/02/01 22:54:21 UTC
cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper CommandLineContext.java
kinman 02/02/01 13:54:21
Modified: jasper/src/share/org/apache/jasper CommandLineContext.java
Log:
PR: 5471
Submitted by: steve.downey@netfolio.com (Steve Downey)
Revision Changes Path
1.8 +28 -4 jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java
Index: CommandLineContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- CommandLineContext.java 10 Dec 2001 17:43:16 -0000 1.7
+++ CommandLineContext.java 1 Feb 2002 21:54:21 -0000 1.8
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java,v 1.7 2001/12/10 17:43:16 kinman Exp $
- * $Revision: 1.7 $
- * $Date: 2001/12/10 17:43:16 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java,v 1.8 2002/02/01 21:54:21 kinman Exp $
+ * $Revision: 1.8 $
+ * $Date: 2002/02/01 21:54:21 $
*
* ====================================================================
*
@@ -216,7 +216,31 @@
* The package name for the generated class.
*/
public String getServletPackageName() {
- return servletPackageName;
+ //get the path to the jsp file
+ int indexOfSlash = getJspFile().lastIndexOf('/');
+ String pathName;
+ if (indexOfSlash != -1) {
+ pathName = getJspFile().substring(0, indexOfSlash);
+ } else {
+ pathName = "/";
+ }
+ //Assemble the package name from the base package name speced on
+ //the command line and the package name derived from the path to
+ //the jsp file
+ String packageName = "";
+ if (servletPackageName != null && !servletPackageName.equals("")) {
+ packageName = servletPackageName;
+ }
+ if (packageName.equals("")) {
+ packageName = pathName.replace('/', '.');
+ } else {
+ packageName += pathName.replace('/', '.');
+ }
+ //strip off any leading '.' in the package name
+ if (!packageName.equals("") && packageName.charAt(0) == '.') {
+ packageName = packageName.substring(1);
+ }
+ return packageName;
}
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>