Solved

Accessing images using basic authentication

Posted on 2006-11-14
9
284 Views
Last Modified: 2010-04-01
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
Comment
Question by:frostw
9 Comments
 
LVL 10

Expert Comment

by:jaggernat
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
0
 

Author Comment

by:frostw
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.
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 17955421
Why do you want to do this frostw? Why not host the images on your own machine?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:frostw
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.
0
 

Author Comment

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

Author Comment

by:frostw
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.
0
 

Author Comment

by:frostw
ID: 18015944
I am going to ask that this question be closed.
0
 
LVL 1

Accepted Solution

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

DarthMod
CS Moderator
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
constuctor calling other constructor 2 80
nested if has else if 13 96
How to set default webapp for host 6 47
instanceof  operator in java 26 96
Building a successful professional career is a long and difficult journey, especially in case if your decisions are not chosen carefully. For example, if you think that you can get to the desired position without experience and apply for it, your ch…
Ransomware continues to grow in reach and sophistication, putting data everywhere at risk. Learn how to avoid being caught in its sinister clutches with these 11 key tips.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

820 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