Oh dang.
Thanks - I commented out that cookie line, and checked the prerender
method...  and Woah! the call to delete the cookie was already there.
I guess it got left behind when it wasn't working when it was first
coded in the destroy.

Thanks for all your help Craig.  Your consistent, and rapid, support
is GREATLY appreciated.

Cheers,
Jason


On 10/31/06, Craig McClanahan <[EMAIL PROTECTED]> wrote:
On 10/31/06, Jason Vincent <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I'm currently upgrading my shale version from a nightly build back in
> January, to version 1.0.3.
>
> In my destory method, when I call getExternalContext() I get a NPE.
>
> java.lang.NullPointerException
>         at org.apache.shale.view.AbstractFacesBean.getExternalContext(
> AbstractFacesBean.java:77)
>
> I need the externalContext to get a hold of the response so that I can
> delete a cookie, if needed. I also use the session and request to log
> some metrics, which also comes from the ExternalContext.
>
> Any Ideas?


Unfortunately, destroy is called after the JSF response lifecycle has been
completed, so there is no more ExternalContext at that point :-(.

However, even if there was, I don't think it would do you much good.  Since
destroy is called after rendering, the response will have already been
"committed" (in the servlet sense), including the HTTP headers that include
your cookies.  So, you would not be able to delete a cookie then anyway.
I'd recommend trying this in prerender(), where you know you can get to the
response object before the headers have been sent.


THANKS.
> Jason
>

Craig


Reply via email to