× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Yep, you're right. I didn't think that through all the way, but it does allow
serving images that aren't directly accessible in the web application (e.g., stored
under META-INF).

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of hockchai Lim
Sent: Friday, April 23, 2010 9:22 AM
To: web400@xxxxxxxxxxxx
Subject: Re: [WEB400] img src

isn't <h:graphicImage> same as <img>? If so, I'm not sure how
<h:graphicImage> can solve the problem of the image file resides on a server
that is behind the firewall. Did I miss something?

I can see that the "hardest way" that you have below will work. Will check
into that more. Thanks.


"Dean, Robert" <rdean@xxxxxxxxxxxx> wrote in message
news:mailman.24585.1271982983.2580.web400@xxxxxxxxxxxxxxx
It's trivial in JSF, providing the image is packaged with the app:

<h:graphicImage value="#{resource['images:ice011.png']}"/>


The hardest way (no framework):
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws
IOException {
// Get the absolute path of the image
ServletContext sc = getServletContext();
String filename = "/ice011.jpg";

// Get the MIME type of the image
String mimeType = sc.getMimeType(filename);
if (mimeType == null) {
sc.log("Could not get MIME type of "+filename);
resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
// Set content type
resp.setContentType(mimeType);
// Set content size
File file = new File(filename);
resp.setContentLength((int)file.length());
// Open the file and output streams
FileInputStream in = new FileInputStream(file);
OutputStream out = resp.getOutputStream();
// Copy the contents of the file to the output stream
byte[] buf = new byte[1024];
int count = 0;
while ((count = in.read(buf)) >= 0) {
out.write(buf, 0, count);
}
in.close();
out.close();
}

________________________________________
From: web400-bounces@xxxxxxxxxxxx [web400-bounces@xxxxxxxxxxxx] On Behalf Of
hr@xxxxxxxxxxxx [hr@xxxxxxxxxxxx]
Sent: Thursday, April 22, 2010 6:40 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] img src

Just show me the super duper javacode that does the same ;-)

/henrik




"Lim Hock-Chai" <Lim.Hock-Chai@xxxxxxxxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
22-04-2010 22:07
Please respond to
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>


To
<web400@xxxxxxxxxxxx>
cc

Subject
Re: [WEB400] img src






You mean good old rpg/cgi is better than the super duper java/jsp? No
way!!! :).

<hr@xxxxxxxxxxxx> wrote in message
news:<mailman.24544.1271966632.2580.web400@xxxxxxxxxxxx>...
Sorry,

in RPGLE/CGI it is a piece of cake ... testprogram here:

http://212.242.251.247:1550/pextcgidmo/showfile.pgm

showfile.pgm Source code:

/copy qsrc,pxapihdr General H-Spec's

* powerEXT API Connectors
/copy qsrc,pxapicgicn Basic HTTP connecter & Basic Services

/free
clearSrvPgm();

echoBinToClient('image/jpg':'/ice011.jpg');

return;

/Henrik




"Lim Hock-Chai" <Lim.Hock-Chai@xxxxxxxxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
22-04-2010 21:58
Please respond to
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>


To
<web400@xxxxxxxxxxxx>
cc

Subject
Re: [WEB400] img src






Nope. Websphere server using jsp/java.

<hr@xxxxxxxxxxxx> wrote in message
news:<mailman.24533.1271965144.2580.web400@xxxxxxxxxxxx>...
Are you running Apache ? CGIDEV2 ?

/Henrik



"hockchai Lim" <lim.hock-chai@xxxxxxxxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
22-04-2010 20:58
Please respond to
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>


To
web400@xxxxxxxxxxxx
cc

Subject
[WEB400] img src






is there a way in include a img in the html where the image file
only
accessible by the server?



--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.