cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <res1c...@verizon.net>
Subject Re: Handling Iterators in JXTG
Date Wed, 21 Apr 2004 21:36:31 GMT
I"ve just committed a fix for this.

Regards,

Chris

Leszek Gawron wrote:

>On Wed, Apr 21, 2004 at 12:45:46PM -0700, Christopher Oliver wrote:
>  
>
>>Leszek Gawron wrote:
>>
>>    
>>
>>>Am I wrong or there is no way to handle iterators in JXTG? One can use 
>>>forEach
>>>for collections but I sometimes would like to pass and iterator to a view 
>>>to
>>>process larger result sets.
>>>
>>>In Hibernate you can:
>>>
>>>var list = session.createQuery("from LargeTable").list() which creates a 
>>>whole
>>>collection at once but you can also do:
>>>
>>>var iterator = session.createQuery("from LargeTable").iterate() which makes
>>>generating view much less memory consuming.
>>>
>>>Maybe something like:
>>><jx:while test="${it.hasNext()}">
>>>	<jx:set car="current" value=${it.next()}/>
>>>	${current.value}<br/>
>>></jx:while>
>>>
>>>The syntax is ugly I know but after a little tuning it would be very 
>>>useful.
>>>	lg
>>>
>>>
>>>      
>>>
>><jx:forEach> should work on Iterators (as well Enumerations):
>>
>>sendPage("page.html", {iteration: session.createQuery("from 
>>LargeTable").iterate()});
>>
>><jx:forEach var="current" items="${iteration}">
>>    ${current.value}</br>
>></jx:forEach>
>>
>>
>>Chris
>>    
>>
>I am afraid this does not work. The one with .list() does. the one with
>iterate() gives this exception:
>Original Exception: java.lang.NullPointerException
>	at org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator.java:3328)
>	at org.apache.cocoon.generation.JXTemplateGenerator.performGeneration(JXTemplateGenerator.java:2952)
>	at org.apache.cocoon.generation.JXTemplateGenerator.generate(JXTemplateGenerator.java:2943)
>	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:546)
>	at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:173)
>	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:490)
>	at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.handleCocoonRedirect(TreeProcessor.java:382)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.access$000(TreeProcessor.java:66)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor$TreeProcessorRedirector.cocoonRedirect(TreeProcessor.java:543)
>	at org.apache.cocoon.environment.ForwardRedirector.redirect(ForwardRedirector.java:58)
>	at org.apache.cocoon.components.flow.AbstractInterpreter.forwardTo(AbstractInterpreter.java:176)
>	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.forwardTo(FOM_JavaScriptInterpreter.java:812)
>	at org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.forwardTo(FOM_Cocoon.java:1479)
>	at org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.jsFunction_sendPage(FOM_Cocoon.java:266)
>	at inv10.invoke()
>	at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:523)
>	at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:438)
>	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:1134)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:190)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:138)
>	at org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(InterpretedFunctionImpl.java:121)
>	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
>	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:686)
>	at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
>	at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:103)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
>	at org.apache.cocoon.Cocoon.process(Cocoon.java:619)
>	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1074)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
>	at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:342)
>	at com.mobilebox.hibernate.PersistenceManager.doFilter(PersistenceManager.java:65)
>	at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
>	at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
>	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
>	at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
>	at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
>	at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
>	at org.mortbay.http.HttpServer.service(HttpServer.java:879)
>	at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
>	at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
>	at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
>	at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:197)
>	at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
>	at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:496)
>
>Original Exception: java.lang.NullPointerException
>	at org.apache.commons.jexl.util.introspection.UberspectImpl.getIterator(UberspectImpl.java:133)
>	at org.apache.cocoon.generation.JXTemplateGenerator$JSIntrospector.getIterator(JXTemplateGenerator.java:715)
>	at org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGenerator.java:3284)
>	at org.apache.cocoon.generation.JXTemplateGenerator.performGeneration(JXTemplateGenerator.java:2952)
>	at org.apache.cocoon.generation.JXTemplateGenerator.generate(JXTemplateGenerator.java:2943)
>	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:546)
>	at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:173)
>	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:490)
>	at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.handleCocoonRedirect(TreeProcessor.java:382)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.access$000(TreeProcessor.java:66)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor$TreeProcessorRedirector.cocoonRedirect(TreeProcessor.java:543)
>	at org.apache.cocoon.environment.ForwardRedirector.redirect(ForwardRedirector.java:58)
>	at org.apache.cocoon.components.flow.AbstractInterpreter.forwardTo(AbstractInterpreter.java:176)
>	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.forwardTo(FOM_JavaScriptInterpreter.java:812)
>	at org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.forwardTo(FOM_Cocoon.java:1479)
>	at org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.jsFunction_sendPage(FOM_Cocoon.java:266)
>	at inv10.invoke()
>	at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:523)
>	at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:438)
>	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:1134)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:190)
>	at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:138)
>	at org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(InterpretedFunctionImpl.java:121)
>	at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
>	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:686)
>	at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
>	at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:103)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
>	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
>	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
>	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
>	at org.apache.cocoon.Cocoon.process(Cocoon.java:619)
>	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1074)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
>	at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:342)
>	at com.mobilebox.hibernate.PersistenceManager.doFilter(PersistenceManager.java:65)
>	at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
>	at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
>	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
>	at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
>	at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
>	at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
>	at org.mortbay.http.HttpServer.service(HttpServer.java:879)
>	at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
>	at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
>	at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
>	at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:197)
>	at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
>	at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:496)
>
>
>  
>


Mime
View raw message