kinman      02/02/01 14:20:37

  Modified:    jasper/src/share/org/apache/jasper Tag: tomcat_40_branch
                        CommandLineContext.java
  Log:
  PR: 5471
  Submitted by: [EMAIL PROTECTED] (Steve Downey)
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.1   +29 -5     
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.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- CommandLineContext.java   8 Feb 2001 13:36:56 -0000       1.6
  +++ CommandLineContext.java   1 Feb 2002 22:20:37 -0000       1.6.2.1
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java,v
 1.6 2001/02/08 13:36:56 glenn Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/02/08 13:36:56 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java,v
 1.6.2.1 2002/02/01 22:20:37 kinman Exp $
  + * $Revision: 1.6.2.1 $
  + * $Date: 2002/02/01 22:20:37 $
    *
    * ====================================================================
    * 
  @@ -164,7 +164,7 @@
       
       /**
        * What class loader to use for loading classes while compiling
  -     * this JSP? I don't think this is used right now -- akv. 
  +     * this JSP?
        */
       public ClassLoader getClassLoader() {
           return loader;
  @@ -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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to