java - Google App Engine/Jetty: Introspection Fails for Dynamic Proxy? -


why introspector not correctly discover properties of dynamic proxy class in jetty/gae?

i ran curious problem while trying use dynamic proxy java el/jsps when deploying locally on gae jetty. can see original question here.

anyways, have since simplified code , narrowed down problem. here new code:

myservlet.java:

package test;  // imports omitted  public class myservlet extends httpservlet {      public interface myinterface {         public string getvalue();     }      private static <t> t getproxy(class<t> c) {         return (t)proxy.newproxyinstance(                 klass.getclassloader(),                 new class<?>[]{ klass },                 new invocationhandler() {                     @override public object invoke(object proxy, method m,                             object[] args) throws throwable {                         return null;                     }                 });     }      public static void testintrospection() {         stringbuilder sb = new stringbuilder();         try {             myinterface proxy = getproxy(myinterface.class);             beaninfo info = introspector.getbeaninfo(proxy.getclass());             (propertydescriptor d : info.getpropertydescriptors())                 sb.append(d.getname()).append(", ");         } catch (exception e) {             throw new assertionerror("failed", e);         }         throw new assertionerror("found: " + sb.tostring());     }      @override     public void doget(httpservletrequest request, httpservletresponse resp) {         testintrospection();     }      public static void main(string... args) {         testintrospection();     } } 

when deploy code above , send request, following:

java.lang.assertionerror: found: class, 

however, expected both class , value discovered, per documentation proxy. but, when run in main(), expected output. tried putting proxied interface in separate file/package, , did not work. make things weirder, expected output when change myinterface private, protected, or default.

why have limited question gae/jetty? because able deploy exact same servlet on tomcat 7 no problem, when myinterface public.

in case it's relevant, using google plugin in eclipse juno, , deploying locally.

one last thing: checked output of proxy.getclass().getdeclaredmethods() , did include getvalue. however, can't parse bean properties myself, because need work in el, relies on introspector.

i stumped one, guidance appreciated.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -