You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Geoff Longman <gl...@intelligentworks.com> on 2003/08/15 17:56:51 UTC

Test after blackout

Sorry for the noise. I assume that the mailing list bounced stuff while I
was blacked out and may have unsubscribed me. So I'm checking.

Geoff

Geoffrey Longman
Intelligent Works Inc.



RE: Any way to get ServletContext at time 'property-specifications' are processed?

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
> @com.interface21.web.context.support.WebApplicationContextUtil
> s@getWebApplicationContext(requestCycle.requestContext.applica
> tionServlet.servletContext)
> 
> but unfortunately it doesn't work, since at the time 
> property-specifications are processed, requestCycle's requestContext 
> field is still null.
> 

That doesn't sound right; the requestCycle was probably null.

I was looking for a way to make this work; it will require changes to allow you to gain access the
requestcycle or requestcontext earlier.  Basically, the page is only attached to the engine and
request cycle after it is fully constructed, and that's after default values for specified
properties are set.

Please add a bug.  



Any way to get ServletContext at time 'property-specifications' are processed?

Posted by Colin Sampaleanu <co...@exis.com>.
Can anybody think of a way to the get ServletContext at the time that a 
page's <property-specification> elements are processed?

In the property-specification, I need to have an OGNL expression which 
calls a static member of a class, and feeds it the ServletContext, to 
get back a bean reference in return. Now I tried this for the expression:
    
@com.interface21.web.context.support.WebApplicationContextUtils@getWebApplicationContext(requestCycle.requestContext.applicationServlet.servletContext)

but unfortunately it doesn't work, since at the time 
property-specifications are processed, requestCycle's requestContext 
field is still null.

What I have done instead is overriden the Engine class, and stuck a 
reference to what I need in a global object, as follows:

  public static final String APPLICATION_CONTEXT_KEY = "appContext";
  protected void setupForRequest(RequestContext context) {
    super.setupForRequest(context);
   
    // insert ApplicationContext in global, if not there
    Map global = (Map) getGlobal();
    ApplicationContext ac = (ApplicationContext) 
global.get(APPLICATION_CONTEXT_KEY);
    if (ac == null) {
      ac = 
WebApplicationContextUtils.getWebApplicationContext(context.getServlet().getServletContext());
      global.put(APPLICATION_CONTEXT_KEY, ac);
    }
  }

and then in the property specification I use an OGNL expression like:

    global.appContext.getBean("myMapper")

This works, but what I don't like about this approach is that I have to 
have a custom Engine class, and have to use the Global. I guess it's not 
that big a deal, but I would still like to know if anybody can think of 
a way to get the ServletContext through OGNL at that time...

Regards,

Colin







Re: Test after blackout

Posted by Geoff Longman <gl...@intelligentworks.com>.
Har Har. I'm glad I have a generator for the homestead so I didn't have to
worry about the family.

We ended up camping out in the office thursday night 'cuz loss of power
meant the building was unlocked and there have been breakins in the building
lately. (As of friday the locks/security system are on a backup battery
system). There was looting about 500 meters from the building so it was a
little stressful. (BTW the looting made CNN
http://www.cnn.com/2003/WORLD/americas/08/15/power.canada.looting.reut/).

Gasoline? I wish. No electricity = no gas stations bud. We did happen to
have a 12 pack of Bud in the fridge though.

Geoff
----- Original Message -----
From: "Howard M. Lewis Ship" <hl...@comcast.net>
To: "'Tapestry development'" <ta...@jakarta.apache.org>
Sent: Saturday, August 16, 2003 7:55 AM
Subject: RE: Test after blackout


> Geoff,
>
> If you're drinking so hard you're having blackouts, it's time to get some
real help.  Think about
> your family, man.
>
> Also, smokers should never, EVER, huff gasoline.  Your going to go up like
one of those Vietnam
> war-protesting monks.
>
> --
> Howard M. Lewis Ship
> Creator, Tapestry: Java Web Components
> http://jakarta.apache.org/tapestry
>
>
>
> > -----Original Message-----
> > From: Geoff Longman [mailto:glongman@intelligentworks.com]
> > Sent: Friday, August 15, 2003 11:57 AM
> > To: Tapestry development; Tapestry users
> > Subject: Test after blackout
> >
> >
> > Sorry for the noise. I assume that the mailing list bounced
> > stuff while I was blacked out and may have unsubscribed me.
> > So I'm checking.
> >
> > Geoff
> >
> > Geoffrey Longman
> > Intelligent Works Inc.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
>


RE: Test after blackout

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Geoff,

If you're drinking so hard you're having blackouts, it's time to get some real help.  Think about
your family, man.

Also, smokers should never, EVER, huff gasoline.  Your going to go up like one of those Vietnam
war-protesting monks.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Geoff Longman [mailto:glongman@intelligentworks.com] 
> Sent: Friday, August 15, 2003 11:57 AM
> To: Tapestry development; Tapestry users
> Subject: Test after blackout
> 
> 
> Sorry for the noise. I assume that the mailing list bounced 
> stuff while I was blacked out and may have unsubscribed me. 
> So I'm checking.
> 
> Geoff
> 
> Geoffrey Longman
> Intelligent Works Inc.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
>