Groovy Documentation

org.grails.plugin.resource
[Groovy] Class ResourceMeta

java.lang.Object
  org.grails.plugin.resource.ResourceMeta

class ResourceMeta

Holder for info about a resource declaration at runtime This is actually non-trivial. A lot of data kept here. Be wary of what you think a "url" is. See the javadocs for each URL property.

Authors:
Marc Palmer (marc@grailsrocks.com)
Luke Daley (ld@ldaley.com)


Field Summary
private java.lang.String _linkUrl

private java.lang.Boolean _resourceExists

private ResourceMeta delegate

The delegate to actually use when linking, if any.

private boolean processed

 
Property Summary
static java.lang.Object PROCESSED_BY_PREFIX

java.lang.String actualUrl

The url of the local resource, after processing.

java.util.Map attributes

java.lang.String bundle

java.lang.Integer contentLength

java.lang.String contentType

The original mime type

java.lang.String declaringResource

The URI of the resource that resulted in the processing of this resource, or null For resources ref'd in CSS or stuff loaded up by bundles for example

java.lang.String disposition

Where do you want this resource?

java.util.Set excludedMappers

java.lang.String id

The optional module-unique id

java.lang.String linkOverride

The url to use when rendering links - e.g. for absolute CDN overrides

java.lang.Object log

ResourceModule module

The owning module

java.lang.Integer originalContentLength

long originalLastMod

org.springframework.core.io.Resource originalResource

java.lang.Long originalSize

java.lang.String originalUrl

The original Url provided in the mapping declaration, verbatim

groovy.lang.Closure prePostWrapper

java.io.File processedFile

java.lang.Long processedSize

java.util.List requestProcessors

java.lang.String sourceUrl

The app-relative url of the LOCAL source of this resource, minus query params

java.lang.String sourceUrlExtension

The original file extension of the resource

java.lang.String sourceUrlParamsAndFragment

The original sourceUrlParamsAndFragment of the resource, if any

java.util.Map tagAttributes

java.io.File workDir

Set on instantiation to be the dir that content is served from

 
Constructor Summary
ResourceMeta()

 
Method Summary
void beginPrepare(java.lang.Object grailsResourceProcessor)

private void copyOriginalResourceToWorkArea()

void delegateTo(ResourceMeta target)

void endPrepare(java.lang.Object grailsResourceProcessor)

boolean excludesMapperOrOperation(java.lang.String mapperName, java.lang.String operationName)

boolean exists()

java.lang.String getActualUrl()

java.lang.String getActualUrlParent()

ResourceMeta getDelegate()

java.lang.String getLinkUrl()

long getOriginalResourceLength()

java.lang.String getProcessedFileExtension()

The file extension of the processedFile, or null if it has no extension.

java.lang.String getWorkDirRelativeParentPath()

java.lang.String getWorkDirRelativePath()

boolean isActualAbsolute()

boolean isDelegating()

boolean isDirty()

boolean isOriginalAbsolute()

boolean needsProcessing()

java.io.InputStream newInputStream()

Return a new input stream for serving the resource - if processing is disabled the processedFile will be null and the original resource is used

java.lang.String relativeTo(ResourceMeta base)

Calculate the URI of this resource relative to the base resource.

java.lang.String relativeToWithQueryParams(ResourceMeta base)

void reset()

Reset the resource state to how it was after loading from the module definition i.e. keep only declared info, nothing generated later during processing // @todo should we delete the file in here?

void setActualUrl(java.lang.String url)

void setOriginalResource(org.springframework.core.io.Resource res)

void setProcessedFile(java.io.File f)

void setSourceUrl(java.lang.String url)

java.lang.String toString()

void updateActualUrlFromProcessedFile()

void updateContentLength()

void updateExists()

void wasProcessedByMapper(ResourceMapper mapper, boolean processed = true)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

_linkUrl

private java.lang.String _linkUrl


_resourceExists

private java.lang.Boolean _resourceExists


delegate

private ResourceMeta delegate
The delegate to actually use when linking, if any. Think bundling.


processed

private boolean processed


 
Property Detail

PROCESSED_BY_PREFIX

static final java.lang.Object PROCESSED_BY_PREFIX


actualUrl

java.lang.String actualUrl
The url of the local resource, after processing. (no query params)


attributes

java.util.Map attributes


bundle

java.lang.String bundle


contentLength

java.lang.Integer contentLength


contentType

java.lang.String contentType
The original mime type


declaringResource

java.lang.String declaringResource
The URI of the resource that resulted in the processing of this resource, or null For resources ref'd in CSS or stuff loaded up by bundles for example


disposition

java.lang.String disposition
Where do you want this resource? "defer", "head" etc


excludedMappers

java.util.Set excludedMappers


id

java.lang.String id
The optional module-unique id


linkOverride

java.lang.String linkOverride
The url to use when rendering links - e.g. for absolute CDN overrides


log

java.lang.Object log


module

ResourceModule module
The owning module


originalContentLength

java.lang.Integer originalContentLength


originalLastMod

long originalLastMod


originalResource

org.springframework.core.io.Resource originalResource


originalSize

java.lang.Long originalSize


originalUrl

java.lang.String originalUrl
The original Url provided in the mapping declaration, verbatim


prePostWrapper

groovy.lang.Closure prePostWrapper


processedFile

java.io.File processedFile


processedSize

java.lang.Long processedSize


requestProcessors

java.util.List requestProcessors


sourceUrl

java.lang.String sourceUrl
The app-relative url of the LOCAL source of this resource, minus query params


sourceUrlExtension

java.lang.String sourceUrlExtension
The original file extension of the resource


sourceUrlParamsAndFragment

java.lang.String sourceUrlParamsAndFragment
The original sourceUrlParamsAndFragment of the resource, if any


tagAttributes

java.util.Map tagAttributes


workDir

java.io.File workDir
Set on instantiation to be the dir that content is served from
See Also:
ResourceProcessor#workDir#workDir


 
Constructor Detail

ResourceMeta

ResourceMeta()


 
Method Detail

beginPrepare

void beginPrepare(java.lang.Object grailsResourceProcessor)


copyOriginalResourceToWorkArea

private void copyOriginalResourceToWorkArea()


delegateTo

void delegateTo(ResourceMeta target)


endPrepare

void endPrepare(java.lang.Object grailsResourceProcessor)


excludesMapperOrOperation

boolean excludesMapperOrOperation(java.lang.String mapperName, java.lang.String operationName)


exists

boolean exists()


getActualUrl

java.lang.String getActualUrl()


getActualUrlParent

java.lang.String getActualUrlParent()


getDelegate

ResourceMeta getDelegate()


getLinkUrl

java.lang.String getLinkUrl()


getOriginalResourceLength

long getOriginalResourceLength()


getProcessedFileExtension

java.lang.String getProcessedFileExtension()
The file extension of the processedFile, or null if it has no extension.


getWorkDirRelativeParentPath

java.lang.String getWorkDirRelativeParentPath()


getWorkDirRelativePath

java.lang.String getWorkDirRelativePath()


isActualAbsolute

boolean isActualAbsolute()


isDelegating

boolean isDelegating()


isDirty

boolean isDirty()


isOriginalAbsolute

boolean isOriginalAbsolute()


needsProcessing

boolean needsProcessing()


newInputStream

java.io.InputStream newInputStream()
Return a new input stream for serving the resource - if processing is disabled the processedFile will be null and the original resource is used


relativeTo

java.lang.String relativeTo(ResourceMeta base)
Calculate the URI of this resource relative to the base resource. All resource URLs must be app-relative with no ../ or ./


relativeToWithQueryParams

java.lang.String relativeToWithQueryParams(ResourceMeta base)


reset

void reset()
Reset the resource state to how it was after loading from the module definition i.e. keep only declared info, nothing generated later during processing //
todo:
should we delete the file in here?


setActualUrl

void setActualUrl(java.lang.String url)


setOriginalResource

void setOriginalResource(org.springframework.core.io.Resource res)


setProcessedFile

void setProcessedFile(java.io.File f)


setSourceUrl

void setSourceUrl(java.lang.String url)


toString

java.lang.String toString()


updateActualUrlFromProcessedFile

void updateActualUrlFromProcessedFile()


updateContentLength

void updateContentLength()


updateExists

void updateExists()


wasProcessedByMapper

void wasProcessedByMapper(ResourceMapper mapper, boolean processed = true)


 

Groovy Documentation