You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org> on 2005/11/20 16:48:25 UTC

[jira] Updated: (TAPESTRY-763) RequestCycle is not available during page initialization

     [ http://issues.apache.org/jira/browse/TAPESTRY-763?page=all ]

Howard M. Lewis Ship updated TAPESTRY-763:
------------------------------------------

    Assign To: Howard M. Lewis Ship

I think it is a mistake to make any finishLoad() logic dependent on the IRequestyCycle, however

- It worked in Tapestry 3.0
- You can inject the IRequestCycle if you really want to

So I'm changing the order of operations so that the page is attached just after it is instantiated, but before its components are loaded, etc.  Long before finishLoad() is invoked.

> RequestCycle is not available during page initialization
> --------------------------------------------------------
>
>          Key: TAPESTRY-763
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-763
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Mike Perham
>     Assignee: Howard M. Lewis Ship

>
> I have a page with a property defined as such:
> 	<property name="query" initial-value="spring('resourceQuery')" />
> This was my simple way to inject Spring services in 3.0 pages.  This just uses the requestcycle to get access to the ServletContext and look up the named bean in the Spring Context associated with the ServletContext.  Unfortunately it looks like AbstractPage.getRequestCycle() is returning null when the page is being constructed.
> java.lang.NullPointerException
> # com.webify.framework.bsc.BscPage.getCurrentServletContext(BscPage.java:145)
> # com.webify.framework.bsc.BscPage.getSpringContext(BscPage.java:137)
> # com.webify.framework.bsc.BscPage.spring(BscPage.java:66)
> # sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> # sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
> # sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
> # sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
> # java.lang.reflect.Method.invoke(Method.java(Compiled Code))
> # ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:491)
> # ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:785)
> # ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:61)
> # ognl.OgnlRuntime.callMethod(OgnlRuntime.java:819)
> # ognl.ASTMethod.getValueBody(ASTMethod.java:75)
> # ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
> # ognl.SimpleNode.getValue(SimpleNode.java:210)
> # ognl.Ognl.getValue(Ognl.java:333)
> # ognl.Ognl.getValue(Ognl.java:310)
> # org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.readCompiled(ExpressionEvaluatorImpl.java:91)
> # $ExpressionEvaluator_107a1397f6e.readCompiled($ExpressionEvaluator_107a1397f6e.java)
> # org.apache.tapestry.binding.ExpressionBinding.resolveExpression(ExpressionBinding.java:110)
> # org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.java:103)
> # org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:87)
> # $SearchPage_25.finishLoad($SearchPage_25.java)
> # org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:424)
> # org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:593)
> # $IPageLoader_107a1397f01.loadPage($IPageLoader_107a1397f01.java)
> # $IPageLoader_107a1397f02.loadPage($IPageLoader_107a1397f02.java)
> # org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:118)
> # $IPageSource_107a1397e6d.getPage($IPageSource_107a1397e6d.java)
> # org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:265)
> # org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:248)
> # org.apache.tapestry.engine.RequestCycle.activate(RequestCycle.java:609)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org