You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jason Suplizio <su...@gmail.com> on 2006/01/13 19:53:54 UTC
service:tapestry.coerce.ValueConverter
Hi!
I've created a customized version of the Shell component...essentially I
want to to extend the handling of stylesheet assets to javascripts (write
<script> tags embedded in the <head > element).
CustomShell.java adds to the original:
public abstract IAsset getJavascript();
public abstract Object getJavascripts();
public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
/** added the following **/
IAsset javascript = getJavascript();
if (javascript != null)
writeJavascriptScript(writer, cycle, javascript);
Iterator scripts = (Iterator) getValueConverter().coerceValue(
getJavascripts(),
Iterator.class);
while (scripts.hasNext())
{
javascript = (IAsset) i.next();
writeJavascriptScript(writer, cycle, javascript);
}
}
private void writeJavascriptScript(IMarkupWriter writer, IRequestCycle
cycle, IAsset javascript)
{
writer.beginEmpty("script");
writer.attribute("type", "text/javascript");
writer.attribute("src", javascript.buildURL());
writer.closeTag();
writer.println();
}
CustomShell.jwc adds these to the original:
<parameter name="javascript">
<description>
If specified, provides an external javascript for the page.
</description>
</parameter>
<parameter name="javascripts">
<description>
Array or collection of stylesheet assets.
</description>
</parameter>
However, this isn't working as I'm running into a ValueConverter issue:
Exception: "org.apache.hivemind.ApplicationRuntimeException: No type
converter for type org.apache.tapestry.IAsset is available.
Borrowing from the Shell.jwc file, I notice that the following service is
injected - which apparently implements
org.apache.tapestry.coerce.ValueConverterImpl
<inject property="valueConverter" object="service:
tapestry.coerce.ValueConverter"/>
What do I need to do to get my custom shell comp to render the script
assets? Thanks in advance!
Jason
Re: service:tapestry.coerce.ValueConverter
Posted by Jason Suplizio <su...@gmail.com>.
Using a List instead of Object was a good call, that did the trick. Why did
I use Object? I was following Howard's getStylesheets() code
On 1/16/06, Jason Suplizio <su...@gmail.com> wrote:
>
> Derick...thanks alot for your help. I'm going to try this out and let you
> know how things go.
> Jason
>
> On 1/13/06, Derick Fernando < derickf@thelabllc.com> wrote:
> >
> > Hello,
> >
> > Just occurred to me, try making:
> >
> > <binding name="javascript" value="ognl:externalScripts"/>
> > an inherited-binding like:
> > <inherited-binding name="javascript" parameter-name="externalScripts"/>
> >
> > I dont see inherited-binding in the docs at:
> > http://jakarta.apache.org/tapestry/UsersGuide/spec.html should it be
> > there?
> >
> > Thanks
> >
> > Derick Fernando wrote:
> > > Hello Again,
> > >
> > > My first response was based on your first email. According to your
> > stack
> > > trace in the second email, you are having a different problem with
> > > AbstractBinding. Perhaps someone else can help figure it out.
> > >
> > > Thanks
> > >
> > > Derick Fernando wrote:
> > >
> > >> Hello,
> > >>
> > >> Whats happening here is that tapestry needs to know how to convert
> > >> whatever is returned by getJavaScripts() into an iterator. So take a
> > >> look at:
> > >>
> > >>
> > http://jakarta.apache.org/tapestry/tapestry/hivedocs/module/tapestry.coerce.html
> > >>
> > >>
> > >> You could do something like: public abstract List getJavaScripts()
> > >> instead. Is there are a reason your return type is of object?
> > >>
> > >> Its easy to build a list of assets with ognl:{ assets.fileOne,
> > >> assets.fileTwo}.
> > >>
> > >> If that does not meet your requirements you will have to make your
> > own
> > >> contribution to tapestry.coerce.IteratorConverters.
> > >>
> > >> Hope that helps.
> > >>
> > >> Jason Suplizio wrote:
> > >>
> > >>> My last note: my application is passing an asset to my Border, which
> > >>> invokes
> > >>> my CustomShell
> > >>> <component id="myAssets" type="MyAssets"/>
> > >>> <component id="border" type="_comps:Border">
> > >>> <binding name="externalScripts" value="ognl:
> > >>> components.myAssets.assets.javascriptFilename "/>
> > >>> </component>
> > >>>
> > >>> In the Border.jwc
> > >>> <parameter name="externalScripts" required="no"/>
> > >>> <component id="shell" type="CustomShell">
> > >>> <binding name="javascript" value="ognl:externalScripts"/>
> > >>> </component>
> > >>>
> > >>> On 1/13/06, Jason Suplizio < suplizio@gmail.com> wrote:
> > >>>
> > >>>> Here's the stack:
> > >>>> Using: org.jfree.chart.encoders.SunPNGEncoderAdapter
> > >>>> org.apache.tapestry.BindingException: Error converting value for
> > >>>> parameter
> > >>>> javascript: No type converter for type org.apache.tapestry.IAssetis
> > >>>> available. [context:/WEB-INF/tapcomps/Border.jwc, line 29, column
> > 55]
> > >>>> at org.apache.tapestry.binding.AbstractBinding.getObject(
> > >>>> AbstractBinding.java:97)
> > >>>> at $CustomShell_80.getJavascript($CustomShell_80.java)
> > >>>> at
> > >>>> com.expd.lib.tapestry_v40.components.CustomShell.renderComponent (
> > >>>> CustomShell.java:111)
> > >>>> at $CustomShell_80.renderComponent($CustomShell_80.java)
> > >>>> at
> > >>>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> > >>>> :617)
> > >>>> at org.apache.tapestry.BaseComponent.renderComponent (
> > >>>> BaseComponent.java:92)
> > >>>> at
> > >>>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> > >>>> :617)
> > >>>> at org.apache.tapestry.BaseComponent.renderComponent(
> > >>>> BaseComponent.java :92)
> > >>>> at org.apache.tapestry.AbstractComponent.render (
> > >>>> AbstractComponent.java:617)
> > >>>> at
> > >>>> org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java :275)
> > >>>> at org.apache.tapestry.engine.RequestCycle.renderPage(
> > >>>> RequestCycle.java:366)
> > >>>> at
> > >>>>
> > org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse (
> > >>>> ResponseRendererImpl.java:71)
> > >>>> at
> > >>>>
> > $ResponseRenderer_108c54f6985.renderResponse($ResponseRenderer_108c54f6985.java)
> > >>>>
> > >>>> at
> > >>>> org.apache.tapestry.engine.PageService.service(PageService.java:68)
> > >>>> at
> > >>>>
> > $IEngineService_108c54f69f8.service($IEngineService_108c54f69f8.java)
> > >>>> at
> > >>>> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(
> > >>>> EngineServiceOuterProxy.java:66)
> > >>>> at org.apache.tapestry.engine.AbstractEngine.service(
> > >>>> AbstractEngine.java:248)
> > >>>> at
> > >>>> org.apache.tapestry.services.impl.InvokeEngineTerminator.service (
> > >>>> InvokeEngineTerminator.java:60)
> > >>>> at
> > >>>>
> > $WebRequestServicer_108c54f69cf.service($WebRequestServicer_108c54f69cf.java)
> > >>>>
> > >>>> at
> > org.apache.tapestry.services.impl.DisableCachingFilter.service(
> > >>>> DisableCachingFilter.java:48)
> > >>>> at
> > >>>>
> > $WebRequestServicerFilter_108c54f69d1.service($WebRequestServicerFilter_108c54f69d1.java)
> > >>>>
> > >>>> at
> > >>>>
> > $WebRequestServicer_108c54f69d3.service($WebRequestServicer_108c54f69d3.java)
> >
> > >>>>
> > >>>> at
> > >>>>
> > $WebRequestServicer_108c54f69cb.service($WebRequestServicer_108c54f69cb.java)
> > >>>>
> > >>>>
> > >>>> at
> > >>>>
> > org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service
> > >>>>
> > >>>> (WebRequestServicerPipelineBridge.java:56)
> > >>>> at
> > >>>>
> > $ServletRequestServicer_108c54f69af.service($ServletRequestServicer_108c54f69af.java)
> >
> > >>>>
> > >>>>
> > >>>> at org.apache.tapestry.request.DecodedRequestInjector.service(
> > >>>> DecodedRequestInjector.java:55)
> > >>>> at
> > >>>>
> > $ServletRequestServicerFilter_108c54f69ab.service($ServletRequestServicerFilter_108c54f69ab.java)
> >
> > >>>>
> > >>>> at
> > >>>>
> > $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
> > >>>>
> > >>>>
> > >>>> at org.apache.tapestry.multipart.MultipartDecoderFilter.service(
> > >>>> MultipartDecoderFilter.java:52)
> > >>>> at
> > >>>>
> > $ServletRequestServicerFilter_108c54f69a9.service($ServletRequestServicerFilter_108c54f69a9.java)
> > >>>>
> > >>>> at
> > >>>>
> > $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
> > >>>>
> > >>>>
> > >>>> at
> > org.apache.tapestry.services.impl.SetupRequestEncoding.service (
> > >>>> SetupRequestEncoding.java:53)
> > >>>> at
> > >>>>
> > $ServletRequestServicerFilter_108c54f69ad.service($ServletRequestServicerFilter_108c54f69ad.java)
> > >>>>
> > >>>> at
> > >>>>
> > $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
> > >>>>
> > >>>>
> > >>>> at
> > >>>>
> > $ServletRequestServicer_108c54f69a3.service($ServletRequestServicer_108c54f69a3.java)
> >
> > >>>>
> > >>>> at org.apache.tapestry.ApplicationServlet.doService(
> > >>>> ApplicationServlet.java:123)
> > >>>> at com.expd.app.expo2.webaccess.ExpoTapestryServlet.doService (
> > >>>> ExpoTapestryServlet.java:52)
> > >>>> at org.apache.tapestry.ApplicationServlet.doGet(
> > >>>> ApplicationServlet.java:79)
> > >>>> at javax.servlet.http.HttpServlet.service (HttpServlet.java:740)
> > >>>> at javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
> > >>>> at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > >>>> ApplicationFilterChain.java:247)
> > >>>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > >>>> ApplicationFilterChain.java :193)
> > >>>> at org.apache.catalina.core.StandardWrapperValve.invoke (
> > >>>> StandardWrapperValve.java:256)
> > >>>> at
> > >>>>
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> > >>>>
> > >>>> ( StandardPipeline.java:643)
> > >>>> at org.apache.catalina.core.StandardPipeline.invoke(
> > >>>> StandardPipeline.java:480)
> > >>>> at org.apache.catalina.core.ContainerBase.invoke (
> > ContainerBase.java
> > >>>> :995)
> > >>>> at org.apache.catalina.core.StandardContextValve.invoke (
> > >>>> StandardContextValve.java:191)
> > >>>> at
> > >>>>
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> > >>>>
> > >>>> (StandardPipeline.java:643)
> > >>>> at org.apache.catalina.core.StandardPipeline.invoke (
> > >>>> StandardPipeline.java :480)
> > >>>> at org.apache.catalina.core.ContainerBase.invoke(
> > ContainerBase.java
> > >>>> :995)
> > >>>> at org.apache.catalina.core.StandardContext.invoke (
> > >>>> StandardContext.java:2422)
> > >>>> at org.apache.catalina.core.StandardHostValve.invoke (
> > >>>> StandardHostValve.java:180)
> > >>>> at
> > >>>>
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> > >>>>
> > >>>> (StandardPipeline.java:643)
> > >>>> at org.apache.catalina.valves.ErrorDispatcherValve.invoke (
> > >>>> ErrorDispatcherValve.java :171)
> > >>>> at
> > >>>>
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> > >>>>
> > >>>> ( StandardPipeline.java:641)
> > >>>> at org.apache.catalina.valves.ErrorReportValve.invoke(
> > >>>> ErrorReportValve.java:163)
> > >>>> at
> > >>>>
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> > >>>>
> > >>>> (StandardPipeline.java:641)
> > >>>> at org.apache.catalina.core.StandardPipeline.invoke(
> > >>>> StandardPipeline.java:480)
> > >>>> at org.apache.catalina.core.ContainerBase.invoke (
> > ContainerBase.java
> > >>>> :995)
> > >>>> at org.apache.catalina.core.StandardEngineValve.invoke(
> > >>>> StandardEngineValve.java:174)
> > >>>> at
> > >>>>
> > org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> > >>>>
> > >>>> (StandardPipeline.java :643)
> > >>>> at org.apache.catalina.core.StandardPipeline.invoke (
> > >>>> StandardPipeline.java:480)
> > >>>> at org.apache.catalina.core.ContainerBase.invoke(
> > ContainerBase.java
> > >>>> :995)
> > >>>> at org.apache.coyote.tomcat4.CoyoteAdapter.service
> > >>>> (CoyoteAdapter.java
> > >>>> :199)
> > >>>> at org.apache.coyote.http11.Http11Processor.process(
> > >>>> Http11Processor.java:828)
> > >>>> at
> > >>>>
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
> > >>>>
> > >>>> (Http11Protocol.java :700)
> > >>>> at org.apache.tomcat.util.net.TcpWorkerThread.runIt (
> > >>>> PoolTcpEndpoint.java:584)
> > >>>> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
> > (
> > >>>> ThreadPool.java:683)
> > >>>> at java.lang.Thread.run (Unknown Source)
> > >>>> Caused by: org.apache.hivemind.ApplicationRuntimeException: No type
> > >>>> converter for type org.apache.tapestry.IAsset is available.
> > >>>> at org.apache.tapestry.coerce.ValueConverterImpl.coerceValue (
> > >>>> ValueConverterImpl.java :105)
> > >>>> at
> > >>>>
> > $ValueConverter_108c54f6957.coerceValue($ValueConverter_108c54f6957.java)
> > >>>>
> > >>>> at org.apache.tapestry.binding.AbstractBinding.getObject (
> > >>>> AbstractBinding.java:91)
> > >>>> ... 68 more
> > >>>>
> > >>>> On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
> > >>>>
> > >>>>> Hi!
> > >>>>> I've created a customized version of the Shell
> > >>>>> component...essentially I
> > >>>>> want to to extend the handling of stylesheet assets to javascripts
> >
> > >>>>> (write
> > >>>>> <script> tags embedded in the <head > element).
> > >>>>> CustomShell.java adds to the original:
> > >>>>>
> > >>>>> public abstract IAsset getJavascript();
> > >>>>> public abstract Object getJavascripts();
> > >>>>>
> > >>>>> public void renderComponent(IMarkupWriter writer, IRequestCycle
> > >>>>> cycle) {
> > >>>>> /** added the following **/
> > >>>>> IAsset javascript = getJavascript();
> > >>>>>
> > >>>>> if (javascript != null)
> > >>>>> writeJavascriptScript(writer, cycle, javascript);
> > >>>>>
> > >>>>> Iterator scripts = (Iterator)
> > >>>>> getValueConverter().coerceValue(
> > >>>>> getJavascripts(),
> > >>>>> Iterator.class);
> > >>>>>
> > >>>>> while (scripts.hasNext())
> > >>>>> {
> > >>>>> javascript = (IAsset) i.next();
> > >>>>>
> > >>>>> writeJavascriptScript(writer, cycle, javascript);
> > >>>>> }
> > >>>>> }
> > >>>>> private void writeJavascriptScript(IMarkupWriter writer,
> > >>>>> IRequestCycle cycle, IAsset javascript)
> > >>>>> {
> > >>>>> writer.beginEmpty("script");
> > >>>>> writer.attribute("type", "text/javascript");
> > >>>>> writer.attribute("src", javascript.buildURL());
> > >>>>> writer.closeTag();
> > >>>>> writer.println();
> > >>>>> }
> > >>>>>
> > >>>>> CustomShell.jwc adds these to the original:
> > >>>>> <parameter name="javascript">
> > >>>>> <description>
> > >>>>> If specified, provides an external javascript for the page.
> > >>>>> </description>
> > >>>>> </parameter>
> > >>>>>
> > >>>>> <parameter name="javascripts">
> > >>>>> <description>
> > >>>>> Array or collection of stylesheet assets.
> > >>>>> </description>
> > >>>>> </parameter>
> > >>>>>
> > >>>>>
> > >>>>> However, this isn't working as I'm running into a ValueConverter
> > >>>>> issue:
> > >>>>>
> > >>>>> Exception: "org.apache.hivemind.ApplicationRuntimeException: No
> > type
> > >>>>> converter for type org.apache.tapestry.IAsset is available.
> > >>>>>
> > >>>>> Borrowing from the Shell.jwc file, I notice that the following
> > service
> > >>>>> is injected - which apparently implements
> > >>>>> org.apache.tapestry.coerce.ValueConverterImpl
> > >>>>>
> > >>>>> <inject property="valueConverter" object="service:
> > >>>>> tapestry.coerce.ValueConverter"/>
> > >>>>>
> > >>>>> What do I need to do to get my custom shell comp to render the
> > script
> > >>>>> assets? Thanks in advance!
> > >>>>> Jason
> > >>>>>
> > >>>>>
> > >>>>
> > >>>
> > >>
> > >>
> > >
> > >
> >
> >
> > --
> > .........................................
> >
> > Derick Fernando
> > Lead Architect
> > derickf@thelabllc.com
> > (323) 314-9593
> > http://www.thelabllc.com
> >
> > Content is for intended recipient only.
> > Copyright 2001-2005, The Lab, LLC
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
Re: service:tapestry.coerce.ValueConverter
Posted by Jason Suplizio <su...@gmail.com>.
Derick...thanks alot for your help. I'm going to try this out and let you
know how things go.
Jason
On 1/13/06, Derick Fernando <de...@thelabllc.com> wrote:
>
> Hello,
>
> Just occurred to me, try making:
>
> <binding name="javascript" value="ognl:externalScripts"/>
> an inherited-binding like:
> <inherited-binding name="javascript" parameter-name="externalScripts"/>
>
> I dont see inherited-binding in the docs at:
> http://jakarta.apache.org/tapestry/UsersGuide/spec.html should it be
> there?
>
> Thanks
>
> Derick Fernando wrote:
> > Hello Again,
> >
> > My first response was based on your first email. According to your stack
> > trace in the second email, you are having a different problem with
> > AbstractBinding. Perhaps someone else can help figure it out.
> >
> > Thanks
> >
> > Derick Fernando wrote:
> >
> >> Hello,
> >>
> >> Whats happening here is that tapestry needs to know how to convert
> >> whatever is returned by getJavaScripts() into an iterator. So take a
> >> look at:
> >>
> >>
> http://jakarta.apache.org/tapestry/tapestry/hivedocs/module/tapestry.coerce.html
> >>
> >>
> >> You could do something like: public abstract List getJavaScripts()
> >> instead. Is there are a reason your return type is of object?
> >>
> >> Its easy to build a list of assets with ognl:{assets.fileOne,
> >> assets.fileTwo}.
> >>
> >> If that does not meet your requirements you will have to make your own
> >> contribution to tapestry.coerce.IteratorConverters.
> >>
> >> Hope that helps.
> >>
> >> Jason Suplizio wrote:
> >>
> >>> My last note: my application is passing an asset to my Border, which
> >>> invokes
> >>> my CustomShell
> >>> <component id="myAssets" type="MyAssets"/>
> >>> <component id="border" type="_comps:Border">
> >>> <binding name="externalScripts" value="ognl:
> >>> components.myAssets.assets.javascriptFilename"/>
> >>> </component>
> >>>
> >>> In the Border.jwc
> >>> <parameter name="externalScripts" required="no"/>
> >>> <component id="shell" type="CustomShell">
> >>> <binding name="javascript" value="ognl:externalScripts"/>
> >>> </component>
> >>>
> >>> On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
> >>>
> >>>> Here's the stack:
> >>>> Using: org.jfree.chart.encoders.SunPNGEncoderAdapter
> >>>> org.apache.tapestry.BindingException: Error converting value for
> >>>> parameter
> >>>> javascript: No type converter for type org.apache.tapestry.IAsset is
> >>>> available. [context:/WEB-INF/tapcomps/Border.jwc, line 29, column 55]
> >>>> at org.apache.tapestry.binding.AbstractBinding.getObject(
> >>>> AbstractBinding.java:97)
> >>>> at $CustomShell_80.getJavascript($CustomShell_80.java)
> >>>> at
> >>>> com.expd.lib.tapestry_v40.components.CustomShell.renderComponent (
> >>>> CustomShell.java:111)
> >>>> at $CustomShell_80.renderComponent($CustomShell_80.java)
> >>>> at
> >>>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> >>>> :617)
> >>>> at org.apache.tapestry.BaseComponent.renderComponent (
> >>>> BaseComponent.java:92)
> >>>> at
> >>>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> >>>> :617)
> >>>> at org.apache.tapestry.BaseComponent.renderComponent(
> >>>> BaseComponent.java:92)
> >>>> at org.apache.tapestry.AbstractComponent.render (
> >>>> AbstractComponent.java:617)
> >>>> at
> >>>> org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:275)
> >>>> at org.apache.tapestry.engine.RequestCycle.renderPage(
> >>>> RequestCycle.java:366)
> >>>> at
> >>>> org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(
> >>>> ResponseRendererImpl.java:71)
> >>>> at
> >>>>
> $ResponseRenderer_108c54f6985.renderResponse($ResponseRenderer_108c54f6985.java)
> >>>>
> >>>> at
> >>>> org.apache.tapestry.engine.PageService.service(PageService.java:68)
> >>>> at
> >>>> $IEngineService_108c54f69f8.service($IEngineService_108c54f69f8.java)
> >>>> at
> >>>> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(
> >>>> EngineServiceOuterProxy.java:66)
> >>>> at org.apache.tapestry.engine.AbstractEngine.service(
> >>>> AbstractEngine.java:248)
> >>>> at
> >>>> org.apache.tapestry.services.impl.InvokeEngineTerminator.service (
> >>>> InvokeEngineTerminator.java:60)
> >>>> at
> >>>>
> $WebRequestServicer_108c54f69cf.service($WebRequestServicer_108c54f69cf.java)
> >>>>
> >>>> at org.apache.tapestry.services.impl.DisableCachingFilter.service(
> >>>> DisableCachingFilter.java:48)
> >>>> at
> >>>>
> $WebRequestServicerFilter_108c54f69d1.service($WebRequestServicerFilter_108c54f69d1.java)
> >>>>
> >>>> at
> >>>>
> $WebRequestServicer_108c54f69d3.service($WebRequestServicer_108c54f69d3.java)
> >>>>
> >>>> at
> >>>>
> $WebRequestServicer_108c54f69cb.service($WebRequestServicer_108c54f69cb.java)
> >>>>
> >>>>
> >>>> at
> >>>>
> org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service
> >>>>
> >>>> (WebRequestServicerPipelineBridge.java:56)
> >>>> at
> >>>>
> $ServletRequestServicer_108c54f69af.service($ServletRequestServicer_108c54f69af.java)
> >>>>
> >>>>
> >>>> at org.apache.tapestry.request.DecodedRequestInjector.service(
> >>>> DecodedRequestInjector.java:55)
> >>>> at
> >>>>
> $ServletRequestServicerFilter_108c54f69ab.service($ServletRequestServicerFilter_108c54f69ab.java)
> >>>>
> >>>> at
> >>>>
> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
> >>>>
> >>>>
> >>>> at org.apache.tapestry.multipart.MultipartDecoderFilter.service(
> >>>> MultipartDecoderFilter.java:52)
> >>>> at
> >>>>
> $ServletRequestServicerFilter_108c54f69a9.service($ServletRequestServicerFilter_108c54f69a9.java)
> >>>>
> >>>> at
> >>>>
> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
> >>>>
> >>>>
> >>>> at org.apache.tapestry.services.impl.SetupRequestEncoding.service(
> >>>> SetupRequestEncoding.java:53)
> >>>> at
> >>>>
> $ServletRequestServicerFilter_108c54f69ad.service($ServletRequestServicerFilter_108c54f69ad.java)
> >>>>
> >>>> at
> >>>>
> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
> >>>>
> >>>>
> >>>> at
> >>>>
> $ServletRequestServicer_108c54f69a3.service($ServletRequestServicer_108c54f69a3.java)
> >>>>
> >>>> at org.apache.tapestry.ApplicationServlet.doService(
> >>>> ApplicationServlet.java:123)
> >>>> at com.expd.app.expo2.webaccess.ExpoTapestryServlet.doService (
> >>>> ExpoTapestryServlet.java:52)
> >>>> at org.apache.tapestry.ApplicationServlet.doGet(
> >>>> ApplicationServlet.java:79)
> >>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> >>>> at javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
> >>>> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> >>>> ApplicationFilterChain.java:247)
> >>>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> >>>> ApplicationFilterChain.java :193)
> >>>> at org.apache.catalina.core.StandardWrapperValve.invoke(
> >>>> StandardWrapperValve.java:256)
> >>>> at
> >>>>
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> >>>>
> >>>> (StandardPipeline.java:643)
> >>>> at org.apache.catalina.core.StandardPipeline.invoke(
> >>>> StandardPipeline.java:480)
> >>>> at org.apache.catalina.core.ContainerBase.invoke(
> ContainerBase.java
> >>>> :995)
> >>>> at org.apache.catalina.core.StandardContextValve.invoke (
> >>>> StandardContextValve.java:191)
> >>>> at
> >>>>
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> >>>>
> >>>> (StandardPipeline.java:643)
> >>>> at org.apache.catalina.core.StandardPipeline.invoke(
> >>>> StandardPipeline.java :480)
> >>>> at org.apache.catalina.core.ContainerBase.invoke(
> ContainerBase.java
> >>>> :995)
> >>>> at org.apache.catalina.core.StandardContext.invoke(
> >>>> StandardContext.java:2422)
> >>>> at org.apache.catalina.core.StandardHostValve.invoke (
> >>>> StandardHostValve.java:180)
> >>>> at
> >>>>
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> >>>>
> >>>> (StandardPipeline.java:643)
> >>>> at org.apache.catalina.valves.ErrorDispatcherValve.invoke(
> >>>> ErrorDispatcherValve.java :171)
> >>>> at
> >>>>
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> >>>>
> >>>> (StandardPipeline.java:641)
> >>>> at org.apache.catalina.valves.ErrorReportValve.invoke(
> >>>> ErrorReportValve.java:163)
> >>>> at
> >>>>
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> >>>>
> >>>> (StandardPipeline.java:641)
> >>>> at org.apache.catalina.core.StandardPipeline.invoke(
> >>>> StandardPipeline.java:480)
> >>>> at org.apache.catalina.core.ContainerBase.invoke (
> ContainerBase.java
> >>>> :995)
> >>>> at org.apache.catalina.core.StandardEngineValve.invoke(
> >>>> StandardEngineValve.java:174)
> >>>> at
> >>>>
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> >>>>
> >>>> (StandardPipeline.java :643)
> >>>> at org.apache.catalina.core.StandardPipeline.invoke(
> >>>> StandardPipeline.java:480)
> >>>> at org.apache.catalina.core.ContainerBase.invoke(
> ContainerBase.java
> >>>> :995)
> >>>> at org.apache.coyote.tomcat4.CoyoteAdapter.service
> >>>> (CoyoteAdapter.java
> >>>> :199)
> >>>> at org.apache.coyote.http11.Http11Processor.process(
> >>>> Http11Processor.java:828)
> >>>> at
> >>>>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
> >>>>
> >>>> (Http11Protocol.java :700)
> >>>> at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
> >>>> PoolTcpEndpoint.java:584)
> >>>> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> >>>> ThreadPool.java:683)
> >>>> at java.lang.Thread.run(Unknown Source)
> >>>> Caused by: org.apache.hivemind.ApplicationRuntimeException: No type
> >>>> converter for type org.apache.tapestry.IAsset is available.
> >>>> at org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(
> >>>> ValueConverterImpl.java :105)
> >>>> at
> >>>>
> $ValueConverter_108c54f6957.coerceValue($ValueConverter_108c54f6957.java)
> >>>>
> >>>> at org.apache.tapestry.binding.AbstractBinding.getObject(
> >>>> AbstractBinding.java:91)
> >>>> ... 68 more
> >>>>
> >>>> On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
> >>>>
> >>>>> Hi!
> >>>>> I've created a customized version of the Shell
> >>>>> component...essentially I
> >>>>> want to to extend the handling of stylesheet assets to javascripts
> >>>>> (write
> >>>>> <script> tags embedded in the <head > element).
> >>>>> CustomShell.java adds to the original:
> >>>>>
> >>>>> public abstract IAsset getJavascript();
> >>>>> public abstract Object getJavascripts();
> >>>>>
> >>>>> public void renderComponent(IMarkupWriter writer, IRequestCycle
> >>>>> cycle) {
> >>>>> /** added the following **/
> >>>>> IAsset javascript = getJavascript();
> >>>>>
> >>>>> if (javascript != null)
> >>>>> writeJavascriptScript(writer, cycle, javascript);
> >>>>>
> >>>>> Iterator scripts = (Iterator)
> >>>>> getValueConverter().coerceValue(
> >>>>> getJavascripts(),
> >>>>> Iterator.class);
> >>>>>
> >>>>> while (scripts.hasNext())
> >>>>> {
> >>>>> javascript = (IAsset) i.next();
> >>>>>
> >>>>> writeJavascriptScript(writer, cycle, javascript);
> >>>>> }
> >>>>> }
> >>>>> private void writeJavascriptScript(IMarkupWriter writer,
> >>>>> IRequestCycle cycle, IAsset javascript)
> >>>>> {
> >>>>> writer.beginEmpty("script");
> >>>>> writer.attribute("type", "text/javascript");
> >>>>> writer.attribute("src", javascript.buildURL());
> >>>>> writer.closeTag();
> >>>>> writer.println();
> >>>>> }
> >>>>>
> >>>>> CustomShell.jwc adds these to the original:
> >>>>> <parameter name="javascript">
> >>>>> <description>
> >>>>> If specified, provides an external javascript for the page.
> >>>>> </description>
> >>>>> </parameter>
> >>>>>
> >>>>> <parameter name="javascripts">
> >>>>> <description>
> >>>>> Array or collection of stylesheet assets.
> >>>>> </description>
> >>>>> </parameter>
> >>>>>
> >>>>>
> >>>>> However, this isn't working as I'm running into a ValueConverter
> >>>>> issue:
> >>>>>
> >>>>> Exception: "org.apache.hivemind.ApplicationRuntimeException: No type
> >>>>> converter for type org.apache.tapestry.IAsset is available.
> >>>>>
> >>>>> Borrowing from the Shell.jwc file, I notice that the following
> service
> >>>>> is injected - which apparently implements
> >>>>> org.apache.tapestry.coerce.ValueConverterImpl
> >>>>>
> >>>>> <inject property="valueConverter" object="service:
> >>>>> tapestry.coerce.ValueConverter"/>
> >>>>>
> >>>>> What do I need to do to get my custom shell comp to render the
> script
> >>>>> assets? Thanks in advance!
> >>>>> Jason
> >>>>>
> >>>>>
> >>>>
> >>>
> >>
> >>
> >
> >
>
>
> --
> .........................................
>
> Derick Fernando
> Lead Architect
> derickf@thelabllc.com
> (323) 314-9593
> http://www.thelabllc.com
>
> Content is for intended recipient only.
> Copyright 2001-2005, The Lab, LLC
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
Re: service:tapestry.coerce.ValueConverter
Posted by Derick Fernando <de...@thelabllc.com>.
Hello,
Just occurred to me, try making:
<binding name="javascript" value="ognl:externalScripts"/>
an inherited-binding like:
<inherited-binding name="javascript" parameter-name="externalScripts"/>
I dont see inherited-binding in the docs at:
http://jakarta.apache.org/tapestry/UsersGuide/spec.html should it be there?
Thanks
Derick Fernando wrote:
> Hello Again,
>
> My first response was based on your first email. According to your stack
> trace in the second email, you are having a different problem with
> AbstractBinding. Perhaps someone else can help figure it out.
>
> Thanks
>
> Derick Fernando wrote:
>
>> Hello,
>>
>> Whats happening here is that tapestry needs to know how to convert
>> whatever is returned by getJavaScripts() into an iterator. So take a
>> look at:
>>
>> http://jakarta.apache.org/tapestry/tapestry/hivedocs/module/tapestry.coerce.html
>>
>>
>> You could do something like: public abstract List getJavaScripts()
>> instead. Is there are a reason your return type is of object?
>>
>> Its easy to build a list of assets with ognl:{assets.fileOne,
>> assets.fileTwo}.
>>
>> If that does not meet your requirements you will have to make your own
>> contribution to tapestry.coerce.IteratorConverters.
>>
>> Hope that helps.
>>
>> Jason Suplizio wrote:
>>
>>> My last note: my application is passing an asset to my Border, which
>>> invokes
>>> my CustomShell
>>> <component id="myAssets" type="MyAssets"/>
>>> <component id="border" type="_comps:Border">
>>> <binding name="externalScripts" value="ognl:
>>> components.myAssets.assets.javascriptFilename"/>
>>> </component>
>>>
>>> In the Border.jwc
>>> <parameter name="externalScripts" required="no"/>
>>> <component id="shell" type="CustomShell">
>>> <binding name="javascript" value="ognl:externalScripts"/>
>>> </component>
>>>
>>> On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
>>>
>>>> Here's the stack:
>>>> Using: org.jfree.chart.encoders.SunPNGEncoderAdapter
>>>> org.apache.tapestry.BindingException: Error converting value for
>>>> parameter
>>>> javascript: No type converter for type org.apache.tapestry.IAsset is
>>>> available. [context:/WEB-INF/tapcomps/Border.jwc, line 29, column 55]
>>>> at org.apache.tapestry.binding.AbstractBinding.getObject(
>>>> AbstractBinding.java:97)
>>>> at $CustomShell_80.getJavascript($CustomShell_80.java)
>>>> at
>>>> com.expd.lib.tapestry_v40.components.CustomShell.renderComponent (
>>>> CustomShell.java:111)
>>>> at $CustomShell_80.renderComponent($CustomShell_80.java)
>>>> at
>>>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
>>>> :617)
>>>> at org.apache.tapestry.BaseComponent.renderComponent (
>>>> BaseComponent.java:92)
>>>> at
>>>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
>>>> :617)
>>>> at org.apache.tapestry.BaseComponent.renderComponent(
>>>> BaseComponent.java:92)
>>>> at org.apache.tapestry.AbstractComponent.render (
>>>> AbstractComponent.java:617)
>>>> at
>>>> org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:275)
>>>> at org.apache.tapestry.engine.RequestCycle.renderPage(
>>>> RequestCycle.java:366)
>>>> at
>>>> org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse (
>>>> ResponseRendererImpl.java:71)
>>>> at
>>>> $ResponseRenderer_108c54f6985.renderResponse($ResponseRenderer_108c54f6985.java)
>>>>
>>>> at
>>>> org.apache.tapestry.engine.PageService.service(PageService.java:68)
>>>> at
>>>> $IEngineService_108c54f69f8.service($IEngineService_108c54f69f8.java)
>>>> at
>>>> org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(
>>>> EngineServiceOuterProxy.java:66)
>>>> at org.apache.tapestry.engine.AbstractEngine.service(
>>>> AbstractEngine.java:248)
>>>> at
>>>> org.apache.tapestry.services.impl.InvokeEngineTerminator.service (
>>>> InvokeEngineTerminator.java:60)
>>>> at
>>>> $WebRequestServicer_108c54f69cf.service($WebRequestServicer_108c54f69cf.java)
>>>>
>>>> at org.apache.tapestry.services.impl.DisableCachingFilter.service(
>>>> DisableCachingFilter.java:48)
>>>> at
>>>> $WebRequestServicerFilter_108c54f69d1.service($WebRequestServicerFilter_108c54f69d1.java)
>>>>
>>>> at
>>>> $WebRequestServicer_108c54f69d3.service($WebRequestServicer_108c54f69d3.java)
>>>>
>>>> at
>>>> $WebRequestServicer_108c54f69cb.service($WebRequestServicer_108c54f69cb.java)
>>>>
>>>>
>>>> at
>>>> org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service
>>>>
>>>> (WebRequestServicerPipelineBridge.java:56)
>>>> at
>>>> $ServletRequestServicer_108c54f69af.service($ServletRequestServicer_108c54f69af.java)
>>>>
>>>>
>>>> at org.apache.tapestry.request.DecodedRequestInjector.service(
>>>> DecodedRequestInjector.java:55)
>>>> at
>>>> $ServletRequestServicerFilter_108c54f69ab.service($ServletRequestServicerFilter_108c54f69ab.java)
>>>>
>>>> at
>>>> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>>>>
>>>>
>>>> at org.apache.tapestry.multipart.MultipartDecoderFilter.service(
>>>> MultipartDecoderFilter.java:52)
>>>> at
>>>> $ServletRequestServicerFilter_108c54f69a9.service($ServletRequestServicerFilter_108c54f69a9.java)
>>>>
>>>> at
>>>> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>>>>
>>>>
>>>> at org.apache.tapestry.services.impl.SetupRequestEncoding.service(
>>>> SetupRequestEncoding.java:53)
>>>> at
>>>> $ServletRequestServicerFilter_108c54f69ad.service($ServletRequestServicerFilter_108c54f69ad.java)
>>>>
>>>> at
>>>> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>>>>
>>>>
>>>> at
>>>> $ServletRequestServicer_108c54f69a3.service($ServletRequestServicer_108c54f69a3.java)
>>>>
>>>> at org.apache.tapestry.ApplicationServlet.doService(
>>>> ApplicationServlet.java:123)
>>>> at com.expd.app.expo2.webaccess.ExpoTapestryServlet.doService (
>>>> ExpoTapestryServlet.java:52)
>>>> at org.apache.tapestry.ApplicationServlet.doGet(
>>>> ApplicationServlet.java:79)
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>>>> at javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
>>>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>>>> ApplicationFilterChain.java:247)
>>>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>>>> ApplicationFilterChain.java :193)
>>>> at org.apache.catalina.core.StandardWrapperValve.invoke(
>>>> StandardWrapperValve.java:256)
>>>> at
>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>>
>>>> (StandardPipeline.java:643)
>>>> at org.apache.catalina.core.StandardPipeline.invoke(
>>>> StandardPipeline.java:480)
>>>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
>>>> :995)
>>>> at org.apache.catalina.core.StandardContextValve.invoke (
>>>> StandardContextValve.java:191)
>>>> at
>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>>
>>>> (StandardPipeline.java:643)
>>>> at org.apache.catalina.core.StandardPipeline.invoke(
>>>> StandardPipeline.java :480)
>>>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
>>>> :995)
>>>> at org.apache.catalina.core.StandardContext.invoke(
>>>> StandardContext.java:2422)
>>>> at org.apache.catalina.core.StandardHostValve.invoke (
>>>> StandardHostValve.java:180)
>>>> at
>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>>
>>>> (StandardPipeline.java:643)
>>>> at org.apache.catalina.valves.ErrorDispatcherValve.invoke(
>>>> ErrorDispatcherValve.java :171)
>>>> at
>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>>
>>>> (StandardPipeline.java:641)
>>>> at org.apache.catalina.valves.ErrorReportValve.invoke(
>>>> ErrorReportValve.java:163)
>>>> at
>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>>
>>>> (StandardPipeline.java:641)
>>>> at org.apache.catalina.core.StandardPipeline.invoke(
>>>> StandardPipeline.java:480)
>>>> at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java
>>>> :995)
>>>> at org.apache.catalina.core.StandardEngineValve.invoke(
>>>> StandardEngineValve.java:174)
>>>> at
>>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>>
>>>> (StandardPipeline.java :643)
>>>> at org.apache.catalina.core.StandardPipeline.invoke(
>>>> StandardPipeline.java:480)
>>>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
>>>> :995)
>>>> at org.apache.coyote.tomcat4.CoyoteAdapter.service
>>>> (CoyoteAdapter.java
>>>> :199)
>>>> at org.apache.coyote.http11.Http11Processor.process(
>>>> Http11Processor.java:828)
>>>> at
>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
>>>>
>>>> (Http11Protocol.java :700)
>>>> at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
>>>> PoolTcpEndpoint.java:584)
>>>> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
>>>> ThreadPool.java:683)
>>>> at java.lang.Thread.run(Unknown Source)
>>>> Caused by: org.apache.hivemind.ApplicationRuntimeException: No type
>>>> converter for type org.apache.tapestry.IAsset is available.
>>>> at org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(
>>>> ValueConverterImpl.java :105)
>>>> at
>>>> $ValueConverter_108c54f6957.coerceValue($ValueConverter_108c54f6957.java)
>>>>
>>>> at org.apache.tapestry.binding.AbstractBinding.getObject(
>>>> AbstractBinding.java:91)
>>>> ... 68 more
>>>>
>>>> On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
>>>>
>>>>> Hi!
>>>>> I've created a customized version of the Shell
>>>>> component...essentially I
>>>>> want to to extend the handling of stylesheet assets to javascripts
>>>>> (write
>>>>> <script> tags embedded in the <head > element).
>>>>> CustomShell.java adds to the original:
>>>>>
>>>>> public abstract IAsset getJavascript();
>>>>> public abstract Object getJavascripts();
>>>>>
>>>>> public void renderComponent(IMarkupWriter writer, IRequestCycle
>>>>> cycle) {
>>>>> /** added the following **/
>>>>> IAsset javascript = getJavascript();
>>>>>
>>>>> if (javascript != null)
>>>>> writeJavascriptScript(writer, cycle, javascript);
>>>>>
>>>>> Iterator scripts = (Iterator)
>>>>> getValueConverter().coerceValue(
>>>>> getJavascripts(),
>>>>> Iterator.class);
>>>>>
>>>>> while (scripts.hasNext())
>>>>> {
>>>>> javascript = (IAsset) i.next();
>>>>>
>>>>> writeJavascriptScript(writer, cycle, javascript);
>>>>> }
>>>>> }
>>>>> private void writeJavascriptScript(IMarkupWriter writer,
>>>>> IRequestCycle cycle, IAsset javascript)
>>>>> {
>>>>> writer.beginEmpty("script");
>>>>> writer.attribute("type", "text/javascript");
>>>>> writer.attribute("src", javascript.buildURL());
>>>>> writer.closeTag();
>>>>> writer.println();
>>>>> }
>>>>>
>>>>> CustomShell.jwc adds these to the original:
>>>>> <parameter name="javascript">
>>>>> <description>
>>>>> If specified, provides an external javascript for the page.
>>>>> </description>
>>>>> </parameter>
>>>>>
>>>>> <parameter name="javascripts">
>>>>> <description>
>>>>> Array or collection of stylesheet assets.
>>>>> </description>
>>>>> </parameter>
>>>>>
>>>>>
>>>>> However, this isn't working as I'm running into a ValueConverter
>>>>> issue:
>>>>>
>>>>> Exception: "org.apache.hivemind.ApplicationRuntimeException: No type
>>>>> converter for type org.apache.tapestry.IAsset is available.
>>>>>
>>>>> Borrowing from the Shell.jwc file, I notice that the following service
>>>>> is injected - which apparently implements
>>>>> org.apache.tapestry.coerce.ValueConverterImpl
>>>>>
>>>>> <inject property="valueConverter" object="service:
>>>>> tapestry.coerce.ValueConverter"/>
>>>>>
>>>>> What do I need to do to get my custom shell comp to render the script
>>>>> assets? Thanks in advance!
>>>>> Jason
>>>>>
>>>>>
>>>>
>>>
>>
>>
>
>
--
.........................................
Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com
Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: service:tapestry.coerce.ValueConverter
Posted by Derick Fernando <de...@thelabllc.com>.
Hello Again,
My first response was based on your first email. According to your stack
trace in the second email, you are having a different problem with
AbstractBinding. Perhaps someone else can help figure it out.
Thanks
Derick Fernando wrote:
> Hello,
>
> Whats happening here is that tapestry needs to know how to convert
> whatever is returned by getJavaScripts() into an iterator. So take a
> look at:
>
> http://jakarta.apache.org/tapestry/tapestry/hivedocs/module/tapestry.coerce.html
>
>
> You could do something like: public abstract List getJavaScripts()
> instead. Is there are a reason your return type is of object?
>
> Its easy to build a list of assets with ognl:{assets.fileOne,
> assets.fileTwo}.
>
> If that does not meet your requirements you will have to make your own
> contribution to tapestry.coerce.IteratorConverters.
>
> Hope that helps.
>
> Jason Suplizio wrote:
>
>> My last note: my application is passing an asset to my Border, which
>> invokes
>> my CustomShell
>> <component id="myAssets" type="MyAssets"/>
>> <component id="border" type="_comps:Border">
>> <binding name="externalScripts" value="ognl:
>> components.myAssets.assets.javascriptFilename"/>
>> </component>
>>
>> In the Border.jwc
>> <parameter name="externalScripts" required="no"/>
>> <component id="shell" type="CustomShell">
>> <binding name="javascript" value="ognl:externalScripts"/>
>> </component>
>>
>> On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
>>
>>> Here's the stack:
>>> Using: org.jfree.chart.encoders.SunPNGEncoderAdapter
>>> org.apache.tapestry.BindingException: Error converting value for
>>> parameter
>>> javascript: No type converter for type org.apache.tapestry.IAsset is
>>> available. [context:/WEB-INF/tapcomps/Border.jwc, line 29, column 55]
>>> at org.apache.tapestry.binding.AbstractBinding.getObject(
>>> AbstractBinding.java:97)
>>> at $CustomShell_80.getJavascript($CustomShell_80.java)
>>> at com.expd.lib.tapestry_v40.components.CustomShell.renderComponent (
>>> CustomShell.java:111)
>>> at $CustomShell_80.renderComponent($CustomShell_80.java)
>>> at
>>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
>>> :617)
>>> at org.apache.tapestry.BaseComponent.renderComponent (
>>> BaseComponent.java:92)
>>> at
>>> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
>>> :617)
>>> at org.apache.tapestry.BaseComponent.renderComponent(
>>> BaseComponent.java:92)
>>> at org.apache.tapestry.AbstractComponent.render (
>>> AbstractComponent.java:617)
>>> at org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:275)
>>> at org.apache.tapestry.engine.RequestCycle.renderPage(
>>> RequestCycle.java:366)
>>> at
>>> org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse (
>>> ResponseRendererImpl.java:71)
>>> at
>>> $ResponseRenderer_108c54f6985.renderResponse($ResponseRenderer_108c54f6985.java)
>>>
>>> at
>>> org.apache.tapestry.engine.PageService.service(PageService.java:68)
>>> at
>>> $IEngineService_108c54f69f8.service($IEngineService_108c54f69f8.java)
>>> at org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(
>>> EngineServiceOuterProxy.java:66)
>>> at org.apache.tapestry.engine.AbstractEngine.service(
>>> AbstractEngine.java:248)
>>> at org.apache.tapestry.services.impl.InvokeEngineTerminator.service (
>>> InvokeEngineTerminator.java:60)
>>> at
>>> $WebRequestServicer_108c54f69cf.service($WebRequestServicer_108c54f69cf.java)
>>>
>>> at org.apache.tapestry.services.impl.DisableCachingFilter.service(
>>> DisableCachingFilter.java:48)
>>> at
>>> $WebRequestServicerFilter_108c54f69d1.service($WebRequestServicerFilter_108c54f69d1.java)
>>>
>>> at
>>> $WebRequestServicer_108c54f69d3.service($WebRequestServicer_108c54f69d3.java)
>>>
>>> at
>>> $WebRequestServicer_108c54f69cb.service($WebRequestServicer_108c54f69cb.java)
>>>
>>>
>>> at
>>> org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service
>>>
>>> (WebRequestServicerPipelineBridge.java:56)
>>> at
>>> $ServletRequestServicer_108c54f69af.service($ServletRequestServicer_108c54f69af.java)
>>>
>>>
>>> at org.apache.tapestry.request.DecodedRequestInjector.service(
>>> DecodedRequestInjector.java:55)
>>> at
>>> $ServletRequestServicerFilter_108c54f69ab.service($ServletRequestServicerFilter_108c54f69ab.java)
>>>
>>> at
>>> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>>>
>>>
>>> at org.apache.tapestry.multipart.MultipartDecoderFilter.service(
>>> MultipartDecoderFilter.java:52)
>>> at
>>> $ServletRequestServicerFilter_108c54f69a9.service($ServletRequestServicerFilter_108c54f69a9.java)
>>>
>>> at
>>> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>>>
>>>
>>> at org.apache.tapestry.services.impl.SetupRequestEncoding.service(
>>> SetupRequestEncoding.java:53)
>>> at
>>> $ServletRequestServicerFilter_108c54f69ad.service($ServletRequestServicerFilter_108c54f69ad.java)
>>>
>>> at
>>> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>>>
>>>
>>> at
>>> $ServletRequestServicer_108c54f69a3.service($ServletRequestServicer_108c54f69a3.java)
>>>
>>> at org.apache.tapestry.ApplicationServlet.doService(
>>> ApplicationServlet.java:123)
>>> at com.expd.app.expo2.webaccess.ExpoTapestryServlet.doService (
>>> ExpoTapestryServlet.java:52)
>>> at org.apache.tapestry.ApplicationServlet.doGet(
>>> ApplicationServlet.java:79)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>>> at javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
>>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>>> ApplicationFilterChain.java:247)
>>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>>> ApplicationFilterChain.java :193)
>>> at org.apache.catalina.core.StandardWrapperValve.invoke(
>>> StandardWrapperValve.java:256)
>>> at
>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>
>>> (StandardPipeline.java:643)
>>> at org.apache.catalina.core.StandardPipeline.invoke(
>>> StandardPipeline.java:480)
>>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
>>> :995)
>>> at org.apache.catalina.core.StandardContextValve.invoke (
>>> StandardContextValve.java:191)
>>> at
>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>
>>> (StandardPipeline.java:643)
>>> at org.apache.catalina.core.StandardPipeline.invoke(
>>> StandardPipeline.java :480)
>>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
>>> :995)
>>> at org.apache.catalina.core.StandardContext.invoke(
>>> StandardContext.java:2422)
>>> at org.apache.catalina.core.StandardHostValve.invoke (
>>> StandardHostValve.java:180)
>>> at
>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>
>>> (StandardPipeline.java:643)
>>> at org.apache.catalina.valves.ErrorDispatcherValve.invoke(
>>> ErrorDispatcherValve.java :171)
>>> at
>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>
>>> (StandardPipeline.java:641)
>>> at org.apache.catalina.valves.ErrorReportValve.invoke(
>>> ErrorReportValve.java:163)
>>> at
>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>
>>> (StandardPipeline.java:641)
>>> at org.apache.catalina.core.StandardPipeline.invoke(
>>> StandardPipeline.java:480)
>>> at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java
>>> :995)
>>> at org.apache.catalina.core.StandardEngineValve.invoke(
>>> StandardEngineValve.java:174)
>>> at
>>> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>>
>>> (StandardPipeline.java :643)
>>> at org.apache.catalina.core.StandardPipeline.invoke(
>>> StandardPipeline.java:480)
>>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
>>> :995)
>>> at org.apache.coyote.tomcat4.CoyoteAdapter.service
>>> (CoyoteAdapter.java
>>> :199)
>>> at org.apache.coyote.http11.Http11Processor.process(
>>> Http11Processor.java:828)
>>> at
>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
>>>
>>> (Http11Protocol.java :700)
>>> at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
>>> PoolTcpEndpoint.java:584)
>>> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
>>> ThreadPool.java:683)
>>> at java.lang.Thread.run(Unknown Source)
>>> Caused by: org.apache.hivemind.ApplicationRuntimeException: No type
>>> converter for type org.apache.tapestry.IAsset is available.
>>> at org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(
>>> ValueConverterImpl.java :105)
>>> at
>>> $ValueConverter_108c54f6957.coerceValue($ValueConverter_108c54f6957.java)
>>>
>>> at org.apache.tapestry.binding.AbstractBinding.getObject(
>>> AbstractBinding.java:91)
>>> ... 68 more
>>>
>>> On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
>>>
>>>> Hi!
>>>> I've created a customized version of the Shell
>>>> component...essentially I
>>>> want to to extend the handling of stylesheet assets to javascripts
>>>> (write
>>>> <script> tags embedded in the <head > element).
>>>> CustomShell.java adds to the original:
>>>>
>>>> public abstract IAsset getJavascript();
>>>> public abstract Object getJavascripts();
>>>>
>>>> public void renderComponent(IMarkupWriter writer, IRequestCycle
>>>> cycle) {
>>>> /** added the following **/
>>>> IAsset javascript = getJavascript();
>>>>
>>>> if (javascript != null)
>>>> writeJavascriptScript(writer, cycle, javascript);
>>>>
>>>> Iterator scripts = (Iterator)
>>>> getValueConverter().coerceValue(
>>>> getJavascripts(),
>>>> Iterator.class);
>>>>
>>>> while (scripts.hasNext())
>>>> {
>>>> javascript = (IAsset) i.next();
>>>>
>>>> writeJavascriptScript(writer, cycle, javascript);
>>>> }
>>>> }
>>>> private void writeJavascriptScript(IMarkupWriter writer,
>>>> IRequestCycle cycle, IAsset javascript)
>>>> {
>>>> writer.beginEmpty("script");
>>>> writer.attribute("type", "text/javascript");
>>>> writer.attribute("src", javascript.buildURL());
>>>> writer.closeTag();
>>>> writer.println();
>>>> }
>>>>
>>>> CustomShell.jwc adds these to the original:
>>>> <parameter name="javascript">
>>>> <description>
>>>> If specified, provides an external javascript for the page.
>>>> </description>
>>>> </parameter>
>>>>
>>>> <parameter name="javascripts">
>>>> <description>
>>>> Array or collection of stylesheet assets.
>>>> </description>
>>>> </parameter>
>>>>
>>>>
>>>> However, this isn't working as I'm running into a ValueConverter issue:
>>>>
>>>> Exception: "org.apache.hivemind.ApplicationRuntimeException: No type
>>>> converter for type org.apache.tapestry.IAsset is available.
>>>>
>>>> Borrowing from the Shell.jwc file, I notice that the following service
>>>> is injected - which apparently implements
>>>> org.apache.tapestry.coerce.ValueConverterImpl
>>>>
>>>> <inject property="valueConverter" object="service:
>>>> tapestry.coerce.ValueConverter"/>
>>>>
>>>> What do I need to do to get my custom shell comp to render the script
>>>> assets? Thanks in advance!
>>>> Jason
>>>>
>>>>
>>>
>>
>
>
--
.........................................
Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com
Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: service:tapestry.coerce.ValueConverter
Posted by Derick Fernando <de...@thelabllc.com>.
Hello,
Whats happening here is that tapestry needs to know how to convert
whatever is returned by getJavaScripts() into an iterator. So take a
look at:
http://jakarta.apache.org/tapestry/tapestry/hivedocs/module/tapestry.coerce.html
You could do something like: public abstract List getJavaScripts()
instead. Is there are a reason your return type is of object?
Its easy to build a list of assets with ognl:{assets.fileOne,
assets.fileTwo}.
If that does not meet your requirements you will have to make your own
contribution to tapestry.coerce.IteratorConverters.
Hope that helps.
Jason Suplizio wrote:
> My last note: my application is passing an asset to my Border, which invokes
> my CustomShell
> <component id="myAssets" type="MyAssets"/>
> <component id="border" type="_comps:Border">
> <binding name="externalScripts" value="ognl:
> components.myAssets.assets.javascriptFilename"/>
> </component>
>
> In the Border.jwc
> <parameter name="externalScripts" required="no"/>
> <component id="shell" type="CustomShell">
> <binding name="javascript" value="ognl:externalScripts"/>
> </component>
>
> On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
>
>>Here's the stack:
>>Using: org.jfree.chart.encoders.SunPNGEncoderAdapter
>>org.apache.tapestry.BindingException: Error converting value for parameter
>>javascript: No type converter for type org.apache.tapestry.IAsset is
>>available. [context:/WEB-INF/tapcomps/Border.jwc, line 29, column 55]
>> at org.apache.tapestry.binding.AbstractBinding.getObject(
>>AbstractBinding.java:97)
>> at $CustomShell_80.getJavascript($CustomShell_80.java)
>> at com.expd.lib.tapestry_v40.components.CustomShell.renderComponent (
>>CustomShell.java:111)
>> at $CustomShell_80.renderComponent($CustomShell_80.java)
>> at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
>>:617)
>> at org.apache.tapestry.BaseComponent.renderComponent (
>>BaseComponent.java:92)
>> at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
>>:617)
>> at org.apache.tapestry.BaseComponent.renderComponent(
>>BaseComponent.java:92)
>> at org.apache.tapestry.AbstractComponent.render (
>>AbstractComponent.java:617)
>> at org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:275)
>> at org.apache.tapestry.engine.RequestCycle.renderPage(
>>RequestCycle.java:366)
>> at
>>org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse (
>>ResponseRendererImpl.java:71)
>> at
>>$ResponseRenderer_108c54f6985.renderResponse($ResponseRenderer_108c54f6985.java)
>> at org.apache.tapestry.engine.PageService.service(PageService.java:68)
>> at
>>$IEngineService_108c54f69f8.service($IEngineService_108c54f69f8.java)
>> at org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(
>>EngineServiceOuterProxy.java:66)
>> at org.apache.tapestry.engine.AbstractEngine.service(
>>AbstractEngine.java:248)
>> at org.apache.tapestry.services.impl.InvokeEngineTerminator.service (
>>InvokeEngineTerminator.java:60)
>> at
>>$WebRequestServicer_108c54f69cf.service($WebRequestServicer_108c54f69cf.java)
>> at org.apache.tapestry.services.impl.DisableCachingFilter.service(
>>DisableCachingFilter.java:48)
>> at
>>$WebRequestServicerFilter_108c54f69d1.service($WebRequestServicerFilter_108c54f69d1.java)
>> at
>>$WebRequestServicer_108c54f69d3.service($WebRequestServicer_108c54f69d3.java)
>> at
>>$WebRequestServicer_108c54f69cb.service($WebRequestServicer_108c54f69cb.java)
>>
>> at
>>org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service
>>(WebRequestServicerPipelineBridge.java:56)
>> at
>>$ServletRequestServicer_108c54f69af.service($ServletRequestServicer_108c54f69af.java)
>>
>> at org.apache.tapestry.request.DecodedRequestInjector.service(
>>DecodedRequestInjector.java:55)
>> at
>>$ServletRequestServicerFilter_108c54f69ab.service($ServletRequestServicerFilter_108c54f69ab.java)
>> at
>>$ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>>
>> at org.apache.tapestry.multipart.MultipartDecoderFilter.service(
>>MultipartDecoderFilter.java:52)
>> at
>>$ServletRequestServicerFilter_108c54f69a9.service($ServletRequestServicerFilter_108c54f69a9.java)
>> at
>>$ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>>
>> at org.apache.tapestry.services.impl.SetupRequestEncoding.service(
>>SetupRequestEncoding.java:53)
>> at
>>$ServletRequestServicerFilter_108c54f69ad.service($ServletRequestServicerFilter_108c54f69ad.java)
>> at
>>$ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>>
>> at
>>$ServletRequestServicer_108c54f69a3.service($ServletRequestServicer_108c54f69a3.java)
>> at org.apache.tapestry.ApplicationServlet.doService(
>>ApplicationServlet.java:123)
>> at com.expd.app.expo2.webaccess.ExpoTapestryServlet.doService (
>>ExpoTapestryServlet.java:52)
>> at org.apache.tapestry.ApplicationServlet.doGet(
>>ApplicationServlet.java:79)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>> at javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>>ApplicationFilterChain.java:247)
>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>>ApplicationFilterChain.java :193)
>> at org.apache.catalina.core.StandardWrapperValve.invoke(
>>StandardWrapperValve.java:256)
>> at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>(StandardPipeline.java:643)
>> at org.apache.catalina.core.StandardPipeline.invoke(
>>StandardPipeline.java:480)
>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
>>:995)
>> at org.apache.catalina.core.StandardContextValve.invoke (
>>StandardContextValve.java:191)
>> at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>(StandardPipeline.java:643)
>> at org.apache.catalina.core.StandardPipeline.invoke(
>>StandardPipeline.java :480)
>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
>>:995)
>> at org.apache.catalina.core.StandardContext.invoke(
>>StandardContext.java:2422)
>> at org.apache.catalina.core.StandardHostValve.invoke (
>>StandardHostValve.java:180)
>> at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>(StandardPipeline.java:643)
>> at org.apache.catalina.valves.ErrorDispatcherValve.invoke(
>>ErrorDispatcherValve.java :171)
>> at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>(StandardPipeline.java:641)
>> at org.apache.catalina.valves.ErrorReportValve.invoke(
>>ErrorReportValve.java:163)
>> at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>(StandardPipeline.java:641)
>> at org.apache.catalina.core.StandardPipeline.invoke(
>>StandardPipeline.java:480)
>> at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java
>>:995)
>> at org.apache.catalina.core.StandardEngineValve.invoke(
>>StandardEngineValve.java:174)
>> at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
>>(StandardPipeline.java :643)
>> at org.apache.catalina.core.StandardPipeline.invoke(
>>StandardPipeline.java:480)
>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
>>:995)
>> at org.apache.coyote.tomcat4.CoyoteAdapter.service (CoyoteAdapter.java
>>:199)
>> at org.apache.coyote.http11.Http11Processor.process(
>>Http11Processor.java:828)
>> at
>>org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
>>(Http11Protocol.java :700)
>> at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
>>PoolTcpEndpoint.java:584)
>> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
>>ThreadPool.java:683)
>> at java.lang.Thread.run(Unknown Source)
>>Caused by: org.apache.hivemind.ApplicationRuntimeException: No type
>>converter for type org.apache.tapestry.IAsset is available.
>> at org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(
>>ValueConverterImpl.java :105)
>> at
>>$ValueConverter_108c54f6957.coerceValue($ValueConverter_108c54f6957.java)
>> at org.apache.tapestry.binding.AbstractBinding.getObject(
>>AbstractBinding.java:91)
>> ... 68 more
>>
>>On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
>>
>>>Hi!
>>>I've created a customized version of the Shell component...essentially I
>>>want to to extend the handling of stylesheet assets to javascripts (write
>>><script> tags embedded in the <head > element).
>>>CustomShell.java adds to the original:
>>>
>>> public abstract IAsset getJavascript();
>>> public abstract Object getJavascripts();
>>>
>>>public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
>>>/** added the following **/
>>> IAsset javascript = getJavascript();
>>>
>>> if (javascript != null)
>>> writeJavascriptScript(writer, cycle, javascript);
>>>
>>> Iterator scripts = (Iterator)
>>>getValueConverter().coerceValue(
>>> getJavascripts(),
>>> Iterator.class);
>>>
>>> while (scripts.hasNext())
>>> {
>>> javascript = (IAsset) i.next();
>>>
>>> writeJavascriptScript(writer, cycle, javascript);
>>> }
>>>}
>>> private void writeJavascriptScript(IMarkupWriter writer,
>>>IRequestCycle cycle, IAsset javascript)
>>> {
>>> writer.beginEmpty("script");
>>> writer.attribute("type", "text/javascript");
>>> writer.attribute("src", javascript.buildURL());
>>> writer.closeTag();
>>> writer.println();
>>> }
>>>
>>>CustomShell.jwc adds these to the original:
>>> <parameter name="javascript">
>>> <description>
>>> If specified, provides an external javascript for the page.
>>> </description>
>>> </parameter>
>>>
>>> <parameter name="javascripts">
>>> <description>
>>> Array or collection of stylesheet assets.
>>> </description>
>>> </parameter>
>>>
>>>
>>>However, this isn't working as I'm running into a ValueConverter issue:
>>>
>>>Exception: "org.apache.hivemind.ApplicationRuntimeException: No type
>>>converter for type org.apache.tapestry.IAsset is available.
>>>
>>>Borrowing from the Shell.jwc file, I notice that the following service
>>>is injected - which apparently implements
>>>org.apache.tapestry.coerce.ValueConverterImpl
>>>
>>> <inject property="valueConverter" object="service:
>>>tapestry.coerce.ValueConverter"/>
>>>
>>>What do I need to do to get my custom shell comp to render the script
>>>assets? Thanks in advance!
>>>Jason
>>>
>>>
>>
>
--
.........................................
Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com
Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: service:tapestry.coerce.ValueConverter
Posted by Jason Suplizio <su...@gmail.com>.
My last note: my application is passing an asset to my Border, which invokes
my CustomShell
<component id="myAssets" type="MyAssets"/>
<component id="border" type="_comps:Border">
<binding name="externalScripts" value="ognl:
components.myAssets.assets.javascriptFilename"/>
</component>
In the Border.jwc
<parameter name="externalScripts" required="no"/>
<component id="shell" type="CustomShell">
<binding name="javascript" value="ognl:externalScripts"/>
</component>
On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
>
> Here's the stack:
> Using: org.jfree.chart.encoders.SunPNGEncoderAdapter
> org.apache.tapestry.BindingException: Error converting value for parameter
> javascript: No type converter for type org.apache.tapestry.IAsset is
> available. [context:/WEB-INF/tapcomps/Border.jwc, line 29, column 55]
> at org.apache.tapestry.binding.AbstractBinding.getObject(
> AbstractBinding.java:97)
> at $CustomShell_80.getJavascript($CustomShell_80.java)
> at com.expd.lib.tapestry_v40.components.CustomShell.renderComponent (
> CustomShell.java:111)
> at $CustomShell_80.renderComponent($CustomShell_80.java)
> at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> :617)
> at org.apache.tapestry.BaseComponent.renderComponent (
> BaseComponent.java:92)
> at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
> :617)
> at org.apache.tapestry.BaseComponent.renderComponent(
> BaseComponent.java:92)
> at org.apache.tapestry.AbstractComponent.render (
> AbstractComponent.java:617)
> at org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:275)
> at org.apache.tapestry.engine.RequestCycle.renderPage(
> RequestCycle.java:366)
> at
> org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse (
> ResponseRendererImpl.java:71)
> at
> $ResponseRenderer_108c54f6985.renderResponse($ResponseRenderer_108c54f6985.java)
> at org.apache.tapestry.engine.PageService.service(PageService.java:68)
> at
> $IEngineService_108c54f69f8.service($IEngineService_108c54f69f8.java)
> at org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(
> EngineServiceOuterProxy.java:66)
> at org.apache.tapestry.engine.AbstractEngine.service(
> AbstractEngine.java:248)
> at org.apache.tapestry.services.impl.InvokeEngineTerminator.service (
> InvokeEngineTerminator.java:60)
> at
> $WebRequestServicer_108c54f69cf.service($WebRequestServicer_108c54f69cf.java)
> at org.apache.tapestry.services.impl.DisableCachingFilter.service(
> DisableCachingFilter.java:48)
> at
> $WebRequestServicerFilter_108c54f69d1.service($WebRequestServicerFilter_108c54f69d1.java)
> at
> $WebRequestServicer_108c54f69d3.service($WebRequestServicer_108c54f69d3.java)
> at
> $WebRequestServicer_108c54f69cb.service($WebRequestServicer_108c54f69cb.java)
>
> at
> org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service
> (WebRequestServicerPipelineBridge.java:56)
> at
> $ServletRequestServicer_108c54f69af.service($ServletRequestServicer_108c54f69af.java)
>
> at org.apache.tapestry.request.DecodedRequestInjector.service(
> DecodedRequestInjector.java:55)
> at
> $ServletRequestServicerFilter_108c54f69ab.service($ServletRequestServicerFilter_108c54f69ab.java)
> at
> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>
> at org.apache.tapestry.multipart.MultipartDecoderFilter.service(
> MultipartDecoderFilter.java:52)
> at
> $ServletRequestServicerFilter_108c54f69a9.service($ServletRequestServicerFilter_108c54f69a9.java)
> at
> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>
> at org.apache.tapestry.services.impl.SetupRequestEncoding.service(
> SetupRequestEncoding.java:53)
> at
> $ServletRequestServicerFilter_108c54f69ad.service($ServletRequestServicerFilter_108c54f69ad.java)
> at
> $ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
>
> at
> $ServletRequestServicer_108c54f69a3.service($ServletRequestServicer_108c54f69a3.java)
> at org.apache.tapestry.ApplicationServlet.doService(
> ApplicationServlet.java:123)
> at com.expd.app.expo2.webaccess.ExpoTapestryServlet.doService (
> ExpoTapestryServlet.java:52)
> at org.apache.tapestry.ApplicationServlet.doGet(
> ApplicationServlet.java:79)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:247)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java :193)
> at org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:256)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> (StandardPipeline.java:643)
> at org.apache.catalina.core.StandardPipeline.invoke(
> StandardPipeline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
> :995)
> at org.apache.catalina.core.StandardContextValve.invoke (
> StandardContextValve.java:191)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> (StandardPipeline.java:643)
> at org.apache.catalina.core.StandardPipeline.invoke(
> StandardPipeline.java :480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
> :995)
> at org.apache.catalina.core.StandardContext.invoke(
> StandardContext.java:2422)
> at org.apache.catalina.core.StandardHostValve.invoke (
> StandardHostValve.java:180)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> (StandardPipeline.java:643)
> at org.apache.catalina.valves.ErrorDispatcherValve.invoke(
> ErrorDispatcherValve.java :171)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> (StandardPipeline.java:641)
> at org.apache.catalina.valves.ErrorReportValve.invoke(
> ErrorReportValve.java:163)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> (StandardPipeline.java:641)
> at org.apache.catalina.core.StandardPipeline.invoke(
> StandardPipeline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke (ContainerBase.java
> :995)
> at org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:174)
> at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
> (StandardPipeline.java :643)
> at org.apache.catalina.core.StandardPipeline.invoke(
> StandardPipeline.java:480)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
> :995)
> at org.apache.coyote.tomcat4.CoyoteAdapter.service (CoyoteAdapter.java
> :199)
> at org.apache.coyote.http11.Http11Processor.process(
> Http11Processor.java:828)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
> (Http11Protocol.java :700)
> at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
> PoolTcpEndpoint.java:584)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:683)
> at java.lang.Thread.run(Unknown Source)
> Caused by: org.apache.hivemind.ApplicationRuntimeException: No type
> converter for type org.apache.tapestry.IAsset is available.
> at org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(
> ValueConverterImpl.java :105)
> at
> $ValueConverter_108c54f6957.coerceValue($ValueConverter_108c54f6957.java)
> at org.apache.tapestry.binding.AbstractBinding.getObject(
> AbstractBinding.java:91)
> ... 68 more
>
> On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
> >
> > Hi!
> > I've created a customized version of the Shell component...essentially I
> > want to to extend the handling of stylesheet assets to javascripts (write
> > <script> tags embedded in the <head > element).
> > CustomShell.java adds to the original:
> >
> > public abstract IAsset getJavascript();
> > public abstract Object getJavascripts();
> >
> > public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
> > /** added the following **/
> > IAsset javascript = getJavascript();
> >
> > if (javascript != null)
> > writeJavascriptScript(writer, cycle, javascript);
> >
> > Iterator scripts = (Iterator)
> > getValueConverter().coerceValue(
> > getJavascripts(),
> > Iterator.class);
> >
> > while (scripts.hasNext())
> > {
> > javascript = (IAsset) i.next();
> >
> > writeJavascriptScript(writer, cycle, javascript);
> > }
> > }
> > private void writeJavascriptScript(IMarkupWriter writer,
> > IRequestCycle cycle, IAsset javascript)
> > {
> > writer.beginEmpty("script");
> > writer.attribute("type", "text/javascript");
> > writer.attribute("src", javascript.buildURL());
> > writer.closeTag();
> > writer.println();
> > }
> >
> > CustomShell.jwc adds these to the original:
> > <parameter name="javascript">
> > <description>
> > If specified, provides an external javascript for the page.
> > </description>
> > </parameter>
> >
> > <parameter name="javascripts">
> > <description>
> > Array or collection of stylesheet assets.
> > </description>
> > </parameter>
> >
> >
> > However, this isn't working as I'm running into a ValueConverter issue:
> >
> > Exception: "org.apache.hivemind.ApplicationRuntimeException: No type
> > converter for type org.apache.tapestry.IAsset is available.
> >
> > Borrowing from the Shell.jwc file, I notice that the following service
> > is injected - which apparently implements
> > org.apache.tapestry.coerce.ValueConverterImpl
> >
> > <inject property="valueConverter" object="service:
> > tapestry.coerce.ValueConverter"/>
> >
> > What do I need to do to get my custom shell comp to render the script
> > assets? Thanks in advance!
> > Jason
> >
> >
>
Re: service:tapestry.coerce.ValueConverter
Posted by Jason Suplizio <su...@gmail.com>.
Here's the stack:
Using: org.jfree.chart.encoders.SunPNGEncoderAdapter
org.apache.tapestry.BindingException: Error converting value for parameter
javascript: No type converter for type org.apache.tapestry.IAsset is
available. [context:/WEB-INF/tapcomps/Border.jwc, line 29, column 55]
at org.apache.tapestry.binding.AbstractBinding.getObject(
AbstractBinding.java:97)
at $CustomShell_80.getJavascript($CustomShell_80.java)
at com.expd.lib.tapestry_v40.components.CustomShell.renderComponent(
CustomShell.java:111)
at $CustomShell_80.renderComponent($CustomShell_80.java)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
:617)
at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java
:92)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
:617)
at org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java
:92)
at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java
:617)
at org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:275)
at org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java
:366)
at org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse
(ResponseRendererImpl.java:71)
at
$ResponseRenderer_108c54f6985.renderResponse($ResponseRenderer_108c54f6985.java)
at org.apache.tapestry.engine.PageService.service(PageService.java:68)
at $IEngineService_108c54f69f8.service($IEngineService_108c54f69f8.java)
at org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(
EngineServiceOuterProxy.java:66)
at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java
:248)
at org.apache.tapestry.services.impl.InvokeEngineTerminator.service(
InvokeEngineTerminator.java:60)
at
$WebRequestServicer_108c54f69cf.service($WebRequestServicer_108c54f69cf.java)
at org.apache.tapestry.services.impl.DisableCachingFilter.service(
DisableCachingFilter.java:48)
at
$WebRequestServicerFilter_108c54f69d1.service($WebRequestServicerFilter_108c54f69d1.java)
at
$WebRequestServicer_108c54f69d3.service($WebRequestServicer_108c54f69d3.java)
at
$WebRequestServicer_108c54f69cb.service($WebRequestServicer_108c54f69cb.java)
at
org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(
WebRequestServicerPipelineBridge.java:56)
at
$ServletRequestServicer_108c54f69af.service($ServletRequestServicer_108c54f69af.java)
at org.apache.tapestry.request.DecodedRequestInjector.service(
DecodedRequestInjector.java:55)
at
$ServletRequestServicerFilter_108c54f69ab.service($ServletRequestServicerFilter_108c54f69ab.java)
at
$ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
at org.apache.tapestry.multipart.MultipartDecoderFilter.service(
MultipartDecoderFilter.java:52)
at
$ServletRequestServicerFilter_108c54f69a9.service($ServletRequestServicerFilter_108c54f69a9.java)
at
$ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
at org.apache.tapestry.services.impl.SetupRequestEncoding.service(
SetupRequestEncoding.java:53)
at
$ServletRequestServicerFilter_108c54f69ad.service($ServletRequestServicerFilter_108c54f69ad.java)
at
$ServletRequestServicer_108c54f69b1.service($ServletRequestServicer_108c54f69b1.java)
at
$ServletRequestServicer_108c54f69a3.service($ServletRequestServicer_108c54f69a3.java)
at org.apache.tapestry.ApplicationServlet.doService(
ApplicationServlet.java:123)
at com.expd.app.expo2.webaccess.ExpoTapestryServlet.doService(
ExpoTapestryServlet.java:52)
at org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java
:79)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java
:2422)
at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(
ErrorDispatcherValve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:163)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext
(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java
:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:828)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.hivemind.ApplicationRuntimeException: No type
converter for type org.apache.tapestry.IAsset is available.
at org.apache.tapestry.coerce.ValueConverterImpl.coerceValue(
ValueConverterImpl.java:105)
at
$ValueConverter_108c54f6957.coerceValue($ValueConverter_108c54f6957.java)
at org.apache.tapestry.binding.AbstractBinding.getObject(
AbstractBinding.java:91)
... 68 more
On 1/13/06, Jason Suplizio <su...@gmail.com> wrote:
>
> Hi!
> I've created a customized version of the Shell component...essentially I
> want to to extend the handling of stylesheet assets to javascripts (write
> <script> tags embedded in the <head > element).
> CustomShell.java adds to the original:
>
> public abstract IAsset getJavascript();
> public abstract Object getJavascripts();
>
> public void renderComponent(IMarkupWriter writer, IRequestCycle cycle) {
> /** added the following **/
> IAsset javascript = getJavascript();
>
> if (javascript != null)
> writeJavascriptScript(writer, cycle, javascript);
>
> Iterator scripts = (Iterator) getValueConverter().coerceValue(
>
> getJavascripts(),
> Iterator.class);
>
> while (scripts.hasNext())
> {
> javascript = (IAsset) i.next();
>
> writeJavascriptScript(writer, cycle, javascript);
> }
> }
> private void writeJavascriptScript(IMarkupWriter writer, IRequestCycle
> cycle, IAsset javascript)
> {
> writer.beginEmpty("script");
> writer.attribute("type", "text/javascript");
> writer.attribute("src", javascript.buildURL());
> writer.closeTag();
> writer.println();
> }
>
> CustomShell.jwc adds these to the original:
> <parameter name="javascript">
> <description>
> If specified, provides an external javascript for the page.
> </description>
> </parameter>
>
> <parameter name="javascripts">
> <description>
> Array or collection of stylesheet assets.
> </description>
> </parameter>
>
>
> However, this isn't working as I'm running into a ValueConverter issue:
>
> Exception: "org.apache.hivemind.ApplicationRuntimeException: No type
> converter for type org.apache.tapestry.IAsset is available.
>
> Borrowing from the Shell.jwc file, I notice that the following service is
> injected - which apparently implements
> org.apache.tapestry.coerce.ValueConverterImpl
>
> <inject property="valueConverter" object="service:
> tapestry.coerce.ValueConverter"/>
>
> What do I need to do to get my custom shell comp to render the script
> assets? Thanks in advance!
> Jason
>
>