You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dimitar Valov <di...@gmail.com> on 2016/05/09 15:34:05 UTC

Re: context root with relative path

Hi,

Have you decided if the proposed fix make since? If the corner case is
<DRIVE>:/, then it can be handled as well, not to remove the slash in case
the previous char is :.

Best Regards,
Dimitar

On Thu, Apr 21, 2016 at 7:12 PM, Leo Donahue <do...@gmail.com> wrote:

> On Apr 21, 2016 10:38 AM, "David kerber" <dc...@verizon.net> wrote:
> >
> > On 4/21/2016 11:33 AM, Leo Donahue wrote:
> >>
> >> Chris,
> >>
> >> On Apr 21, 2016 9:15 AM, "Christopher Schultz" <
> chris@christopherschultz.net>
> >> wrote:
> >>>
> >>>
> >>> I don't have a Windows machine handy right this minute, but from my
> >>> previous experience, "C:" means "the current working directory on the C
> >>> drive, from this process's perspective.
> >>>
> >>> For instance:
> >>>
> >>> D:\> DIR C:\
> >>> ...
> >>> Program Files
> >>> Windows
> >>> ...
> >>>
> >>> D:\> DIR C:
> >>> ...
> >>> Program Files
> >>> Windows
> >>> ...
> >>>
> >>> D:\> CD C:\Windows
> >>> D:\> DIR C:
> >>> ...
> >>> System
> >>> System32
> >>> ...
> >>>
> >>> So I would think that using "C:" (with no trailing path) from Java
> would
> >>> behave the same way: the current working directory *on that drive*
> would
> >>> be the one used.
> >>>
> >>> I would expect it to work just like "." on *NIX.
> >>>
> >>> -chris
> >>>
> >>> --------------------------------------------------------------
> >>
> >>
> >> On Windows 7 from a command prompt:
> >>
> >>> C:\downloads dir c:
> >>
> >> Shows contents of downloads
> >>
> >>> C:\downloads dir c:\
> >>
> >> Shows contents of c drive
> >
> >
> > Yes, that's all well-known on windows.  The question was, how does the
> Java File object handle it?   Does it give the correct result as above?
> And going back to the original question, how should these paths be
> normalized?
>
> Let's hope this looks right, pasting code from Android device...
>
> *import* java.io.File;
>
> *import* java.net.URI;
>
> *import* java.net.URISyntaxException;
>
> *import* java.util.ArrayList;
>
> *import* java.util.List;
>
>
>
> *public* *class* Demo
>
> {
>
>     *public* *static* *void* main(String[] args)
>
>     {
>
>         List<String> paths = *new* ArrayList<String>(2);
>
>         paths.add("file:/c:");
>
>         paths.add("file:/c:/");
>
>
>
>         *for* (String x : paths)
>
>         {
>
>             *try*
>
>             {
>
>                 URI uri = *new* URI(x);
>
>                 File f = *new* File(uri);
>
>                 System.*out*.println(f.getAbsolutePath());
>
>             }
>
>             *catch* (URISyntaxException e)
>
>             {
>
>                 e.printStackTrace();
>
>             }
>
>        }
>
>     }
>
> }
>

Re: context root with relative path

Posted by David kerber <dc...@verizon.net>.
On 5/9/2016 11:34 AM, Dimitar Valov wrote:
> Hi,
>
> Have you decided if the proposed fix make since? If the corner case is
> <DRIVE>:/, then it can be handled as well, not to remove the slash in case
> the previous char is :.

IMO, the correct result for this case would most likely be to INCLUDE 
the trailing "/" if the previous character is a ":".  Generally you are 
going to want to end up with "the root of <DRIVE>", not "the default 
directory on <DRIVE>".



>
> Best Regards,
> Dimitar
>
> On Thu, Apr 21, 2016 at 7:12 PM, Leo Donahue <do...@gmail.com> wrote:
>
>> On Apr 21, 2016 10:38 AM, "David kerber" <dc...@verizon.net> wrote:
>>>
>>> On 4/21/2016 11:33 AM, Leo Donahue wrote:
>>>>
>>>> Chris,
>>>>
>>>> On Apr 21, 2016 9:15 AM, "Christopher Schultz" <
>> chris@christopherschultz.net>
>>>> wrote:
>>>>>
>>>>>
>>>>> I don't have a Windows machine handy right this minute, but from my
>>>>> previous experience, "C:" means "the current working directory on the C
>>>>> drive, from this process's perspective.
>>>>>
>>>>> For instance:
>>>>>
>>>>> D:\> DIR C:\
>>>>> ...
>>>>> Program Files
>>>>> Windows
>>>>> ...
>>>>>
>>>>> D:\> DIR C:
>>>>> ...
>>>>> Program Files
>>>>> Windows
>>>>> ...
>>>>>
>>>>> D:\> CD C:\Windows
>>>>> D:\> DIR C:
>>>>> ...
>>>>> System
>>>>> System32
>>>>> ...
>>>>>
>>>>> So I would think that using "C:" (with no trailing path) from Java
>> would
>>>>> behave the same way: the current working directory *on that drive*
>> would
>>>>> be the one used.
>>>>>
>>>>> I would expect it to work just like "." on *NIX.
>>>>>
>>>>> -chris
>>>>>
>>>>> --------------------------------------------------------------
>>>>
>>>>
>>>> On Windows 7 from a command prompt:
>>>>
>>>>> C:\downloads dir c:
>>>>
>>>> Shows contents of downloads
>>>>
>>>>> C:\downloads dir c:\
>>>>
>>>> Shows contents of c drive
>>>
>>>
>>> Yes, that's all well-known on windows.  The question was, how does the
>> Java File object handle it?   Does it give the correct result as above?
>> And going back to the original question, how should these paths be
>> normalized?
>>
>> Let's hope this looks right, pasting code from Android device...
>>
>> *import* java.io.File;
>>
>> *import* java.net.URI;
>>
>> *import* java.net.URISyntaxException;
>>
>> *import* java.util.ArrayList;
>>
>> *import* java.util.List;
>>
>>
>>
>> *public* *class* Demo
>>
>> {
>>
>>     *public* *static* *void* main(String[] args)
>>
>>     {
>>
>>         List<String> paths = *new* ArrayList<String>(2);
>>
>>         paths.add("file:/c:");
>>
>>         paths.add("file:/c:/");
>>
>>
>>
>>         *for* (String x : paths)
>>
>>         {
>>
>>             *try*
>>
>>             {
>>
>>                 URI uri = *new* URI(x);
>>
>>                 File f = *new* File(uri);
>>
>>                 System.*out*.println(f.getAbsolutePath());
>>
>>             }
>>
>>             *catch* (URISyntaxException e)
>>
>>             {
>>
>>                 e.printStackTrace();
>>
>>             }
>>
>>        }
>>
>>     }
>>
>> }
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org