Re: Using ServletOutputStream in Servlet Vs <img src="../images/abc.gif" />

From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 02/15/05


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.



Relevant Pages

  • Re: WS::Client::DoCall receiving an "HTTP/1.1 100 Continue" response
    ... Continue" packet to the client even though the HTTP request does not ... it in any response and wait for the real result code and response ...
    (comp.lang.tcl)
  • Re: interconnection between two processes
    ... > on client side to generate HTTP request ... > or implement it by myselft, because client application should wait for ... > response from CGI and I assume 'wget' or any other software kind of that ...
    (comp.unix.programmer)
  • Re: Client/Service relationships & Flow of Requirements.
    ... the client calls "foo" when it wants "bar" to return a particular value. ... The following is designed to compel Prey objects to do something: ... predator < 100 yards from prey ... It is the expectation of the response that makes the runFrom name immediately suspect in an OO context. ...
    (comp.object)
  • Re: [Full-disclosure] [Professional IT Security Providers -Exposed] PlanNetGroup ( F )
    ... the review a second time and incorporate some of your suggestions. ... to do what the client will pay him for. ... exactly a vulnerability assessment is... ... Your response to question 3: ...
    (Full-Disclosure)
  • Re: Prospective Client Tracking Database
    ... pInterior - We also have an interior landscape division so this would be a yes/no checkbox for me to track whether or not a client has interior needs. ... In terms of the current client database idea....We currently track current ... I look forward to your response ... I have a bunch of prospective clients that I want to track. ...
    (microsoft.public.access.tablesdbdesign)