tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <j...@kewlstuff.co.za>
Subject Re: linux + tomcat, some path/link problem
Date Tue, 24 Apr 2007 18:20:09 GMT
Ha ha.... boy of boy are you in for some pain... sorry cant help myself.

Well yes, you need to convert... because MS just didnt have the decency to 
ask the linux guys how to do it ;)

Heres a little code for you

                if(rawFileName == null) return "";
                if(rawFileName.length() == 0) return "";

                String s = rawFileName;
                s = s.replace('\\','/'); // make it unix compat
                s = s.trim();

                String firstChar = s.substring(0,1);
                if(firstChar.compareTo("/") != 0){
                    s = "/" + s;

something like that....
But this is why I'm talking to you.... have a look at file/// security 
restrictions on XP and later.
They going to get blocked.... so after all that pain... IE is going to drive 
you mad.... ha ha.

But I got some good news for you.... go to http://coolese.100free.com/
and download ESE... it does exactly that... its based on lucene and it 
allows you to search folders, and or dB's and then navigate the results in a 
browser.
Have a look at how it navigates.... it doesnt use file///   it turns the 
directories into a URL and navigates through Tomcat.... to get around 
security issues.
So yes I'm laughing coz I went through all this pain.... good luck.


----- Original Message ----- 
From: "Lu Rui" <mcrayes@gmail.com>
To: <users@tomcat.apache.org>
Sent: Tuesday, April 24, 2007 6:45 PM
Subject: linux + tomcat, some path/link problem


> hi, all,
>
>     i'm writing a jsp front-end of a desktop search program in linux
> using tomcat 5.5, here is my problem.
>
>     say we need a result.jsp which can display the results from
> lucene and show the related links, codes like below (hard-coding
> for simple, as long as you can get my thougt is okay)
>
> // for winxp
> String filePath = new String("c:\\root\\test.html");
>
>
> // for linux
> String filePath = new String("/root/test.html");
>
> <A href="<%= filePath %>"> testlink </A>
>
> i've test this page both in winxp and linux. in windows,
> right-click to check out the property of "testlink" you can see it
> goes to " file:///c:/root:/test.html " and left-click then the browser
> will open corresponding page, which is exactly what i've been
> expecting.
>
> but in linux here comes my trouble, i click "testlink" it
> goes to "404 not found", then i check out its property and find it
> leads to " http://localhost:8080/root/index.html ", it seems tomcat
> took " /root " as a subdir of " /tomcat/webapps " and messed things up, 
> totally
> misunderstood my purpose.
>
> as far as i know path is always a confusing problem of tomcat, but in
> linux "/" stands for root of file system, so i'm clearly using an
> abusolute path, why tomcat still made such mistake while it works well
> in windows with " C:\\root\test.html" ?
> and as mentioned above, this link, actually these links,
> might go to anywhere in local file system, which makes the trouble
> more complex, so i don't think setup Context or docBase or
> relative-path could help much, i really need tomcat to be informed
> that i'm using
> abusolute path and i don't care it goes out of web project and that's
> what i want.
>
> plz help me out. thanks. and if what i said make you feel somehow 
> offended,
> it's not my bad feelings just my bad english..
>
> while ( true ) {
> help me out;
> }
>
> regards.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 


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


Mime
View raw message