I haven't run into any cases in Java where "file:/C:/somedir/somefile" didn't 
also work for Windows, though it may not be fully spec compliant.  This form 
has been working for a while for WtpWebappLoader.
Larry

> -----Original Message-----
> From: Filip Hanik - Dev Lists [mailto:devli...@hanik.com]
> Sent: Friday, September 04, 2009 11:27 AM
> To: Tomcat Developers List
> Subject: Re: svn commit: r810132 - /tomcat/tc6.0.x/trunk/STATUS.txt
>
> the URL for Unix would be file:///somedir/somefile
>
> Windows is always a pain in the butt, but I think you need
> file:///c:/somedir/somepath
>
> Filip
>
>
> On 09/04/2009 07:22 AM, Larry Isaacs wrote:
> > On Windows prepending "file://" to "C:\somedir\somefile" results in
> "file://C:/somedir/somefile".  I'm pretty sure URL will think "C" is
> the host name and fail if you try to use a URL object to read the file.
> I think it was the same issue on Linux when prepending "file:/" to
> "/somedir/somefile", i.e. "somedir" was seen as a host name.  I think
> you need to ensure there is one slash or three to avoid inadvertently
> specifying a host name.
> >
> > Larry
> >
> >
> >> -----Original Message-----
> >> From: Filip Hanik - Dev Lists [mailto:devli...@hanik.com]
> >> Sent: Thursday, September 03, 2009 5:52 PM
> >> To: Tomcat Developers List
> >> Subject: Re: svn commit: r810132 - /tomcat/tc6.0.x/trunk/STATUS.txt
> >>
> >> The URL has to start with "file://"
> >>
> >> So the VirtualWebappLoader, can take a regular file path, and should
> >> simply prepend file://, not file: or file:/
> >>
> >> Filip
> >>
> >> On 09/01/2009 12:48 PM, Larry Isaacs wrote:
> >>
> >>> Hi Filip,
> >>>
> >>> I have a vague recollection about tripping over this issue while
> >>>
> >> working on the Tomcat support in the Eclipse Web Tools Platform.
> WTP
> >> has its own version(s) of VirtualWebappLoader, called
> WtpWebappLoader,
> >> to address it.  If I'm recalling the issue correctly, pre-pending
> >> "file:/" worked on Windows, but not on Linux since an absolute path
> >> ended up as "file://somedir/...".  I believe with the change below,
> >> pre-pending "file://" will work for Linux, but not for Windows, i.e.
> >> "file://C:/somedir/..." is going to have problems.  If it helps, I
> went
> >> with the URL form "file:/somedir/..." and used the following code
> >> snippet to get it working for Windows and Linux in WtpWebappLoader:
> >>
> >>>
> >>>               String path = file.getAbsolutePath();
> >>>               if (path.startsWith("/")) {
> >>>                   path = "file:" + path;
> >>>               } else {
> >>>                   path = "file:/" + path;
> >>>               }
> >>>               if (file.isDirectory()) {
> >>>                   addRepository(path + "/");
> >>>               } else {
> >>>                   addRepository(path);
> >>>               }
> >>>
> >>> Cheers,
> >>> Larry
> >>>
> >>>
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: fha...@apache.org [mailto:fha...@apache.org]
> >>>> Sent: Tuesday, September 01, 2009 1:22 PM
> >>>> To: dev@tomcat.apache.org
> >>>> Subject: svn commit: r810132 - /tomcat/tc6.0.x/trunk/STATUS.txt
> >>>>
> >>>> Author: fhanik
> >>>> Date: Tue Sep  1 17:21:59 2009
> >>>> New Revision: 810132
> >>>>
> >>>> URL: http://svn.apache.org/viewvc?rev=810132&view=rev
> >>>> Log:
> >>>> proposal
> >>>>
> >>>> Modified:
> >>>>       tomcat/tc6.0.x/trunk/STATUS.txt
> >>>>
> >>>> Modified: tomcat/tc6.0.x/trunk/STATUS.txt
> >>>> URL:
> >>>>
> >>>>
> >>
> http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=810132
> >>
> >>>> &r1=810131&r2=810132&view=diff
> >>>>
> >>>>
> >>
> =======================================================================
> >>
> >>>> =======
> >>>> --- tomcat/tc6.0.x/trunk/STATUS.txt (original)
> >>>> +++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Sep  1 17:21:59 2009
> >>>> @@ -321,3 +321,25 @@
> >>>>      +1: funkman
> >>>>      -1:
> >>>>
> >>>> +
> >>>> +* Fix VirtualWebappClassLoader file directives
> >>>> +  Index: java/org/apache/catalina/loader/VirtualWebappLoader.java
> >>>>
> +===================================================================
> >>>> +--- java/org/apache/catalina/loader/VirtualWebappLoader.java
> >>>>         (revision 810099)
> >>>> ++++ java/org/apache/catalina/loader/VirtualWebappLoader.java
> >>>>         (working copy)
> >>>> +@@ -92,9 +92,9 @@
> >>>> +                 continue;
> >>>> +             }
> >>>> +             if (file.isDirectory()) {
> >>>> +-                addRepository("file:/" + file.getAbsolutePath()
> +
> >>>> "/");
> >>>> ++                addRepository("file://" + file.getAbsolutePath()
> +
> >>>> "/");
> >>>> +             } else {
> >>>> +-                addRepository("file:/" +
> file.getAbsolutePath());
> >>>> ++                addRepository("file://" +
> file.getAbsolutePath());
> >>>> +             }
> >>>> +         }
> >>>> +
> >>>> +  +1: fhanik
> >>>> +  -1:
> >>>> +
> >>>> +
> >>>>
> >>>>
> >>>>
> >>>> ------------------------------------------------------------------
> --
> >>>>
> >> -
> >>
> >>>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> >>>> For additional commands, e-mail: dev-h...@tomcat.apache.org
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >> --------------------------------------------------------------------
> -
> >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: dev-h...@tomcat.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>

Reply via email to