Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Servlets & <strong>Server</strong>s<br />
Q: I'm looking for a <strong>Java</strong> HTTP server framework that can be used and modified<br />
for a project I'm going to be working on.<br />
My boss asked me what the equivalent in <strong>Java</strong> was that IIS was in the Windows<br />
world or Apache was in the UNIX. I've looked at Jigsaw, but am wondering if anyone<br />
out there knows of other resources...open source would be great. Thanks in advance<br />
for any input.<br />
Answer: There are other pure <strong>Java</strong> web servers, like the Apache Pico<strong>Server</strong>,<br />
Jetty (http://www.jetty.org ???). Perhaps you could take one of those to write a http<br />
block for the Apache <strong>Server</strong> Framework avalon (http://java.apache.org/framework )<br />
Another tip is to search sourceforge for web servers.<br />
http://www.sourceforge.net<br />
--<br />
Glen Shelly<br />
Q: I am currently running Microsoft's IIS server. I have the <strong>Java</strong> Virtual machine<br />
installed on this system. What else will I need to run my servlet. Do need the Apache<br />
web server instead? Will IIS support <strong>Java</strong> servlet?<br />
Answer: You will need a Servlet Engine to run your servlets.<br />
You can use either Allaire's JRun (http://www.jrun.com) or Tomcat<br />
(http://jakarta.apache.org).<br />
Both of them work with IIS.<br />
--<br />
Madhusudhanan Challur<br />
Q: How can I avoid browser caching?<br />
In an applet, I call the function showDocument to send a GET message to one of my<br />
servlets, which sends me back a PDF file dynamically generated by this servlet.<br />
My problem is : the browser (in this case IE) always sends me back a PDF file with<br />
the same content.<br />
Answer 1: There are a few possibilities to avoid this problem.<br />
A simple workaround is to add a random number URL variable with the request, such<br />
as "ranx" with a value of the milliseconds since midnight. This will make the request<br />
unique and, hence, avoid browser caching.<br />
by Duane Morse<br />
Answer 2: There are two other response setHeader attributes you can set:<br />
response.setHeader("pragma", "no-cache");<br />
response.setHeader("Cache-Control", "no-cache");<br />
response.setDateHeader("Expires", 0 )<br />
Just in case.<br />
Doug Schwartz<br />
Answer 3: // for Answer 1 and 2 please go to yesterday's tip.<br />
When you generate the PDF file, make sure you set the header to tell the browser<br />
that the file will expire at a certain time. The browser should not cache the response<br />
past the given time. The <strong>Java</strong> code looks something like<br />
this:<br />
import java.text.SimpleDateFormat;<br />
file:///F|/350_t/350_tips/servlets_servers.htm (6 of 8) [2002-02-27 21:19:05]