Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   applet showDocument work with file protocol? (http://www.velocityreviews.com/forums/t132395-applet-showdocument-work-with-file-protocol.html)

BW 04-08-2004 02:04 PM

applet showDocument work with file protocol?
 
I have a signed applet with full permission. But the applet
showDocument method seems not work with file protocol. It works fine
with http protocol. I will really appreciate it if anyone know how
to make it work.

The below is the code snippet:

...
try
{
//test file protocol
applet.getAppletContext().showDocument(new URL
("file:///c:/test.txt"),"_blank");
//test http protocol
applet.getAppletContext().showDocument(new
URL("http://google.com"),"_blank");
}
catch(Exception e)
{
e.printStackTrace();
}
....

Mickey Segal 04-08-2004 03:41 PM

Re: applet showDocument work with file protocol?
 
"BW" <wub_@hotmail.com> wrote in message
news:691a56f2.0404080604.2b155757@posting.google.c om...
> I have a signed applet with full permission. But the applet
> showDocument method seems not work with file protocol.
> ..
> applet.getAppletContext().showDocument(new URL
> ("file:///c:/test.txt"),"_blank");


The format depends on that used by the operating system. You can get the
format from getCodeBase() if you are running the applet on the local
computer.



BW 04-09-2004 01:35 PM

Re: applet showDocument work with file protocol?
 
Thanks for answering my question. I think the format is good,
otherwise there will be an exception thrown. I paste this to a
browser address, it works for both IE and Netscape. (In IE, if I
change the browser options/security/local intranet/sites, then it
works), The only thing I am worried is that the applet showDocument
does not support file protocol.

"Mickey Segal" <ignored@example.com> wrote in message news:<4075728b$0$1663$61fed72c@news.rcn.com>...
> "BW" <wub_@hotmail.com> wrote in message
> news:691a56f2.0404080604.2b155757@posting.google.c om...
> > I have a signed applet with full permission. But the applet
> > showDocument method seems not work with file protocol.
> > ..
> > applet.getAppletContext().showDocument(new URL
> > ("file:///c:/test.txt"),"_blank");

>
> The format depends on that used by the operating system. You can get the
> format from getCodeBase() if you are running the applet on the local
> computer.


Mickey Segal 04-09-2004 02:54 PM

Re: applet showDocument work with file protocol?
 
"BW" <wub_@hotmail.com> wrote in message
news:691a56f2.0404090535.56f1ff30@posting.google.c om...
> Thanks for answering my question. I think the format is good,
> otherwise there will be an exception thrown. I paste this to a
> browser address, it works for both IE and Netscape. (In IE, if I
> change the browser options/security/local intranet/sites, then it
> works), The only thing I am worried is that the applet showDocument
> does not support file protocol.


showDocument does support file protocol - we use it for local files on both
Windows and Macintosh. On Windows XP, the new browser windows show as the
address file designations of the form:
file:///C:/Documents%20and%20Settings/....



Christian Kaufhold 04-09-2004 04:31 PM

Re: applet showDocument work with file protocol?
 
BW <wub_@hotmail.com> wrote:
> I have a signed applet with full permission. But the applet
> showDocument method seems not work with file protocol. It works fine
> with http protocol. I will really appreciate it if anyone know how
> to make it work.



What does "not work" mean?

Try new File("...").toURL()



Christian

BW 04-09-2004 07:23 PM

Re: applet showDocument work with file protocol?
 
It works in our internal intranet in IE(win2k OS) too. For example,
if my machine name is testComputer, then I access a html file(include
the applet) in the web server in this machine by
http://testComputer/html/viewFile.html. The applet inside this html
works fine to view the local files. But if I want to access this page
from outside of the intranet by using its full domain name, then
nothing happens, not even an exception is thrown. For example
http://testComputer.fulldomain.com/html/viewFile.html. Have you tried
to access the page using the full domain name from outside of your
company? If yes, can you let know how you manage to do it? Thanks a
lot!

"Mickey Segal" <ignored@example.com> wrote in message news:<4076b90a$0$1649$61fed72c@news.rcn.com>...

> showDocument does support file protocol - we use it for local files on both
> Windows and Macintosh. On Windows XP, the new browser windows show as the
> address file designations of the form:
> file:///C:/Documents%20and%20Settings/....


Mickey Segal 04-09-2004 09:12 PM

Re: applet showDocument work with file protocol?
 
"BW" <wub_@hotmail.com> wrote in message
news:691a56f2.0404091123.42dabc1@posting.google.co m...
> It works in our internal intranet in IE(win2k OS) too. For example,
> if my machine name is testComputer, then I access a html file(include
> the applet) in the web server in this machine by
> http://testComputer/html/viewFile.html. The applet inside this html
> works fine to view the local files. But if I want to access this page
> from outside of the intranet by using its full domain name, then
> nothing happens, not even an exception is thrown. For example
> http://testComputer.fulldomain.com/html/viewFile.html. Have you tried
> to access the page using the full domain name from outside of your
> company? If yes, can you let know how you manage to do it? Thanks a
> lot!


All I have ever tried was:
1. Opening HTML pages on the open web with
www.SomeDomain.com/someFolder/file.html format.
2. Opening HTML files on my own computer (Macintosh OS 9, OS X or Windows).



BW 04-12-2004 02:23 PM

Re: applet showDocument work with file protocol?
 
In the applet do you open local file by
applet.getAppletContext().showDocument(new URL
("file:///c:/somefile.txt"),"_blank");

Does this working both IE and netscape? Then why mine does not work?
Can you provide a code snippet?

Thanks!

"Mickey Segal" <ignored@example.com> wrote in message news:<407711c1$0$1651$61fed72c@news.rcn.com>...
> All I have ever tried was:
> 1. Opening HTML pages on the open web with
> www.SomeDomain.com/someFolder/file.html format.
> 2. Opening HTML files on my own computer (Macintosh OS 9, OS X or Windows).


BW 04-12-2004 03:13 PM

Re: applet showDocument work with file protocol?
 
"Not work" means nothing happens, while it suppose have a new browser
openned to show the contents of the file. I try the file.toURL()
method, it does not work in IE (using ms jvm, only support jdk 1.18)
or netscape (j2sdk 1.4.1). Does this work for you? Thanks for taking
time to answer my question!

usenet@chka.de (Christian Kaufhold) wrote in message news:<0T16982oI5ebNmc0@uni.chka.de>...
> BW <wub_@hotmail.com> wrote:
> > I have a signed applet with full permission. But the applet
> > showDocument method seems not work with file protocol. It works fine
> > with http protocol. I will really appreciate it if anyone know how
> > to make it work.

>
>
> What does "not work" mean?
>
> Try new File("...").toURL()
>
>
>
> Christian


Mickey Segal 04-12-2004 07:34 PM

Re: applet showDocument work with file protocol?
 
"BW" <wub_@hotmail.com> wrote in message
news:691a56f2.0404120623.465219f8@posting.google.c om...
> In the applet do you open local file by
> applet.getAppletContext().showDocument(new URL
> ("file:///c:/somefile.txt"),"_blank");
>
> Does this working both IE and netscape? Then why mine does not work?
> Can you provide a code snippet?


This is the essence of the code:

URL resourceRoot;
boolean runningFromWeb = getCodeBase().toString().startsWith("http");
if (!runningFromWeb) resourceRoot = getCodeBase();
else resourceRoot = new URL("http://SomeDomain.com/);
getAppletContext().showDocument(new URL(resourceRoot,
"SomeFolder/SomeFilePrefix.html"), "_blank");




All times are GMT. The time now is 08:13 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.