Skip to content

Commit

Permalink
Get rid of TagLibraryApi, ControllersApi and CommonWebApi in favour o…
Browse files Browse the repository at this point in the history
…f traits
  • Loading branch information
graemerocher committed Dec 18, 2014
1 parent 976c100 commit bf5e769
Show file tree
Hide file tree
Showing 35 changed files with 377 additions and 885 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.grails.plugins;

import grails.plugins.exceptions.PluginException;
import groovy.util.slurpersupport.GPathResult;
import groovy.util.slurpersupport.Node;

Expand Down Expand Up @@ -128,8 +129,8 @@ protected void initializeProvidedArtefacts(GPathResult descriptor) {
final String className = ((Node)i.next()).text();
try {
artefacts.add(classLoader.loadClass(className));
} catch (ClassNotFoundException e) {
LOG.error("Class not found loading plugin resource [" + className + "]. Resource skipped.", e);
} catch (Throwable e) {
throw new PluginException("Failed to initialize class ["+className+"] from plugin ["+ getName()+ "] : " + e.getMessage(), e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class GrailsConventionGroovyPageLocatorSpec extends Specification {
<plugin name='testBinary'>
<class>TestBinaryGrailsPlugin</class>
<resources>
<resource>org.codehaus.groovy.grails.plugins.TestBinaryResource</resource>
<resource>org.grails.gsp.io.TestBinaryResource</resource>
</resources>
</plugin>
'''
Expand Down Expand Up @@ -236,6 +236,7 @@ class GrailsConventionGroovyPageLocatorSpec extends Specification {
class TestBinaryGrailsPlugin {
def version = 1.0
}
class TestBinaryResource {}

class TestController {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

import static org.grails.plugins.web.controllers.metaclass.RenderDynamicMethod.DEFAULT_ENCODING
import grails.artefact.controller.ServletAttributes
import grails.web.api.ServletAttributes
import grails.artefact.controller.support.ResponseRenderer
import grails.core.GrailsControllerClass
import grails.core.GrailsDomainClassProperty
Expand Down Expand Up @@ -253,15 +253,6 @@ trait Controller implements ResponseRenderer, DataBinder, WebAttributes, Servlet
(Map)getFlash().get("chainModel")
}

/**
* Obtains the Grails parameter map
*
* @return The GrailsParameterMap instance
*/
GrailsParameterMap getParams() {
currentRequestAttributes().getParams()
}


/**
* Chains from one action to another via an HTTP redirect. The model is retained in the following request in the 'chainModel' property within flash scope.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import org.grails.gsp.GroovyPagesTemplateRenderer
import org.grails.gsp.io.CachingGrailsConventionGroovyPageLocator
import org.grails.gsp.io.CachingGroovyPageStaticResourceLocator
import org.grails.gsp.jsp.TagLibraryResolverImpl
import org.grails.plugins.web.api.TagLibraryApi
import org.grails.plugins.web.taglib.*
import org.grails.spring.RuntimeSpringConfiguration
import org.grails.web.errors.ErrorsViewStackTracePrinter
Expand Down Expand Up @@ -249,7 +248,6 @@ class GroovyPagesGrailsPlugin extends Plugin {
}

final pluginManager = manager
instanceTagLibraryApi(TagLibraryApi, pluginManager)
// Now go through tag libraries and configure them in Spring too. With AOP proxies and so on
for (taglib in application.tagLibClasses) {

Expand All @@ -265,9 +263,7 @@ class GroovyPagesGrailsPlugin extends Plugin {
}

errorsViewStackTracePrinter(ErrorsViewStackTracePrinter, ref('grailsResourceLocator'))

javascriptLibraryHandlerInterceptor(JavascriptLibraryHandlerInterceptor, application)

filteringCodecsByContentTypeSettings(FilteringCodecsByContentTypeSettings, application)

groovyPagesServlet(ServletRegistrationBean, new GroovyPagesServlet(), "*.gsp") {
Expand All @@ -291,7 +287,6 @@ class GroovyPagesGrailsPlugin extends Plugin {
@Override
void doWithDynamicMethods() {
StreamCharBufferMetaUtils.registerStreamCharBufferMetaClass()

TagLibraryLookup gspTagLibraryLookup = applicationContext.getBean('gspTagLibraryLookup',TagLibraryLookup)

for(GrailsClass cls in grailsApplication.getArtefacts(TagLibArtefactHandler.TYPE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/
package org.grails.plugins.web.taglib

import grails.artefact.Artefact
import grails.artefact.TagLibrary
import grails.gsp.TagLib
import grails.util.GrailsUtil
import grails.util.Metadata
import groovy.transform.CompileStatic
Expand Down Expand Up @@ -44,8 +45,8 @@ import javax.servlet.http.HttpServletResponse
*
* @author Graeme Rocher
*/
@Artefact("TagLibrary")
class ApplicationTagLib implements ApplicationContextAware, InitializingBean, GrailsApplicationAware {
@TagLib
class ApplicationTagLib implements ApplicationContextAware, InitializingBean, GrailsApplicationAware, TagLibrary {
static returnObjectForTags = ['createLink', 'resource', 'createLinkTo', 'cookie', 'header', 'img', 'join', 'meta', 'set', 'applyCodec']

ApplicationContext applicationContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/
package org.grails.plugins.web.taglib

import grails.artefact.Artefact
import grails.artefact.TagLibrary
import grails.gsp.TagLib


/**
* Tags for rendering country selection / display of country names.
Expand All @@ -24,8 +26,8 @@ import grails.artefact.Artefact
*
* @author Marc Palmer ([email protected])
*/
@Artefact("TagLibrary")
class CountryTagLib {
@TagLib
class CountryTagLib implements TagLibrary {
static final ISO3166_3 = [
"afg":"Afghanistan",
"alb":"Albania",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/
package org.grails.plugins.web.taglib

import grails.artefact.Artefact
import grails.artefact.TagLibrary
import grails.gsp.TagLib
import groovy.transform.CompileStatic

import java.text.DateFormat
Expand All @@ -42,8 +43,8 @@ import org.springframework.web.servlet.support.RequestDataValueProcessor
*
* @author Graeme Rocher
*/
@Artefact("TagLibrary")
class FormTagLib implements ApplicationContextAware, InitializingBean {
@TagLib
class FormTagLib implements ApplicationContextAware, InitializingBean, TagLibrary {

private static final DEFAULT_CURRENCY_CODES = ['EUR', 'XCD', 'USD', 'XOF', 'NOK', 'AUD',
'XAF', 'NZD', 'MAD', 'DKK', 'GBP', 'CHF',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/
package org.grails.plugins.web.taglib

import grails.artefact.Artefact
import grails.artefact.TagLibrary
import grails.gsp.TagLib
import groovy.transform.CompileStatic

import java.math.RoundingMode
Expand All @@ -41,8 +42,8 @@ import org.springframework.util.StringUtils
*
* @since 0.6
*/
@Artefact("TagLibrary")
class FormatTagLib {
@TagLib
class FormatTagLib implements TagLibrary {

static returnObjectForTags = ['formatBoolean','formatDate','formatNumber','encodeAs']

Expand Down
Loading

0 comments on commit bf5e769

Please sign in to comment.