Re: Problem serving pdf
Chris <shef31 <at> yahoo.com>
2005-08-03 17:09:16 GMT
Thanks for the suggestion. It does not seem to help, though. I think the
issue has less to do with form content going from the browser to the server
than it does with large hunks of pdf content going from the server to the
browser.
"Ron hahne" <Ronald_D_Hahne <at> NielsenMedia.com> wrote in message
news:1123058319.32712.12.camel <at> npowerdevrdh...
Try the following it helped us:
-Dorg.mortbay.http.HttpRequest.maxFormContentSize=${MAXFORMCONTENTSIZE}
Ron Hahne
On Tue, 2005-08-02 at 18:09, Chris wrote:
I'm having a problem getting a Jetty server to serve up a large (1 mb) pdf
file. When I click on a link that points to the pdf, IE downloads about half
of it (according to the kb count in the status bar) and then freezes. If you
try it a couple more times then sometimes IE will display it. Firefox
immediately says "stopped" in the toolbar and displays nothing.
The server is running locally, so this is not a problem getting the file
across a bad connection.
I can open the pdf fine in Acrobat directly. I can also serve it up fine
under Resin -- both IE and Firefox can connect to a Resin server and display
the file without a problem.
I see the problem with both Jetty 5.1.1 and Jetty 5.1.4.
Now here's the really tricky part: I'm running Jetty in my app as an
embedded server. If instead I run it from a default Jetty installation,
using start.jar, then there is no problem. The pdf displays fine. So my
guess is that this is configuration issue. I'm having the server load
webdefaults.xml, so that configuration should be correct.
Where else should I be looking for this problem?
Here's the code I use to run the server in the app (slightly edited). I can
make the pdf available, if necessary.
******************************************************************
/**
* This class runs Jetty.
*/
public class JettyInvoker {
private Server server;
public JettyInvoker() {}
/**
* Returns true if Jetty started.
*/
public boolean run(String home, int port, String host) throws
IOException, Exception {
// test to see if we're on a read-only CD
File logDir = new File(home, "logs");
boolean readOnly = !logDir.canWrite();
System.setProperty("org.apache.commons.logging.LogFactory","org.mortbay.log.
Factory");
LogFactory factory = LogFactory.getFactory();
LogImpl log = (LogImpl)factory.getInstance("");
// error and event log
if (readOnly) {
NullLogSink nullLogSink = new NullLogSink(); // defined below
nullLogSink.start();
log.add(nullLogSink); // this is the only way to turn off
logging completely
} else {
if (!logDir.exists())
logDir.mkdirs();
OutputStreamLogSink sink =
new OutputStreamLogSink(dieselHome +
"logs/yyyy_mm_dd.jetty.log");
sink.setAppend(true);
sink.setRetainDays(1000000);
sink.start();
log.add(sink);
}
// jsp server
server = new Server();
SocketListener listener;
if (host == null || host.length() == 0 || host.equals("0.0.0.0")) {
listener = new SocketListener();
listener.setPort(port);
} else {
InetAddrPort addr = new InetAddrPort();
addr.setPort(port);
addr.setHost(host);
listener = new SocketListener(addr);
}
// this file contains user names/passwords for authentication
String realmFilename = home + "users.properties";
if ((new File(realmFilename)).exists()) {
HashUserRealm realm = new HashUserRealm("users", realmFilename);
server.addRealm(realm);
}
server.addListener(listener);
server.setRootWebApp("root");
//WebApplicationContext [] webapps =
server.addWebApplications(null, // virtual host
dieselHome + "webapps/", // webapps dir
dieselHome + "webdefault.xml", // defaults
true); // extract wars
File docFile = new File(home, "doc");
if (docFile.exists()) {
server.addWebApplication("/doc", docFile.toString());
}
// request log
if (!readOnly) {
NCSARequestLog requestLog =
new NCSARequestLog(home + "logs/yyyy_mm_dd.request.log");
// Greg Wilkins of Jetty claims that you get better performance
// with buffering off, strangely enough
//requestLog.setBuffered(true);
requestLog.setAppend(true);
requestLog.setRetainDays(1000000);
requestLog.setExtended(true);
// the ignore paths code only works with trailing * or
// *.extension. It's not generalized wildcard matching
String [] ignorePaths = {"/images/*", "/admin/images/*",
"*.css"};
requestLog.setIgnorePaths(ignorePaths);
server.setRequestLog(requestLog);
}
try {
server.start();
} catch (MultiException e) {
// if it's a bind exception, that is, it can't get
// port 8080, this means that it's probably already
// running. Not a problem, just return and launch browser
Exception orig = e.getException(0);
if (!(orig instanceof BindException)) {
e.printStackTrace();
return false;
}
}
return true;
}
public void stop() {
if (server != null) {
try {
server.stop();
} catch (InterruptedException e) {}
}
}
}
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Jetty-support mailing list
Jetty-support <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jetty-support
Thanks, \/Ron Hahne (* *)C3C032
oo0()0ooBrooker Creek : (813) 366-4052Cell Phone : (727) 638-0690
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Jetty-support mailing list
Jetty-support <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jetty-support