Any examples of custom converters with annotations

View: New views
2 Messages — Rating Filter:   Alert me  

Any examples of custom converters with annotations

by Kevin Sitron :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Are there any examples of custom converters using the
@DataTransferObject annotation.

Thanks in advance.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Any examples of custom converters with annotations

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It's quite simple.
1. Use the class level @DataTransferObject annotation
2. If your converter extends BeanConverter, mark your getters (or setters) with @RemoteProperty
3. Add your classes to web.xml or use the new classpath annotation scan (see IWebMvc for an example http://code.google.com/p/internna/)

web.xml
<servlet>
  <description>DWR controller servlet</description>
  <servlet-name>DWR controller servlet</servlet-name>
  <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
  <init-param>
    <param-name>classes</param-name>
    <param-value>
      foo.bar.ConvertMe1,
      foo.bar.ConvertMe2
    </param-value>
  </init-param>
</servlet>

or applicationContext.xml (spring)
<dwr:annotation-scan regex=".*dwr.*" />

I have found this quite clunky though and prefer to use dwr.xml for converters instead. You may find the same.

Cheers,
Lance




2008/5/1 Kevin Sitron <ksitron@...>:

Are there any examples of custom converters using the
@DataTransferObject annotation.

Thanks in advance.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...