Applet is not able to call a URL  
Author Message
alexa.smith





PostPosted: 2008-3-7 21:26:00 Top

java-programmer, Applet is not able to call a URL 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
 
Roedy Green





PostPosted: 2008-3-8 7:37:00 Top

java-programmer >> Applet is not able to call a URL On Fri, 7 Mar 2008 05:26:22 -0800 (PST), email***@***.com wrote,
quoted or indirectly quoted someone who said :

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

you can only do that through a SIGNED applet.
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Arne Vajh鴍





PostPosted: 2008-3-8 11:07:00 Top

java-programmer >> Applet is not able to call a URL email***@***.com wrote:
> 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

The error message indicates that the DNS server used can not
resolve the name www.unserserver.de !

Arne
 
 
Arne Vajh鴍





PostPosted: 2008-3-8 11:08:00 Top

java-programmer >> Applet is not able to call a URL Roedy Green wrote:
> On Fri, 7 Mar 2008 05:26:22 -0800 (PST), email***@***.com wrote,
> quoted or indirectly quoted someone who said :
>> I try to make a HTTP Connection through a Applet. The Url is inside
>> the same CodeBase.
>
> 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
 
 
Andrew Thompson





PostPosted: 2008-3-8 15:00:00 Top

java-programmer >> Applet is not able to call a URL On Mar 7, 11:26爌m, email***@***.com 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.

Andrew T.
PhySci.org
 
 
Roedy Green





PostPosted: 2008-3-8 21:32:00 Top

java-programmer >> Applet is not able to call a URL On Fri, 07 Mar 2008 22:08:24 -0500, Arne Vajh鴍 <email***@***.com>
wrote, quoted or indirectly quoted someone who said :

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

Not quite. See http://mindprod.com/jgloss/applet.html

There are some catches.

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
 
Andrew Thompson





PostPosted: 2008-3-9 7:18:00 Top

java-programmer >> Applet is not able to call a URL On Mar 8, 11:32爌m, Roedy Green <email***@***.com>
wrote:
> On Fri, 07 Mar 2008 22:08:24 -0500, Arne Vajh鴍 <email***@***.com>
> wrote, quoted or indirectly quoted someone who said :
>
> >An unsigned applet can connect to the server it was fetched from.
>
> 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.

Andrew T.
PhySci.org
 
 
Arne Vajh鴍





PostPosted: 2008-3-10 10:21:00 Top

java-programmer >> Applet is not able to call a URL Roedy Green wrote:
> On Fri, 07 Mar 2008 22:08:24 -0500, Arne Vajh鴍 <email***@***.com>
> wrote, quoted or indirectly quoted someone who said :
>> An unsigned applet can connect to the server it was fetched from.
>
> Not quite. See http://mindprod.com/jgloss/applet.html
>
> There are some catches.

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
 
 
alexa.smith





PostPosted: 2008-3-11 17:22:00 Top

java-programmer >> Applet is not able to call a URL On Mar 10, 3:21 am, Arne Vajh鴍 <email***@***.com> wrote:
> Roedy Green wrote:
> > On Fri, 07 Mar 2008 22:08:24 -0500, Arne Vajh鴍 <email***@***.com>
> > wrote, quoted or indirectly quoted someone who said :
> >> An unsigned applet can connect to the server it was fetched from.
>
> > Not quite. Seehttp://mindprod.com/jgloss/applet.html
>
> > There are some catches.
>
> 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