public GroovyObject getTagLibraryForTag(
      HttpServletRequest request, HttpServletResponse response, String tagName, String namespace) {
    String nonNullNamesapce = namespace == null ? DEFAULT_NAMESPACE : namespace;
    String fullTagName = nonNullNamesapce + ":" + tagName;

    GrailsTagLibClass tagLibClass =
        (GrailsTagLibClass)
            getGrailsApplication().getArtefactForFeature(TagLibArtefactHandler.TYPE, fullTagName);
    if (tagLibClass == null) {
      return null;
    }

    return (GroovyObject) getApplicationContext().getBean(tagLibClass.getFullName());
  }
 /**
  * Registers a tag library for lookup. Each of the tags in the library is mapped by namespace:name
  * to the taglib bean. If the taglib has already been registered, this method will override the
  * existing information and update the tags to use the new version.
  *
  * @param taglib The taglib descriptor class.
  */
 public void registerTagLib(GrailsTagLibClass taglib) {
   String namespace = taglib.getNamespace();
   namespaceDispatchers.put(
       namespace,
       new NamespacedTagDispatcher(namespace, GroovyPage.class, grailsApplication, this));
   for (String tagName : taglib.getTagNames()) {
     String nameKey = tagNameKey(namespace, tagName);
     tagLibraries.put(nameKey, taglib.getFullName());
     tagsThatReturnObject.remove(nameKey);
   }
   for (String tagName : taglib.getTagNamesThatReturnObject()) {
     String nameKey = tagNameKey(namespace, tagName);
     tagsThatReturnObject.add(nameKey);
   }
 }
 @Override
 protected void putTagLib(Map<String, Object> tags, String name, GrailsTagLibClass taglib) {
   for (Object tagLibInstance : tagLibInstancesSet) {
     if (tagLibInstance.getClass() == taglib.getClazz()) {
       tags.put(name, tagLibInstance);
       break;
     }
   }
 }