Last updated May 14, 2009 06:06, by Igor Minar
Feedicon  
= 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:<br/><br/> import com.igorminar.grizzlysendfile.SendfileFilter; import com.sun.grizzly.http.embed.GrizzlyWebServer; ... GrizzlyWebServer ws = new GrizzlyWebServer(port); ws.addAsyncFilter(new SendfileFilter()); ws.start(); <br/> You can configure grizzly-sendfile via JVM parameters passed in via command line (-D..) or by setting them via <code>System.setProperty(SendfileConfig.<config key>, value);</code> 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]])<br/><br/> Then install it in GlassFish v3:<br/><br/> 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 <br/> If you are interested in using the [[AutoSendfile| AutoSendfile Feature]] you can add these two options and restart:<br/><br/> 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.
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close