users@glassfish.java.net

jsp-compilation problem when using unc path as scratch dir

From: Michael Weigmann <michael.weigmann_at_hsh-berlin.com>
Date: Fri, 16 Mar 2007 15:33:06 +0100

Dear Glassfish-developers,

I'm not using Glassfish directly but one of the components (Jasper) inside
an embedded Jetty webserver. I have dificulties getting the jsp-compilation
to work when using an unc path as scratch dir. The problem lies in method
createOutputDir() of class JspCompilationContext where the outputDir is set
as follows:

baseUrl = options.getScratchDir().toURL(); // baseUrl is correct
String outUrlString = baseUrl.toString() + '/' + path;
URL outUrl = new URL(outUrlString); // outUrl is correct, too
outputDir = outUrl.getFile() + File.separator;

With outUrl.getFile() the server part gets missing, so adding this quite
innocently helped for me:

if( outUrl.getHost() != null ) {
    outputDir = "//"+outUrl.getHost()+outputDir;
}

Maybe there is another way without adding/changing code to overcome that
problem, but i don't see it. Would be nice if someone gives a comment to
this.

Thanks a lot,
Michael