Re: ServletUnitServletContext
Russell Gold <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
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?
>
>
>
> java.lang.IllegalAccessException: Class
> org.apache.tiles.access.TilesAccess can
> not access a member of class
> com.meterware.servletunit.ServletUnitServletContext
> with modifiers "public"
> at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> at java.lang.reflect.Method.invoke(Method.java:578)
> at
> org.apache.tiles.access.TilesAccess.getAttribute(TilesAccess.java:125)
> at
> org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:74)
> at
> org
> .apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:99)
>
>
> Is there chance that ServletUnitServletContext can be made public?
>
> 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
> _______________________________________________
> Httpunit-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop
-------------------------------------------------------------------------
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