Applet showDocument and init Method

P

pcouas

Hi,


I have implemented an UPLOAD applet that work fine, but when after
upload, my applet tried to forwad to another URL with an ShowDocument,
init Method is calling a second time, do you have an idea.
I have putting code into init Method because i need an automatic
calling .

My code
This
this.getAppletContext().showDocument("http://172.15.5.103:80/test/toto.doc","_self");


Do you have an idea
Regards
Philippe
 
A

Andrew T.

pcouas wrote:
....
I have implemented an UPLOAD applet that work fine, but when after
upload, my applet tried to forwad to another URL with an ShowDocument,

showDocument was never very reliable, and is getting less
reliable by the day.
Do you have an idea

You might launch your applet using JWS and use the WebStart method
to get a borwser window (which at least returns true/false for
success).

Alternately, you might try adding a little JS to the page to check it
changes and if not, pop-up a dialog.

Another idea is to add a question mark (?) at the end of questions.
(Which helps people understand you, and encourages them to reply).

HTH

Andrew T.
 
P

pcouas

Hi,

I can not use JavaWebstart and Method with JSCRIPT give me security
acces problem

Regards
Philippe
 
A

Andrew T.

pcouas said:
I can not use JavaWebstart

Why not?
.. and Method with JSCRIPT give me security
acces problem

In that case, it sounds like the applet needs to be signed
(I am not very familiar with Applet/JS interaction, but
have seen some cases where it required signed code.).

HTH

Andrew T.
 
D

Dag Sunde

pcouas said:
Yes i know and my applet is still signed, i don't understand why ?

If you have a signed applet, it is allowed to execute
privileged code within itself. Ie. when the call to execute
comes from the applet itself.

If you call any applet-method that execute privileged code
from a JavaScript function, the security system recognize
this (Your Javascript is not signed and granted permission),
and denies the execution.

One way to walk around this <hack_warning/> is to have a thread
regularly check a flag if the priv. method is to be run.
Then from Javascript, call a method in the applet that only
sets the flag and falls out.
 
M

Mickey Segal

Dag Sunde said:
If you have a signed applet, it is allowed to execute
privileged code within itself. Ie. when the call to execute
comes from the applet itself.

From a signed applet you can launch a new instance of the browser using
Runtime.exec. This is the most robust solution and it is quite safe from
abuse since the user only agrees to accept a digital signature from a
trusted source. We use such windows for documentation and other links for
which users click hyperlinks in applets (without destroying the applet by
launching in the same browser window).

The syntax for opening browsers is not very obvious, so here is some sample
code (where booleans such as microsoftBrowser are defined externally):

final static void showInBrowser(URL url)
{
try
{
if (microsoftBrowser && windowsOS) Runtime.getRuntime().exec("iexplore.exe
" + url);
else if (firefoxBrowser && windowsOS)
Runtime.getRuntime().exec("firefox.exe \"" + url + "\"");
else if (firefoxBrowser && macOS) Runtime.getRuntime().exec(new String[]
{"open", "-a", "Firefox.app", url.toString()});
else appletContext.showDocument(url, "_blank");
}
catch (Exception e)
{
System.out.println("Couldn't show in browser: " + e);
}
}

Nothing is done for Safari on Macintosh since showDocument still works there
(the last time I checked).

If anyone has improvements to suggest please mention them so we can all have
a robust workaround to use for signed applets.
 
A

Andrew T.

Mickey Segal wrote:
...
The syntax for opening browsers is not very obvious, so here is some sample
code (where booleans such as microsoftBrowser are defined externally): ...
If anyone has improvements to suggest please mention them so we can all have
a robust workaround to use for signed applets.

http://browserlaunch2.sourceforge.net/
which is software specialised to open a browser that is thoroughly
and comprehensively tested. It also tries to cover all systems.
Nothing is done for Safari on Macintosh since showDocument still works there
(the last time I checked).

....hmmm. 'Future proofing' might be a good idea on this
one Mickey. ;-)

Andrew T.
 
P

pcouas

Hi,

I want open my local document, into a left frame and not into a new
browsers

Regards
Philippe
 
A

Andrew T.

pcouas wrote:
....
I want open my local document, into a left frame and not into a new
browsers

I still use frames occasionally, mostly for stuff delivered off CD,
but they are ..
- not part of the oiriginal design of HTML
- not well supported (if at all) for users of screen readers
- difficult to bookmark
...for these and many other reasons, it is a good idea to
redesign the 'application' away from using (HTML) frames.

Andrew T.
 
P

pcouas

In this project ShowDocument is runing, but applet is reloaded and
showdocument launching an second time .

ShowDocument code is in init() method

Regards
Philippe
 
A

Andrew T.

pcouas said:
In this project ShowDocument is runing, but applet is reloaded and
showdocument launching an second time .

There are a number of questions I could ask here, most of
them are answered if I can visit your applet.

(I suggest you) put an unsigned version on the web (my
browsers have no pop-up blockers), and post the URL to
the web page and code.

Andrew T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top