Applet is not able to call a URL

A

alexa.smith

Hello!

I try to make a HTTP Connection through a Applet. The Url is inside
the same CodeBase.

Error message: java.net.UnknownHostException: https://www.unserserver.de


HttpMethod method = null;

try {
URL url = new URL(sUrl);

HostConfiguration hostConfig = new HostConfiguration();
hostConfig.setHost(url.getHost(), url.getPort(), url.getProtocol());

HttpClientParams httpClientParams = new HttpClientParams();
HttpClient httpClient = new HttpClient();
httpClient.setHostConfiguration(hostConfig);
httpClient.setParams(httpClientParams);

method = new GetMethod();
method.setQueryString(url.getQuery());
method.setPath(url.getPath());

int resultCode = httpClient.executeMethod(method);


} catch (Exception e) {
System.out.println(e);
}


I have configured the JVM to use the default settings of the browser,
to connect through the proxy.
Without proxy on my own workstation it works, but for the customer it
doesn't work, allthough he saids, that he has configured the same
settings for the JVM.

Any ideas?

best regards
Alexa
 
A

Arne Vajhøj

Roedy said:
you can only do that through a SIGNED applet.

An unsigned applet can connect to the server it was fetched from.

(I am not quite sure whether "The Url is inside the same CodeBase" means
that but it could mean that)

Arne
 
A

Andrew Thompson

On Mar 7, 11:26 pm, (e-mail address removed) wrote:
...
Error message:   java.net.UnknownHostException:
https://www.unserserver.de

I am not surprised Java cannot find that URL.
IE reports it as a 404 at this point in time.

Are you *positive* the applet is coming from
that codebase? What is the URL of the page
that contains the applet?

Note what Arne was saying. An (sandboxed) applet
should have no problems fetching resources from it's
own server or codebase, unless the server itself
refuses to provide the resource.
 
A

Andrew Thompson

Not quite. Seehttp://mindprod.com/jgloss/applet.html

There are some catches.

There are a variety of errors in your understanding
of access by sandboxed applets and JWS apps to files
off their home server.

I had been meaning to set up some tests to try and
prove that to you, though past attempts to prove
minor points using code turned out to take a lot
longer, and be less effective, than I had
anticipated - that somewhat discouraged me.
 
A

alexa.smith

Actually you page says the same thing:

#Unsigned Applets (without special permission to bypass security) are
#not permitted to:
#* talk to any server but the one you were loaded from.

Arne


Many thanks to everybody!!!
I have signed the applet and it will be deploeyd. Next Friday I give
feedback if it was the solution.
But I think this was the missing point.

Alexa
 

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,774
Messages
2,569,596
Members
45,133
Latest member
MDACVReview
Top