Accessing images using basic authentication

Posted on 2006-11-14
Last Modified: 2010-04-01

I have a simple JSP page that must display an image located on a remote server. This remote server uses basic authentication. The credentials to access the remote image are known to my application.

How can I display the image without prompting the user to enter credentials (username/password dialog).

Any suggestions welcome.


Question by:frostw
LVL 10

Expert Comment

ID: 17947674
>>>>This remote server uses basic authentication

you have to configure your remote server so that it allows users to log in without authentication

Author Comment

ID: 17950492
>>you have to configure your remote server so that it allows users to log in without authentication

Sorry but that is not an option.
LVL 29

Expert Comment

ID: 17955421
Why do you want to do this frostw? Why not host the images on your own machine?
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.


Author Comment

ID: 17960447
We have a server collecting router traffic data and generating graphs (the .png images in question). The graphs are available to external applications via a cgi interface which is protected by basic authention. The images are generated on demand and therefore cannot be hosted locally by my application.

Since I can call Java code from my JSPs I believe I can fetch the images using a URLConnection. This would allow me to cope with the authentication (I think). However, what I don't know how to do is insert the fetched image back into the HTML that the JSP generates.

Author Comment

ID: 17990477
So I take it this is not possible then?!

Author Comment

ID: 18015889
No matter, I figured it out myself. Just in case anyone is interested I achieved it using a servlet to fetch the image (using basic authentication) then returned the data with an "image/png" content type.

Author Comment

ID: 18015944
I am going to ask that this question be closed.

Accepted Solution

DarthMod earned 0 total points
ID: 18058260
PAQd, 500 points refunded.

CS Moderator

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java.util.concurrent.locks in java 3 192
session bean client machine 9 63
servlet init param and contect param 3 65
Market Place not working in Eclipse Luna 2 113
Each year, investment in cloud platforms grows more than 20% ( as an increasing number of companies begin to…
Adding Computers to AD groups through an SCCM Task Sequence
In a recent question ( here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question