CP2JavaWS 0.31 available

Posted: February 9, 2009 in IT/Dev
Tags: , , , , , , ,

A new version of CP2JavaWS (0.31) is available at sourceforge. It includes the following changes :

– CP2JavaWSJSONServlet has been replaced by a filter. Then no need anymore for a servlet. If a servlet is still present, your application could then manage both JSON requests (originated from Cappuccino client applications using CP2JavaWSRemoteService proxy), through the CPJSONFilter, and classic web requests (managed by your servlet, Struts or Spring MVC servlet for example).

– the CPJSONFilter can work with any service factory (custom framework and/or injection container). A listener is provided for integration with spring container (see the provided demo). You have then to add cp2javaws-springsupport.jar in web-inf/lib besides cp2javaws-filter.jar (and spring.jar obviously). If not using Spring, spring.jar (and cp2javaws-springsupport.jar) can be removed, avoiding any dependency.

– for custom service factory/framework, a listener example is provided (see server source code, DummyContextWrapperListener.java and DummyContextWrapper.java). Just modify these classes to get you service factory injected, and then export these two classes into a support.jar (the same as with cp2javaws-springsupport.jar).

– fixed date timezone management.

  1. I initially planned not to use a cp2javaws SpringContextWrapperListener, by instead injecting the spring context in a contextHolder singleton object (that would implements Spring’s contextAware interface). Then no additional listener in the web.xml, only the CPJSONFilter with an init parameter specifying the context holder singleton class (and Method reflection to get it from the generic filter).
    But it would require for the context holder singleton to be declared in the Spring managed beans. Moreover, for other frameworks/containers to work, they would need to allow some basic static initialization (if not providing such injection), as the context holder singleton won’t get access to the servlet context (available only from the current listeners). It should however work for most frameworks (for example an EnterpiseLayerFactory.getDefaultInstance() that discovers its layers config files through a foundation.xml searched for in the classpath).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s