首页 \ 问答 \ 使用GroovyPagesTemplateEngine时缺少taglib(Missing taglib when using GroovyPagesTemplateEngine)

使用GroovyPagesTemplateEngine时缺少taglib(Missing taglib when using GroovyPagesTemplateEngine)

我一直在通过我自己的taglib中的标签处理动态GSP内容,使用如下代码可以很好地工作:

    def GroovyPagesTemplateEngine groovyPagesTemplateEngine
    ...
    def processGSPContent(model, name, out) {
        log.debug("model is $model")
        Template t = groovyPagesTemplateEngine.createTemplate(model.content, name + ".gsp")
        Writable w = t.make(model: model)
        w.writeTo(out)
    }

现在我不是100%确定如何找到像taglibs这样的各种资源,但是我所有的taglib都能像正常的grails库一样正常工作。

AcegiSecurity的问题是AcegiSecurity的标签在以这种方式处理的内容中找不到:例如,

<g:isLoggedIn>
   You're logged in :-)
</g:isLoggedIn>

那么如何让GroovyPagesTemplateEngine找到AcegiSecurity标签? 我猜这可能与ApplicationContextServletContext

编辑---看起来像它可能是一个重载的命名空间问题:

    Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Tag [ifnotloggedin] does not exist. 
No tag library found for namespace: g at home_pmcneil_devel_Groupie_grails_app_views_display_page_gsp.run(home_pmcneil_devel_Groupie_grails_app_views_display_page_gsp:32) 

I've been processing dynamic GSP content via tags in my own taglib which works just fine using code like:

    def GroovyPagesTemplateEngine groovyPagesTemplateEngine
    ...
    def processGSPContent(model, name, out) {
        log.debug("model is $model")
        Template t = groovyPagesTemplateEngine.createTemplate(model.content, name + ".gsp")
        Writable w = t.make(model: model)
        w.writeTo(out)
    }

Now I'm not 100% sure on how various resources like taglibs are found, but all my taglibs work fine as do the normal grails libs.

The problem I have is that AcegiSecurity's tags aren't found in content processed this way: e.g.

<g:isLoggedIn>
   You're logged in :-)
</g:isLoggedIn>

so how do I get GroovyPagesTemplateEngine to find the AcegiSecurity tags? I'm guessing it may be something to do with ApplicationContext or ServletContext.

edit--- Looks like it might be an overloaded namespace problem:

    Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Tag [ifnotloggedin] does not exist. 
No tag library found for namespace: g at home_pmcneil_devel_Groupie_grails_app_views_display_page_gsp.run(home_pmcneil_devel_Groupie_grails_app_views_display_page_gsp:32) 

原文:https://stackoverflow.com/questions/1616861
更新时间:2023-01-03 06:01

最满意答案

是的,这被认为是,或者可能*导致死锁。

该术语不是绑定到线程或进程 - 而是请求

假设您的锁( mutex不可重入,并假设您的资源在变异时被锁定,并且从多个源变更资源是错误的。 当/如果您的单线程进程尝试在突变中启动数据的新突变并且锁定的非重入锁被请求锁定时会发生什么? 僵局

'可能',因为您没有准确指定您正在处理的互斥锁的类型。


yes, that is considered, or would potentially* result in deadlock.

the term is not bound to threads or processes - but requests.

suppose your lock (mutex) is not reentrant, and suppose your resource is locked when mutated, and that it is an error to mutate the resource from multiple sources. what happens when/if your single threaded process attempts to initiate a new mutation of the data within a mutation and the non-reentrant lock which is locked is requested to lock? deadlock

'potentially', because you have not specified exactly what type of mutex you are dealing with.

相关问答

更多
  • 预计像锁定SQL Server / Sybase的RDBMS偶尔发生死锁。 您可以在客户端上进行编码,以按照我的MSDN“处理死锁”的建议进行重试。 基本上,检查SQLException,也许半秒钟后,再试一次。 否则,您应该检查您的代码,以便对表格的所有访问都以相同的顺序进行。 或者你可以使用SET DEADLOCK_PRIORITY来控制谁成为受害者。 在SQL Server的MSDN上有“最小化死锁”启动 尽管无法完全避免死锁 这也提到了“使用较低的隔离级别”(我不喜欢它(与SO中的许多SQL类型相同 ...
  • Q1:事务执行所需的时间使相关进程更有可能被标记为死锁的受害者。 不,SELECT是受害者,因为它只读取数据,因此交易的成本与之相关,因此被选为受害者: 默认情况下,数据库引擎选择运行事务的会话的死锁受害者,回滚成本最低 。 或者,用户可以使用SET DEADLOCK_PRIORITY语句来指定死锁情况下的会话的优先级。 DEADLOCK_PRIORITY可以设置为LOW,NORMAL或HIGH,或者可以设置为范围(-10到10)中的任何整数值。 Q2。 如果我用NOLOCK提示执行选择,这会消除问题吗? ...
  • 那么,基于以下定义: 一个僵局是两个或两个以上的竞争行为各等待另一个完成的情况。 我会说答案是肯定的 - 一个线程可以坐在那里等待无限期的东西,但除非两个竞争的动作正在等待对方,根据定义不是一个僵局。 除非有人向我解释一个线程如何同时等待两个动作完成? 更新:我可以想到的唯一可能的情况是某种消息泵,其中线程处理消息,要求其无限期地等待某事发生,其中事实上将由消息泵上的另一消息处理某事物 。 这个(令人难以置信的设计)场景在技术上可能被称为僵局。 The JVM only keeps track of the ...
  • 我会在Param1上添加一个到FooTable的索引; 没有它,DELETE正在进行全表扫描,这会产生死锁问题。 编辑 根据您的活动详细信息,它看起来不像您有死锁,您有阻塞,许多删除正在排队,同时发生一次删除。 同样,对Param1进行索引可以缓解这个问题,如果没有它,每次删除都会进行全表扫描以找到要删除的记录,而当发生这种情况时,其他删除必须等待。 如果你有一个关于Param1的索引,它会更快地处理,你不会看到你现在的阻止。 如果你有死锁,系统将杀死其中一个涉及的进程,否则什么都不会处理; 如果表格很大, ...
  • 还有Valgrind的Helgrind工具: Helgrind:线程错误检测器 Helgrind是一个Valgrind工具,用于检测使用POSIX pthreads线程原语的C,C ++和Fortran程序中的同步错误。 POSIX pthreads中的主要抽象是:共享公共地址空间的一组线程,线程创建,线程连接,线程退出,互斥(锁),条件变量(线程间事件通知),读写器锁,自旋锁,信号量和障碍。 Helgrind可以检测到三类错误,这些错误将在接下来的三个部分中详细讨论: 错误使用POSIX pthreads ...
  • 是的,这被认为是,或者可能*导致死锁。 该术语不是绑定到线程或进程 - 而是请求 。 假设您的锁( mutex ) 不可重入,并假设您的资源在变异时被锁定,并且从多个源变更资源是错误的。 当/如果您的单线程进程尝试在突变中启动数据的新突变并且锁定的非重入锁被请求锁定时会发生什么? 僵局 '可能',因为您没有准确指定您正在处理的互斥锁的类型。 yes, that is considered, or would potentially* result in deadlock. the term is not b ...
  • 因为线程可以被阻塞,并且因为对象可以具有阻止线程访问该对象的同步方法等待另一个线程,所以一个线程可能会卡住等待另一个线程,而另一个线程又等待另一个线程等。 Because threads can become blocked and because objects can have synchronized methods that prevent threads from accessing that object util waiting for another thread, it is possib ...
  • 如果没有SSCCE ,很难知道代码中是否还有其他内容。 一种可能性是在获取锁之后抛出异常。 尝试在try / finally子句中包装每个锁定的部分。 例如。 try: shared_lock.acquire() shared_return_list.extend(acqBuffer) del acqBuffer[:] finally: shared_lock.release() 和: try: self.shared_result_lock.acquire() ...
  • 简短的回答 您可能在表上缺少索引。 首先,您必须检查您的更新是否正在生成表扫描,如果是,请在ID和CID上创建一个索引以查看是否可以解决您的问题。 答案很长 表上的Update语句可以引入表扫描。 这意味着,SQL Server会读取表中的每一行以检查是否需要更新行。 在该读取操作期间,SQL Server在行上发出(U)更新锁定。 如果需要更新行,它会将(U)锁定转换为(X)独占锁定并保持该锁定直到事务结束。 (U)锁与其他(U)或(X)锁不兼容。 在您的情况下,您有2个会话等待彼此。 每个会话将X锁定在 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。