<?xml version="1.0" encoding="UTF-8"?>
<page>
  <created-at type="datetime">2008-11-27T23:27:08Z</created-at>
  <description></description>
  <id type="integer">524</id>
  <name>SettingUp</name>
  <number type="integer">16</number>
  <person-id type="integer">87</person-id>
  <text>= Setting Up grizzly-sendfile=

Starting with version 0.3 grizzly-sendfile is compatible with grizzly 1.9.15+ and GlassFish v3b48+. For instructions on how to configure version 0.2 with Glassfish v2 [[GlassFishV2Support | look here]].


== Using grizzly-sendfile with grizzly ==

Grab the latest core distribution from the [http://kenai.com/projects/grizzly-sendfile/downloads download page] ([[Distributions|more information on distributions]]).

Then in your code, just add grizzly-sendfile's SendfileFilter to GrizzlyServer:&lt;br/&gt;&lt;br/&gt;

 import com.igorminar.grizzlysendfile.SendfileFilter;
 import com.sun.grizzly.http.embed.GrizzlyWebServer; 
 ...
 GrizzlyWebServer ws = new GrizzlyWebServer(port);
 ws.addAsyncFilter(new SendfileFilter());
 ws.start(); 
&lt;br/&gt;
You can configure grizzly-sendfile via JVM parameters passed in via command line (-D..) or by setting them via &lt;code&gt;System.setProperty(SendfileConfig.&lt;config key&gt;, value);&lt;/code&gt; before the SendfileFilter class is loaded. A proper pragmatic configuration is [http://kenai.com/jira/browse/GRIZZLY_SENDFILE-1 on the way].


== Using grizzly-sendfile with GlassFish v3 ==

Supposing that you have your GlassFish v3 installed and set up, grab the latest osgi bundle from the [http://kenai.com/projects/grizzly-sendfile/downloads download page] ([[Distributions|more information on distributions]])&lt;br/&gt;&lt;br/&gt;

Then install it in GlassFish v3:&lt;br/&gt;&lt;br/&gt;

 bin/asadmin deploy --type osgi --force=true path/to/grizzly-sendfile-osgi-0.3.jar
 bin/asadmin create-jvm-options -Dcom.sun.grizzly.asyncHandlerClass=com.sun.grizzly.arp.DefaultAsyncHandler
 bin/asadmin create-jvm-options -Dcom.sun.grizzly.asyncHandler.ports=8080  # or other port if not using the default
 bin/asadmin create-jvm-options -Dcom.sun.grizzly.asyncFilters=com.igorminar.grizzlysendfile.SendfileFilter
 bin/asadmin create-jvm-options -Dcom.igorminar.grizzlysendfile.AllowedPaths=/absolute/path/to/files/*
 bin/asadmin restart-domain domain1  # or different name if not using the default
&lt;br/&gt;

If you are interested in using the [[AutoSendfile| AutoSendfile Feature]] you can add these two options and restart:&lt;br/&gt;&lt;br/&gt;

 bin/asadmin create-jvm-options -Dcom.igorminar.grizzlysendfile.AutoSendfileUriPrefix=/sendfile/
 bin/asadmin create-jvm-options -Dcom.igorminar.grizzlysendfile.AutoSendfileFileDir=/absolute/path/to/dir/with/files/to/serve/


== Advanced Configuration ==

For more configuration options and explanation of all options mentioned on this page, please check out the [[Advanced Configuration]] page.</text>
  <text-as-html>&lt;h1&gt;&lt;a name='Setting_Up_grizzly-sendfile'&gt;&lt;/a&gt; Setting Up grizzly-sendfile&lt;/h1&gt;
&lt;p&gt;
Starting with version 0.3 grizzly-sendfile is compatible with grizzly 1.9.15+ and GlassFish v3b48+. For instructions on how to configure version 0.2 with Glassfish v2 &lt;a href='&lt;?url_for_page GlassFishV2Support ?&gt;' class='internal'&gt; look here&lt;/a&gt;.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Using_grizzly-sendfile_with_grizzly'&gt;&lt;/a&gt; Using grizzly-sendfile with grizzly &lt;/h2&gt;
&lt;p&gt;
Grab the latest core distribution from the &lt;a class='external' href=&quot;http://kenai.com/projects/grizzly-sendfile/downloads&quot;&gt;download page&lt;/a&gt; (&lt;a href='&lt;?url_for_page Distributions?&gt;' class='internal'&gt;more information on distributions&lt;/a&gt;).

&lt;/p&gt;&lt;p&gt;Then in your code, just add grizzly-sendfile's SendfileFilter to GrizzlyServer:&lt;br /&gt;&lt;br /&gt;

&lt;/p&gt;&lt;pre&gt; import com.igorminar.grizzlysendfile.SendfileFilter;
 import com.sun.grizzly.http.embed.GrizzlyWebServer; 
 ...
 GrizzlyWebServer ws = new GrizzlyWebServer(port);
 ws.addAsyncFilter(new SendfileFilter());
 ws.start(); 
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;
You can configure grizzly-sendfile via JVM parameters passed in via command line (-D..) or by setting them via &lt;code&gt;System.setProperty(SendfileConfig.&amp;lt;config key&amp;gt;, value);&lt;/code&gt; before the SendfileFilter class is loaded. A proper pragmatic configuration is &lt;a class='external' href=&quot;http://kenai.com/jira/browse/GRIZZLY_SENDFILE-1&quot;&gt;on the way&lt;/a&gt;.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Using_grizzly-sendfile_with_GlassFish_v3'&gt;&lt;/a&gt; Using grizzly-sendfile with GlassFish v3 &lt;/h2&gt;
&lt;p&gt;
Supposing that you have your GlassFish v3 installed and set up, grab the latest osgi bundle from the &lt;a class='external' href=&quot;http://kenai.com/projects/grizzly-sendfile/downloads&quot;&gt;download page&lt;/a&gt; (&lt;a href='&lt;?url_for_page Distributions?&gt;' class='internal'&gt;more information on distributions&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;Then install it in GlassFish v3:&lt;br /&gt;&lt;br /&gt;

&lt;/p&gt;&lt;pre&gt; bin/asadmin deploy --type osgi --force=true path/to/grizzly-sendfile-osgi-0.3.jar
 bin/asadmin create-jvm-options -Dcom.sun.grizzly.asyncHandlerClass=com.sun.grizzly.arp.DefaultAsyncHandler
 bin/asadmin create-jvm-options -Dcom.sun.grizzly.asyncHandler.ports=8080  # or other port if not using the default
 bin/asadmin create-jvm-options -Dcom.sun.grizzly.asyncFilters=com.igorminar.grizzlysendfile.SendfileFilter
 bin/asadmin create-jvm-options -Dcom.igorminar.grizzlysendfile.AllowedPaths=/absolute/path/to/files/*
 bin/asadmin restart-domain domain1  # or different name if not using the default
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;If you are interested in using the &lt;a href='&lt;?url_for_page AutoSendfile?&gt;' class='internal'&gt; AutoSendfile Feature&lt;/a&gt; you can add these two options and restart:&lt;br /&gt;&lt;br /&gt;

&lt;/p&gt;&lt;pre&gt; bin/asadmin create-jvm-options -Dcom.igorminar.grizzlysendfile.AutoSendfileUriPrefix=/sendfile/
 bin/asadmin create-jvm-options -Dcom.igorminar.grizzlysendfile.AutoSendfileFileDir=/absolute/path/to/dir/with/files/to/serve/
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;h2&gt;&lt;a name='Advanced_Configuration'&gt;&lt;/a&gt; Advanced Configuration &lt;/h2&gt;
&lt;p&gt;
For more configuration options and explanation of all options mentioned on this page, please check out the &lt;a href='&lt;?url_for_page Advanced Configuration?&gt;' class='internal'&gt;Advanced Configuration&lt;/a&gt; page.&lt;/p&gt;</text-as-html>
  <updated-at type="datetime">2009-05-14T06:06:43Z</updated-at>
  <wiki-id type="integer">597</wiki-id>
</page>
