My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Usage  
Updated Apr 6, 2009 by ksachdev...@gmail.com

Introduction

Plugin to server static content with jetty servlet in develoment and production, optional you can configure with any other server in production

Install

grails install-plugin http://jettystatic.googlecode.com/files/grails-jettystatic-0.1.zip

Version 0.2 is compatible with grails 1.1+

grails install-plugin http://jettystatic.googlecode.com/files/grails-jettystatic-0.2.zip

Default Behavior

By default exposes the content in:

'project_dir'/static/resources"

Example:

shopProject/static/resources/text.txt

http://localhost:8080/shopProject/resources/test.txt

Taglib

Resource Tag generates the url to static resource

${resource(file:'text.txt')}  -> http://localhost:8080/shopProject/resources/test.txt

If you are using 0.2 then you need to provide the namespace also so above line would be written as

${jettyStatic.resource(file:'text.txt')}  -> http://localhost:8080/shopProject/resources/test.txt

Configuration

Overwrites the defaults dirs and the tag behavior

jettystatic.dir = Absolute path to server static content

jettystatic.basepath = The basepath to remove in a resource taglib

Example:

jettystatic { 
	dir = '/opt/mydir/files'
	basepath = '/opt/mydir/files/resources'
}

${resource(file:'/opt/mydir/files/resources/text.txt')}  -> http://localhost:8080/shopProject/resources/test.txt

Also you can ignore jetty servlet in production and server the content as you want with:

jettystatic.ignore=true
jettystatic.absolute.url=http://mystaticserver

${resource(file:'text.txt')}  -> http://mystaticserver/test.txt

if using 0.2 version of plugin then the above line would be written as

${jettyStatic.resource(file:'text.txt')}  -> http://mystaticserver/test.txt

Sign in to add a comment
Powered by Google Project Hosting