Re: ServletUnitServletContext
Adam Hardy <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Russell Gold on 02/04/08 13:06, wrote:
> On Apr 2, 2008, at 6:55 AM, Adam Hardy wrote:
>
>> The problem occurs when the ServletRunner invokes Tiles. Tiles tries
>> to retrieve
>> its config from the ServletContext, but the ServletUnitServletContext
>> implementation from ServletUnit has package default access modifier
>> so this call
>> fails:
>>
>> private static Object getAttribute(Object context, String
>> attributeName) {
>> try {
>> Class<?> contextClass = context.getClass();
>> Method attrMethod = contextClass.getMethod("getAttribute",
>> String.class);
>> return attrMethod.invoke(context, attributeName);
>> } catch (Exception e) {
>> LOG.warn("Unable to retrieve container from specified
>> context: '" +
>> context + "'", e);
>> return null;
>> }
>> }
>
> I'm a bit confused. Why aren't you simply calling the getAttribute()
> method directly without reflection?
That would be a Tiles issue. I assume, because the context is passed in as an
object, that there are other scenarios with other frameworks that Tiles deals
with by reflection on the implementation rather than the interface.
I was in touch with the Tiles guys and sent them a link to this thread, so maybe
they'll comment.
regards
Adam
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace