Add restfull webservice to get Version of tools
To add a restful service that will be used by all tools, you have to :
- Add in dependencies in your ejb if not already present :
<dependency> <groupId>net.ihe.gazelle.maven</groupId> <artifactId>version</artifactId> <version>1.0.2</version> <type>ejb</type> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxb-provider</artifactId> </dependency> <dependency> <groupId>org.jboss.seam</groupId> <artifactId>jboss-seam-resteasy</artifactId> </dependency> <dependency> <groupId>org.scannotation</groupId> <artifactId>scannotation</artifactId> <version>1.0.2</version> </dependency>
- Create file in ejb/src/main/resources/gzl.version.properties with content :
buildVersion=${build.version}
- Finally you have to add in the web.xml :
<!-- Resteasy --> <context-param> <param-name>resteasy.jndi.resources</param-name> <param-value>gazelle-proxy/VersionProvider/local</param-value> <!--If you need to declare more than one resource, separate them by comas --> </context-param> <!-- The following lines are required only if you decide not to use the application base path as base URI for your REST services --> <context-param> <param-name>resteasy.servlet.mapping.prefix</param-name> <param-value>/rest</param-value> </context-param> <!-- end of optional lines --> <listener> <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class> </listener> <servlet> <servlet-name>Resteasy</servlet-name> <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class> </servlet> <servlet-mapping> <servlet-name>Resteasy</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping>
You can verify with the url like this : http://gazelle.ihe.net/proxy/rest/version