• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

Accessing images using basic authentication

Hi,

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.

Thanks,

Warren
0
frostw
Asked:
frostw
1 Solution
 
jaggernatCommented:
>>>>This remote server uses basic authentication

you have to configure your remote server so that it allows users to log in without authentication
0
 
frostwAuthor Commented:
>>you have to configure your remote server so that it allows users to log in without authentication

Sorry but that is not an option.
0
 
bloodredsunCommented:
Why do you want to do this frostw? Why not host the images on your own machine?
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
frostwAuthor Commented:
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.
0
 
frostwAuthor Commented:
So I take it this is not possible then?!
0
 
frostwAuthor Commented:
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.
0
 
frostwAuthor Commented:
I am going to ask that this question be closed.
0
 
DarthModCommented:
PAQd, 500 points refunded.

DarthMod
CS Moderator
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now