This weekend I began experimenting with OpenShift, the JBoss platform as a service (PaaS) available at https://openshift.redhat.com/app/. I run from Windows so a Cygwin and Ruby install is required to get started. The installation of cygwin and required modules took me about 1 hour to complete. After that, I was up and running on OpenShift in a jiffy. There's a good blog on using CDI/Weld on Openshift at https://www.redhat.com/openshift/blogs/seeing-cdi-working-in-openshift.
In order to get Primefaces to deploy correctly on JBossAS7 I had to upgrade to primefaces 3.0.M2. Then there are a few markup differences between 3x and 2.2 that I need to resolve. For instance, the theme selector needed changed in order to get any pages to work. Also, the gmapInfo panel has some difference requirements, so I have disabled it for now. Lastly, the dataTable instant selection is different. It used to have a onrowselectlistener attribute, but now wants a nested p:ajax tag. I haven't figured out how to get those to work yet either.
You can see the current JSF/Primefaces/Weld/CDI/JPA application at http://cabins-basinc.rhcloud.com/primetest/cabins/search.jsf
Technology focused tutorials, lessons learned and a place to store stuff I don't want to loose.
Monday, August 15, 2011
Wednesday, August 10, 2011
Using JAXRS and CDI
The following helped me out a lot when setting up jaxrs over existing managed beans.
http://download.oracle.com/javaee/6/tutorial/doc/gkncy.html
Essentially the managed bean is now stateless ejb with jaxrs annotation:
@Stateless
@Named
@Path(value = "/cabins")
the method is also annotated:
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path(value = "/list")
The entity is annotated so it can be marshalled:
@XmlRootElement
public class Cabin extends AbstractEntity {
And a JaxApplication loader class was added:
package com.examples.service;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/rest")
public class JaxApplicationPath extends Application {
}
With these things in place I can reuse the CabinSearchBean from the web page site as a bean for jaxrs (json or xml) and access via Android.
http://download.oracle.com/javaee/6/tutorial/doc/gkncy.html
Essentially the managed bean is now stateless ejb with jaxrs annotation:
@Stateless
@Named
@Path(value = "/cabins")
the method is also annotated:
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path(value = "/list")
The entity is annotated so it can be marshalled:
@XmlRootElement
public class Cabin extends AbstractEntity {
And a JaxApplication loader class was added:
package com.examples.service;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/rest")
public class JaxApplicationPath extends Application {
}
With these things in place I can reuse the CabinSearchBean from the web page site as a bean for jaxrs (json or xml) and access via Android.
Subscribe to:
Posts (Atom)