DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6058>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6058 Generated java files not in a correct package ------- Additional Comments From [EMAIL PROTECTED] 2002-03-09 16:14 ------- Proposed changes to implement this enhancement : changes to 3 classes in the jasper source. 1- JasperLoader.java loadClass(string,boolean) method: i changed this: // Only load classes for this JSP page if( name.startsWith(Constants.JSP_PACKAGE_NAME + "." + className) ) { String classFile = name.substring(Constants.JSP_PACKAGE_NAME.length()+1) + ".class"; byte [] cdata = loadClassDataFromFile(classFile); into this: // Only load classes for this JSP page if( name.startsWith(Constants.JSP_PACKAGE_NAME)) { byte [] cdata = loadClassDataFromFile(className +".class"); so the test if it is a jsp page is only about the standaard jsp package name but that should be good enough for everything. besides that i use the internal classname (which is the real classname without package or ".class") instead of computing it again. I really don't know why they do that because the real class name is given with the constructor of JasperLoader.. 2- JspServlet.java the loadJSP method: changed this: if( outURI.endsWith("/") ) outURI = outURI + jspUri.substring(1,jspUri.lastIndexOf("/")+1); else outURI = outURI + jspUri.substring(0,jspUri.lastIndexOf("/")+1);; outURL = new URL(outURI); into this: if( outURI.endsWith("/") ) outURI = outURI + jspUri.substring(1,jspUri.lastIndexOf("/")+1); else outURI = outURI + jspUri.substring(0,jspUri.lastIndexOf("/")+1);; StringBuffer sb = new StringBuffer(outURI.length()); StringTokenizer st = new StringTokenizer(outURI, " "); while(st.hasMoreTokens()) { sb.append(st.nextToken()); } outURI = sb.toString(); outURL = new URL(outURI); for removing the spaces out of the output dir (so it is equal to the classpath, see below) and this jsw.servletClass = jsw.loader.loadClass( Constants.JSP_PACKAGE_NAME + "." + ctxt.getServletClassName()); into this jsw.servletClass = jsw.loader.loadClass(ctxt.getServletPackageName() + "." + ctxt.getServletClassName()); This should be default anyway because the ctxt (context class) is defining everything so it should also be used here. Default it will say: Constants.JSP_PACKAGE_NAME. 3- JspEngineContext.java This added to the constructor: jspFile = jspFile.replace('\\', '/'); int index = jspFile.lastIndexOf('/'); if(index > 0) { String sPackageEnd = jspFile.substring(0, index); sPackageEnd = sPackageEnd.replace('/', '.'); StringBuffer sb = new StringBuffer(sPackageEnd.length()); if(!sPackageEnd.startsWith(".")) sb.append("."); // filter out spaces StringTokenizer st = new StringTokenizer(sPackageEnd, " "); while(st.hasMoreTokens()) { sb.append(st.nextToken()); } this.servletPackageName += sb.toString(); } so the servletPackageName wil be the default one + the subdirs where it is in. (i remove the spaces, any idee's what are more allowed in dirs but not in packages?) -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>