The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Re: Applet and HTTP Authentication

Posted by Brian Sanders on December 10, 2001 at 9:41 AM

1. How can I get the applet authentication turned off? (the credentials supplied in the login are sufficient to read the icon files from the web server).

With basic authentication, the server expects to find an HTTP header entry called "Authorization". The value of this header is created in this way:

  1. Concatenate the username with a colon and the password. Example: "webuser:webpassword".
  2. Base64-encode this value. The result should be something like "d2VidXNlcjp3ZWJwYXNzd29yZA==".
  3. Prepend the value with "Basic ". Example: "Basic d2VidXNlcjp3ZWJwYXNzd29yZA==".

Every time you make a request to the server to get an image, include this header value.

2. Is there a way to include and compile graphic files as resources within a Java app so you don't have to read them from external files? (like you can do with VB and C++).

You can't compile them in, but you can include the applet and the resources within the same jar file. Access the resources with getClass().getResource().


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us