Package org.apache.cxf.jaxrs.impl

Examples of org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper


    public void testDefaultUserExceptionMappers() throws Exception {
        ServerProviderFactory pf = ServerProviderFactory.getInstance();
        ExceptionMapper<?> mapper =
            pf.createExceptionMapper(WebApplicationException.class, new MessageImpl());
        assertNotNull(mapper);
        WebApplicationExceptionMapper wm = new WebApplicationExceptionMapper();
        pf.registerUserProvider(wm);
        ExceptionMapper<?> mapper2 =
            pf.createExceptionMapper(WebApplicationException.class, new MessageImpl());
        assertNotSame(mapper, mapper2);
        assertSame(wm, mapper2);
View Full Code Here


    }
   
    @Test
    public void testExceptionMappersHierarchy1() throws Exception {
        ServerProviderFactory pf = ServerProviderFactory.getInstance();
        WebApplicationExceptionMapper wm = new WebApplicationExceptionMapper();
        pf.registerUserProvider(wm);
        assertSame(wm, pf.createExceptionMapper(WebApplicationException.class, new MessageImpl()));
        assertNull(pf.createExceptionMapper(RuntimeException.class, new MessageImpl()));
        TestRuntimeExceptionMapper rm = new TestRuntimeExceptionMapper();
        pf.registerUserProvider(rm);
View Full Code Here

        TestRuntimeExceptionMapper rm = new TestRuntimeExceptionMapper();
        pf.registerUserProvider(rm);
        assertSame(rm, pf.createExceptionMapper(WebApplicationException.class, new MessageImpl()));
        assertSame(rm, pf.createExceptionMapper(RuntimeException.class, new MessageImpl()));
       
        WebApplicationExceptionMapper wm = new WebApplicationExceptionMapper();
        pf.registerUserProvider(wm);
        assertSame(wm, pf.createExceptionMapper(WebApplicationException.class, new MessageImpl()));
        assertSame(rm, pf.createExceptionMapper(RuntimeException.class, new MessageImpl()));
    }
View Full Code Here

        instances.add(new JsrProvider()); // is this one really mandatory?
        instances.add(new WadlDocumentMessageBodyWriter());
        instances.add(EJBAccessExceptionMapper.INSTANCE);

        if ("true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.jaxrs.cxf.add-cxf-providers", "false"))) {
            instances.add(new WebApplicationExceptionMapper());
            instances.add(new BinaryDataProvider<>());
            instances.add(new SourceProvider<>());
            instances.add(new DataSourceProvider<>());
            instances.add(new FormEncodingProvider<>());
            instances.add(new PrimitiveTextProvider<>());
View Full Code Here

    public void testDefaultUserExceptionMappers() throws Exception {
        ProviderFactory pf = ProviderFactory.getInstance();
        ExceptionMapper<?> mapper =
            pf.createExceptionMapper(WebApplicationException.class, new MessageImpl());
        assertNotNull(mapper);
        WebApplicationExceptionMapper wm = new WebApplicationExceptionMapper();
        pf.registerUserProvider(wm);
        ExceptionMapper<?> mapper2 =
            pf.createExceptionMapper(WebApplicationException.class, new MessageImpl());
        assertNotSame(mapper, mapper2);
        assertSame(wm, mapper2);
View Full Code Here

    }
   
    @Test
    public void testExceptionMappersHierarchy1() throws Exception {
        ProviderFactory pf = ProviderFactory.getInstance();
        WebApplicationExceptionMapper wm = new WebApplicationExceptionMapper();
        pf.registerUserProvider(wm);
        assertSame(wm, pf.createExceptionMapper(WebApplicationException.class, new MessageImpl()));
        assertNull(pf.createExceptionMapper(RuntimeException.class, new MessageImpl()));
        TestRuntimeExceptionMapper rm = new TestRuntimeExceptionMapper();
        pf.registerUserProvider(rm);
View Full Code Here

        TestRuntimeExceptionMapper rm = new TestRuntimeExceptionMapper();
        pf.registerUserProvider(rm);
        assertSame(rm, pf.createExceptionMapper(WebApplicationException.class, new MessageImpl()));
        assertSame(rm, pf.createExceptionMapper(RuntimeException.class, new MessageImpl()));
       
        WebApplicationExceptionMapper wm = new WebApplicationExceptionMapper();
        pf.registerUserProvider(wm);
        assertSame(wm, pf.createExceptionMapper(WebApplicationException.class, new MessageImpl()));
        assertSame(rm, pf.createExceptionMapper(RuntimeException.class, new MessageImpl()));
    }
View Full Code Here

        /*
         *  Normally not necessary to explicitly add WebApplicationExceptionMapper to
         *  provider list.  Doing so here to change printStackTrace's value from default
         *  so WAEM's will output to server console (as it does by default with Jersey)
         */
        WebApplicationExceptionMapper waem = new WebApplicationExceptionMapper();
        waem.setPrintStackTrace(true);

        List<Object> providerList = new ArrayList<Object>();
        providerList.add(new MyResource.MyMappedExceptionMapper());
        providerList.add(new MyResource.MyMappedRuntimeExceptionMapper());
        providerList.add(new MyResource.MyMappedThrowingExceptionMapper());
View Full Code Here

    public void testDefaultUserExceptionMappers() throws Exception {
        ProviderFactory pf = ProviderFactory.getInstance();
        ExceptionMapper<?> mapper =
            pf.createExceptionMapper(WebApplicationException.class, new MessageImpl());
        assertNotNull(mapper);
        WebApplicationExceptionMapper wm = new WebApplicationExceptionMapper();
        pf.registerUserProvider(wm);
        ExceptionMapper<?> mapper2 =
            pf.createExceptionMapper(WebApplicationException.class, new MessageImpl());
        assertNotSame(mapper, mapper2);
        assertSame(wm, mapper2);
View Full Code Here

    }
   
    @Test
    public void testExceptionMappersHierarchy1() throws Exception {
        ProviderFactory pf = ProviderFactory.getInstance();
        WebApplicationExceptionMapper wm = new WebApplicationExceptionMapper();
        pf.registerUserProvider(wm);
        assertSame(wm, pf.createExceptionMapper(WebApplicationException.class, new MessageImpl()));
        assertNull(pf.createExceptionMapper(RuntimeException.class, new MessageImpl()));
        TestRuntimeExceptionMapper rm = new TestRuntimeExceptionMapper();
        pf.registerUserProvider(rm);
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.