2 Replies Latest reply on Jul 17, 2008 1:01 PM by Aede van der Weij

    Remoting and java.util.Calendar field

    Aede van der Weij Newbie

      Hi,


      I've got a legacy bean with a field of type java.util.Calendar which I need to use on the client side. The manual is clear about the date types and that only java.util.Date (or descendent) on the server side can be used.


      The legacy objects servers as a parameter for a webremote annotated method on the server. On the client side this will result in a javascript alert Unknown Type error and on the server side a java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 exception.


      Capturing the network traffic reveals that Seam expects a bean for the Calendar field. This is backed by examining the dynamic generated javascript file by Seam.



      <envelope><header><context></context></header><body><call component="myService" method="myMethod" id="3">
      <params><param><ref id="0"/></param></params><refs><ref id="0"><bean type="legacyObject">
      <member name="amount"><number>10</number></member>
      <member name="value"><number>1</number></member>
      <member name="state"><number>0</number></member>
      <member name="expireDate"><ref id="1"/></member>
      <member name="id"><null/></member>
      <member name="stock"><ref id="2"/></member>
      </bean></ref><ref id="1">null</ref><ref id="2"><bean type="type">
      <member name="name"><null/></member>
      <member name="id"><number>4</number></member>
      </bean></ref></refs></call></body></envelope>




      Of course I could create an extra webremote method and construct a legacy object on the server side. But this seems a bid awkward since the server side is altered in favour of a 'limitation' on the client side.


      Is there anyone with a better/cleaner suggestion?