Re: Using ServletOutputStream in Servlet Vs <img src="../images/abc.gif" />
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 02/15/05
- Next message: modest: "HELP: Unicode in Java 1.3.1 vs 1.4.2"
- Previous message: Real Gagnon: "Re: method name"
- In reply to: ap: "Using ServletOutputStream in Servlet Vs <img src="../images/abc.gif" />"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 15 Feb 2005 06:51:32 -0600
"ap" <africa_pig@hotmail.com> wrote in message
news:36a5d4a0.0502142316.69a2194f@posting.google.com...
> Hi all,
> Is anyone one know what is the different between them and which
> one is faster or they have the same performance....
>
> #############################################
> public void doGet(HttpServletRequest request, HttpServletResponse
> response)
> throws ServletException, IOException {
> response.setContentType("image/jpeg");
> ServletOutputStream out = response.getOutputStream();
> BufferedInputStream in = new BufferedInputStream(new
> FileInputStream ("c:/images/abc.gif"));
> while ((data = in.read()) != -1) {
> out.write(data);
> }
> in.close();
> out.close();
> }
> #############################################
>
This sends a response to the client containing an image (with the wrong
Content-Type).
> and
>
> #############################################
> <img src="../images/abc.gif" /> in a .jsp file
> #############################################
>
This causes the client to send an HTTP request for an image.
I'm not sure what you're looking for. The two aren't really related. You could
use a servlet mapping to cause the former to be used to respond to the latter.
- Next message: modest: "HELP: Unicode in Java 1.3.1 vs 1.4.2"
- Previous message: Real Gagnon: "Re: method name"
- In reply to: ap: "Using ServletOutputStream in Servlet Vs <img src="../images/abc.gif" />"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|