You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ronald Klop <ro...@base.nl> on 2008/10/23 18:17:13 UTC

RequestDispatcher and sendfile()/java.nio

Hi,

Does Tomcat 5.5 or maybe 6.0 use java.nio/sendfile() to send static content?
So is it more prefered to use RequestDispatcher.forward(myfile) than copy a FileInputStream to ServletOutputStream by hand?
I already have the copying part, but would like to know if it is worth the trouble to rewrite it to the dispatcher. I would have to shuffle quite some files, so the rewrite isn't like a couple of minutes work. ;-)

Ronald.

Re: RequestDispatcher and sendfile()/java.nio

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Ronald Klop wrote:
> Hi,
>
> Does Tomcat 5.5 or maybe 6.0 use java.nio/sendfile() to send static 
> content?
> So is it more prefered to use RequestDispatcher.forward(myfile) than 
> copy a FileInputStream to ServletOutputStream by hand?
> I already have the copying part, but would like to know if it is worth 
> the trouble to rewrite it to the dispatcher. I would have to shuffle 
> quite some files, so the rewrite isn't like a couple of minutes work. ;-)
>
> Ronald.
>
6.0 uses sendfile, you can manually trigger send file too by just 
setting attributes

check out DefaultServlet.java
search for sendfile and setAttribute on the same line

http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java?view=markup



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org