December 22, 2014
December 21, 2014
The EE 6 classes are available in maven central.
But when running unit test against them you receive the below error. Thats because they do not contain implementation classes, only api class.
So in practice, the dependecy is in real life unusable. Instead you must use api classes from specific vendors like JBoss.
The below sites summaries all xml schemas defintions for all EE 7 deployment descriptors.
Interceptor was in EE 5 introduced in EJB 3.0, see EJB3 Interceptors javax.ejb.AroundInvoke. In EE 6 that was taken out and made generic into Interceptors (JSR318), package javax.interceptor.*.
You can call Interceptor in EE 6 in two way:
- By annotating method or class with @javax.interceptor.Interceptors(MyInterceptor.class)
- Create custom Annotation with Annotation @javax.interceptor.InterceptorBinding and annotate with that you method or class.
Your custom Interceptor.
Interception in a POJO.
Interception in a Stateless Session Bean.
beans.xml located for war in WEB-INF/.
To use the Interceptor you must let weld create the intercepted class, otherwise will weld never knew about the interceptor and hence will the interceptor never work.
Example usage from a Servlet.
You cannot use Interceptor directly in servlets, see https://java.net/projects/servlet-spec/lists/jsr340-experts/archive/2012-02/message/0.
A better tool is to use the gnome-screenshot tool.
You can install via `sudo apt-get install gnome-screenshot`
Besides dependency jar in a module you also might need to be able to configure it for different server environment. The best way and maybe the natural way, is to make use of a java properties file.
This is a good practice, now you can RPM package your custom module. This is how Red Hat do with JBoss EAP 6. With RPM packing you have now the capability of versioning your module and to centrally install it from, e.g. Red Hat Satellite. And finally centrally configure the property file from, e.g. Satellite 6 via Puppet.
But there is classloading gotchas. You need to add <resource-root path="."/> to you module.xml.
See https://developer.jboss.org/wiki/HowToPutAnExternalFileInTheClasspath for longer description.