<?xml version="1.0" encoding="UTF-8"?>
<page>
  <created-at type="datetime">2009-05-14T05:50:17Z</created-at>
  <description></description>
  <id type="integer">1662</id>
  <name>AutoSendfile</name>
  <number type="integer">5</number>
  <person-id type="integer">87</person-id>
  <text>= The AutoSendfile Mode =

The AutoSendfile mode basically turns grizzly-sendfile into a regular webserver which listens on a specified URI prefix. When a request with this prefix arrives, grizzly-sendfile replies with a file which path matches the request URI.

Let's say that grizzly-sendfile is running in a server on port 8080 and is configure with these two options:
 com.igorminar.grizzlysendfile.AutoSendfileUriPrefix=/sendfile/
 com.igorminar.grizzlysendfile.AutoSendfileFileDir=/var/www/large-files/

Then &lt;code&gt; wget http://host:8080/sendfile/some-file.tgz&lt;/code&gt; will result in &lt;code&gt;/var/www/large-files/some-file.tgz&lt;/code&gt; to be served.

The advantages of this feature are:
* you can let grizzly-sendfile serve static files instead of using grizzly for this purpose and benefit from [[Benchmarks | grizzly-sendfile's performance, scalability]], [[Plugins | plugins]], [[JMXInstrumentation | jmx monitoring capabilities]], etc
* you can build a high performance webserver with grizzly by using only [[SettingUp | a few lines of code]]
* you can shave off a few milliseconds from the request initiation time that would otherwise be wasted in grizzly's adapters</text>
  <text-as-html>&lt;h1&gt;&lt;a name='The_AutoSendfile_Mode'&gt;&lt;/a&gt; The AutoSendfile Mode &lt;/h1&gt;
&lt;p&gt;
The AutoSendfile mode basically turns grizzly-sendfile into a regular webserver which listens on a specified URI prefix. When a request with this prefix arrives, grizzly-sendfile replies with a file which path matches the request URI.

&lt;/p&gt;&lt;p&gt;Let's say that grizzly-sendfile is running in a server on port 8080 and is configure with these two options:
&lt;/p&gt;&lt;pre&gt; com.igorminar.grizzlysendfile.AutoSendfileUriPrefix=/sendfile/
 com.igorminar.grizzlysendfile.AutoSendfileFileDir=/var/www/large-files/
&lt;/pre&gt;&lt;p&gt;
Then &lt;code&gt; wget &lt;a class='external' href=&quot;http://host&quot;&gt;http://host&lt;/a&gt;:8080/sendfile/some-file.tgz&lt;/code&gt; will result in &lt;code&gt;/var/www/large-files/some-file.tgz&lt;/code&gt; to be served.

&lt;/p&gt;&lt;p&gt;The advantages of this feature are:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt; you can let grizzly-sendfile serve static files instead of using grizzly for this purpose and benefit from &lt;a href='&lt;?url_for_page Benchmarks ?&gt;' class='internal'&gt; grizzly-sendfile's performance, scalability&lt;/a&gt;, &lt;a href='&lt;?url_for_page Plugins ?&gt;' class='internal'&gt; plugins&lt;/a&gt;, &lt;a href='&lt;?url_for_page JMXInstrumentation ?&gt;' class='internal'&gt; jmx monitoring capabilities&lt;/a&gt;, etc
&lt;/li&gt;&lt;li&gt; you can build a high performance webserver with grizzly by using only &lt;a href='&lt;?url_for_page SettingUp ?&gt;' class='internal'&gt; a few lines of code&lt;/a&gt;&lt;/li&gt;&lt;li&gt; you can shave off a few milliseconds from the request initiation time that would otherwise be wasted in grizzly's adapters&lt;/li&gt;&lt;/ul&gt;</text-as-html>
  <updated-at type="datetime">2009-05-14T07:30:20Z</updated-at>
  <wiki-id type="integer">597</wiki-id>
</page>
