Skip to content

Commit

Permalink
fix "java.lang.UnsupportedOperationException" exception
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed Oct 11, 2014
1 parent 2372fba commit 3f6e7ea
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions grails-app/taglib/org/grails/plugin/resource/ResourceTagLib.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -390,25 +390,31 @@ class ResourceTagLib {
DispositionsUtils.doneDispositionResources(request, dispositionToRender)
}

def script = { attributes, body ->
def script = { attributesAsParam, body ->
def attributes = [:] + attributesAsParam
attributes.type = "script"
if (!attributes.disposition) {
attributes.disposition = DispositionsUtils.DISPOSITION_DEFER
}

stash(attributes, body)
doStash(attributes, body)
}

def style = { attributes, body ->
def style = { attributesAsParam, body ->
def attributes = [:] + attributesAsParam
attributes.type = "style"
if (!attributes.disposition) {
attributes.disposition = DispositionsUtils.DISPOSITION_HEAD
}

stash(attributes, body)
doStash(attributes, body)
}

def stash = { attributes, body ->
doStash(attributes, body)
}

private def doStash(attributes, body) {
needsResourceLayout()
StashManager.stashPageFragment(request, (String) attributes.type, (String) attributes.disposition, (String) body())
}
Expand Down

0 comments on commit 3f6e7ea

Please sign in to comment.