Hi

Hey I was just wondering if I can set my exception mappers in the properties 
part of my test under the @Configuration, rather than having to apply an 
exception mapper to each EjbDeployment of the OpenejbJar.

So right now I have something like this link:

https://svn.apache.org/repos/asf/tomee/tomee/trunk/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/CheckedExceptionMapperTest.java

To pick out the specific point in the link:

@Module
@Classes({ ExampleExceptionMapper.class })
public EjbModule module() {
    final SingletonBean bean = new SingletonBean(ExampleRest.class);
    bean.setRestService(true);

    final EjbJar ejbJar = new EjbJar("beans");
    ejbJar.addEnterpriseBean(bean);

    final OpenejbJar openejbJar = new OpenejbJar();
    openejbJar.addEjbDeployment(new EjbDeployment(bean));

    final Properties properties = 
openejbJar.getEjbDeployment().iterator().next().getProperties();
    properties.setProperty("cxf.jaxrs.providers", 
"org.apache.openejb.server.cxf.rs.CheckedExceptionMapperTest$ExampleExceptionMapper");

    final EjbModule module = new EjbModule(ejbJar);
    module.setOpenejbJar(openejbJar);

    return module;
}

So here I define the exception mapper (ExampleExceptionMapper) on the 
properties of the specific EjbDeployment of the ExampleRest class in the 
OpenejbJar.

Is there a way to just define it in the global properties with @Configuration? 
I've tried something like this to no avail:

@Configuration
public Properties config() {
        final Properties props = new Properties();
        ...
        props.setProperty("openejb.cxf.jax-rs.providers", 
ExampleExceptionMapper.class.getName());
        props.setProperty("openejb.jaxrs.providers.auto", "true");
        ...
        return props;
}



Thanks,

Chris

Reply via email to