Jack,
the way that jetty config works is as follows:
<new class="classA">
<arg>Arg to classA constructor</arg>
<!-- stuff after the args applies to the new classA instance -->
<call name="methodOnClassA">
<arg>arg to classA.methodOnClassA</arg>
<!-- stuff after the args applies to any return type of methodOnClassA -->
</call>
<!-- we have popped scope here and are back to working on classA instance -->
</new>
Jack wrote:
> Greg Wilkins <gregw <at> mortbay.com> writes:
>
>
>>I need more context.
>>
>>What are you applying the XML snippet to? How is it invoked etc.
>>
>>Can you send more of the XML config file and the code you use to invoke it.
>>
>>cheers
>>
>
>
> Hi Greg, thank you for your support, I really appreciate it! I could provide
> the information you requested, but I wonder if they are really meanful. I took
> a look to the source of the newObj() method in class XmlConfiguration:
>
> [cut]
> // Lets just try all constructors for now
> Constructor[] constructors = oClass.getConstructors();
> for (int c=0;constructors!=null && c<constructors.length;c++)
> {
> if (constructors[c].getParameterTypes().length!=size)
> continue;
>
> Object n=null;
> boolean called=false;
> try{
> n=constructors[c].newInstance(arg);
> called=true;
> }
> catch(IllegalAccessException e)
> {if(Code.verbose(Integer.MAX_VALUE))Code.ignore(e);}
> catch(InstantiationException e)
> {if(Code.verbose(Integer.MAX_VALUE))Code.ignore(e);}
> catch(IllegalArgumentException e)
> {if(Code.verbose(Integer.MAX_VALUE))Code.ignore(e);}
> if(called)
> {
> configure(n,node,argi);
> return n;
> }
> }
>
> throw new IllegalStateException("No Constructor: "+node+" on "+obj);
> }
>
> Any <call> tag inside the <new> element is managed in the configure(n,node,argi)
> statement, which returns void, thus any nested object is lost!
> That is, in my case:
>
> <New class="java.text.SimpleDateFormat">
> <Arg>MM-yyyy</Arg>
> <Call name="parse">
> <Arg>07-2003</Arg>
> <Arg>
> <New class="java.text.ParsePosition">
> <Arg type="int">0 </Arg>
> </New>
> </Arg>
> </Call>
> </New>
>
> the newObj() method returns an object of class SimpleDateFormat, whatever
> happens in the nested call to the method parse().
> What I'm looking for is a workaround to save the Date object rturned by the
> method.
> bye
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
|