I don't understand Your problem.
Please be more precise.
Why not use response.sendRedirect("http://www.somewhere.com/image.gif");
It works for me.
I am using a pageid parameter to identify the page from where was called
the servlet.
Like this :
<img src="http://somewhere/servlets/BasicSnooperServlet?pageid=2">
Hope it helps.
Best wishes,
Andras
----- Original Message -----
From: Werner Moshammer <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 16, 1999 4:02 PM
Subject: Servlet / User Info Statistic
> I want to write a Servlet, which is called within a WWW-Page, and which
> gets some info about the surfer, especially the referrer page he is from.
>
> Just a servlet would be similar to the SnoopServet from Sun, but the
> result (the info) should not be reported to the user (=surfer), it should
be
> written in a file, and the surfer should see the regular WWW Page (every
page, in which this servlet is embedded, like in the sample HTML file
below).
> (The servlet is for getting info for statistical purpose)
>
> So I am calling the servlet within a <img scr=...> HTML command, but ...
and
> this is my problem ... the referrer page, which is written to the file is
> now the WWW page, where the servlet is embedded (and not the real referrer
page)
>
> Does anybody know what I must do to get the right results?
>
> (Additional information: I am using Apache Webserver, JServ 1.0, JSDK 2.0,
JDK 1.2.1)
>
>
> Here is the Servlet Source:
>
>
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.IOException;
> import java.io.*;
> import java.net.*;
> import java.net.MalformedURLException;
> import java.util.*;
>
> public class BasicSnooperServlet extends HttpServlet{
>
> public void doGet(HttpServletRequest request, HttpServletResponse
response)
> throws ServletException, IOException {
>
> ServletOutputStream out = response.getOutputStream();
> response.setHeader("pragma", "no-cache");
> response.setContentType("image/gif");
>
> URL FilePath = new URL("http://localhost/stat.gif");
> URLConnection fp = FilePath.openConnection();
> InputStream ic = fp.getInputStream();
>
> int data = ic.read();
> while (data !=-1) {
> out.write(data);
> data = ic.read();
> }
>
> try {
> RandomAccessFile raf = new RandomAccessFile("/greetings2.log",
"rw");
> raf.seek(raf.length());
>
> Enumeration e = request.getHeaderNames();
> if (e.hasMoreElements()) {
> while (e.hasMoreElements()) {
> String name = (String)e.nextElement();
> raf.writeBytes(name+request.getHeader(name));
> }
> }
>
> }
> catch (IOException e2) {
> System.out.println("Error opening file: " + e2);
> }
>
> out.close();
> }
> }
>
>
>
>
> And here the HTML Source:
>
> <html>
> <body>
> This is the WWW-page, where the servlet is called<p>
> <img src="/servlets/BasicSnooperServlet">
>
> </body>
> </html>
>
>
> Thanks in advance for your help.
>
> Werner Moshammer
> [EMAIL PROTECTED]
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html