Search in sources :

Example 1 with JwsJsonClientResponseFilter

use of org.apache.cxf.rs.security.jose.jaxrs.JwsJsonClientResponseFilter in project cxf by apache.

the class JAXRSJwsJsonTest method createBookStore.

private BookStore createBookStore(String address, Map<String, Object> mapProperties, List<?> extraProviders, boolean encodePayload) throws Exception {
    JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = JAXRSJwsJsonTest.class.getResource("client.xml");
    Bus springBus = bf.createBus(busFile.toString());
    bean.setBus(springBus);
    bean.setServiceClass(BookStore.class);
    bean.setAddress(address);
    List<Object> providers = new LinkedList<>();
    JwsJsonWriterInterceptor writer = new JwsJsonWriterInterceptor();
    writer.setUseJwsJsonOutputStream(true);
    writer.setEncodePayload(encodePayload);
    providers.add(writer);
    providers.add(new JwsJsonClientResponseFilter());
    if (extraProviders != null) {
        providers.addAll(extraProviders);
    }
    bean.setProviders(providers);
    bean.getProperties(true).putAll(mapProperties);
    return bean.create(BookStore.class);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) JAXRSClientFactoryBean(org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean) JwsJsonWriterInterceptor(org.apache.cxf.rs.security.jose.jaxrs.JwsJsonWriterInterceptor) JwsJsonClientResponseFilter(org.apache.cxf.rs.security.jose.jaxrs.JwsJsonClientResponseFilter) URL(java.net.URL) LinkedList(java.util.LinkedList)

Aggregations

URL (java.net.URL)1 LinkedList (java.util.LinkedList)1 Bus (org.apache.cxf.Bus)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 JAXRSClientFactoryBean (org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean)1 JwsJsonClientResponseFilter (org.apache.cxf.rs.security.jose.jaxrs.JwsJsonClientResponseFilter)1 JwsJsonWriterInterceptor (org.apache.cxf.rs.security.jose.jaxrs.JwsJsonWriterInterceptor)1