public static void configureServer(final AbstractJAXRSFactoryBean serverFactory, final Map<String, Object> securityProps) { Map<String, Object> props = serverFactory.getProperties(true); String username = (String) securityProps.get(SecurityConstants.SIGNATURE_USERNAME); if (username == null) { username = (String)securityProps.get("ws-" + SecurityConstants.SIGNATURE_USERNAME); } props.put(SecurityConstants.SIGNATURE_USERNAME, username); props.put(SecurityConstants.CALLBACK_HANDLER, new WSPasswordCallbackHandler(username, (String) securityProps.get(SIGNATURE_PASSWORD))); Object sigProps = securityProps.get(SecurityConstants.SIGNATURE_PROPERTIES); if (sigProps == null) { sigProps = securityProps.get("ws-" + SecurityConstants.SIGNATURE_PROPERTIES); } props.put(SecurityConstants.SIGNATURE_PROPERTIES, sigProps); serverFactory.setProvider(new SamlHeaderInHandler()); } }
public CxfRsSpringEndpoint(Component component, String uri, AbstractJAXRSFactoryBean bean) throws Exception { super(uri, component); setAddress(bean.getAddress()); // Update the sfb address by resolving the properties bean.setAddress(getAddress()); init(bean); }
EndpointInfo ei = createEndpointInfo(service); Endpoint ep = new EndpointImpl(getBus(), service, ei); if (getInInterceptors() != null) { ep.getInInterceptors().addAll(getInInterceptors()); if (getOutInterceptors() != null) { ep.getOutInterceptors().addAll(getOutInterceptors()); if (getInFaultInterceptors() != null) { ep.getInFaultInterceptors().addAll(getInFaultInterceptors()); if (getOutFaultInterceptors() != null) { ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors()); initializeAnnotationInterceptors(ep, cri.getServiceClass()); serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINT_SELECTED, ei, ep, cri.getServiceClass(), null);
private void applyIntents(List<Object> intents, AbstractJAXRSFactoryBean factory) { List<Feature> features = intentManager.getIntents(Feature.class, intents); factory.setFeatures(features); DataBinding dataBinding = intentManager.getIntent(DataBinding.class, intents); if (dataBinding != null) { factory.setDataBinding(dataBinding); } BindingConfiguration binding = intentManager.getIntent(BindingConfiguration.class, intents); if (binding != null) { factory.setBindingConfig(binding); } List<Object> providers = new ArrayList<Object>(); for (Object intent : intents) { if (isProvider(intent)) { providers.add(intent); } } factory.setProviders(providers); }
protected EndpointInfo createEndpointInfo(Service service) throws BusException { String transportId = getTransportId(); if (transportId == null && getAddress() != null) { DestinationFactory df = getDestinationFactory(); if (df == null) { DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class); df = dfm.getDestinationFactoryForUri(getAddress()); super.setDestinationFactory(df); setTransportId(transportId); ei.setAddress(getAddress()); BindingInfo bindingInfo = createBindingInfo(); ei.setBinding(bindingInfo);
protected void setupCommonFactoryProperties(AbstractJAXRSFactoryBean factory) { factory.setProviders(getProviders()); factory.getFeatures().addAll(getFeatures()); factory.setPublishedEndpointUrl(publishedEndpointUrl); factory.setInInterceptors(interceptorHolder.getInInterceptors()); factory.setOutInterceptors(interceptorHolder.getOutInterceptors()); factory.setOutFaultInterceptors(interceptorHolder.getOutFaultInterceptors()); factory.setInFaultInterceptors(interceptorHolder.getInFaultInterceptors()); if (factory.getProperties() != null) { factory.getProperties().putAll(getProperties()); } else { factory.setProperties(getProperties()); factory.getFeatures().add(loggingFeature); if (factory.getProperties() == null) { factory.setProperties(new HashMap<String, Object>()); factory.getProperties().put(FaultListener.class.getName(), new NullFaultListener());
protected BindingInfo createBindingInfo() { BindingFactoryManager mgr = getBus().getExtension(BindingFactoryManager.class); String binding = getBindingId(); BindingConfiguration bindingConfig = getBindingConfig(); if (binding == null && bindingConfig != null) { binding = bindingConfig.getBindingId(); } if (binding == null) { binding = JAXRSBindingFactory.JAXRS_BINDING_ID; } try { BindingFactory bindingFactory = mgr.getBindingFactory(binding); setBindingFactory(bindingFactory); BindingInfo bi = bindingFactory.createBindingInfo(serviceFactory.getService(), binding, bindingConfig); for (BindingOperationInfo boi : bi.getOperations()) { serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, bi, boi, null); } serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_CREATED, bi); return bi; } catch (BusException ex) { ex.printStackTrace(); //do nothing } return null; }
if (bean.getProperties() != null) { Map<String, Object> copy = new HashMap<>(); copy.putAll(bean.getProperties()); setProperties(answer, copy);
protected void setDataBindingProvider(ProviderFactory factory, Service s) { List<ClassResourceInfo> cris = serviceFactory.getRealClassResourceInfo(); if (getDataBinding() == null && !cris.isEmpty()) { org.apache.cxf.annotations.DataBinding ann = cris.get(0).getServiceClass().getAnnotation(org.apache.cxf.annotations.DataBinding.class); if (ann != null) { try { setDataBinding(ann.value().newInstance()); } catch (Exception ex) { LOG.warning("DataBinding " + ann.value() + " can not be loaded"); } } } DataBinding db = getDataBinding(); if (db == null) { return; } if (s instanceof JAXRSServiceImpl) { ((JAXRSServiceImpl)s).setCreateServiceModel(true); } db.initialize(s); factory.setUserProviders(Collections.singletonList(new DataBindingProvider<Object>(db))); }
protected ProviderFactory setupFactory(Endpoint ep) { ProviderFactory factory = ProviderFactory.createInstance(getBus()); if (entityProviders != null) { factory.setUserProviders(entityProviders); } setDataBindingProvider(factory, ep.getService()); factory.setBus(getBus()); factory.initProviders(serviceFactory.getRealClassResourceInfo()); if (schemaLocations != null) { factory.setSchemaLocations(schemaLocations); } setBeanInfo(factory); ep.put(ProviderFactory.class.getName(), factory); getBus().setProperty(ProviderFactory.class.getName(), factory); return factory; }
public static void configureClient(final AbstractJAXRSFactoryBean clientFactory, final String username, final String password, final Map<String, String> oidcProperties) { OIDCRESTOutInterceptor outInterceptor = new OIDCRESTOutInterceptor(username, password, oidcProperties); clientFactory.getOutInterceptors().add(outInterceptor); } }
protected void setupFactory(ProviderFactory factory, Endpoint ep) { if (providerComparator != null) { factory.setProviderComparator(providerComparator); } if (entityProviders != null) { factory.setUserProviders(entityProviders); } setDataBindingProvider(factory, ep.getService()); factory.setBus(getBus()); factory.initProviders(serviceFactory.getRealClassResourceInfo()); if (schemaLocations != null) { factory.setSchemaLocations(schemaLocations); } ep.put(factory.getClass().getName(), factory); }
@Deprecated /** * It will be removed in Camel 3.0 * * @param comp * @param bean */ public CxfRsSpringEndpoint(Component component, AbstractJAXRSFactoryBean bean) throws Exception { super(bean.getAddress(), component); init(bean); }
/** * {@inheritDoc} */ public Bus getBus() { Bus b = super.getBus(); checkBindingFactory(b); return b; }
/** * Sets a reference to the external user model, * Example: "classpath:/model/resources.xml" * * @param modelRef the reference to the external model resource. */ public void setModelRef(String modelRef) { List<UserResource> resources = ResourceUtils.getUserResources(modelRef, getBus()); if (resources != null) { serviceFactory.setUserResources(resources); } }
protected EndpointInfo createEndpointInfo(Service service) throws BusException { String transportId = getTransportId(); if (transportId == null && getAddress() != null) { DestinationFactory df = getDestinationFactory(); if (df == null) { DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class); df = dfm.getDestinationFactoryForUri(getAddress()); super.setDestinationFactory(df); setTransportId(transportId); ei.setAddress(getAddress()); BindingInfo bindingInfo = createBindingInfo(); ei.setBinding(bindingInfo);
protected BindingInfo createBindingInfo() { BindingFactoryManager mgr = getBus().getExtension(BindingFactoryManager.class); String binding = getBindingId(); BindingConfiguration bindingConfig = getBindingConfig(); if (binding == null && bindingConfig != null) { binding = bindingConfig.getBindingId(); } if (binding == null) { binding = JAXRSBindingFactory.JAXRS_BINDING_ID; } try { BindingFactory bindingFactory = mgr.getBindingFactory(binding); setBindingFactory(bindingFactory); BindingInfo bi = bindingFactory.createBindingInfo(serviceFactory.getService(), binding, bindingConfig); for (BindingOperationInfo boi : bi.getOperations()) { serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, bi, boi, null); } serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_CREATED, bi); return bi; } catch (BusException ex) { ex.printStackTrace(); //do nothing } return null; }
setupFactory(factory, ep); final Map<String, Object> theProperties = super.getProperties(); final boolean encodeClientParameters = PropertyUtils.isTrue(theProperties, "url.encode.client.parameters"); if (encodeClientParameters) {
protected void setDataBindingProvider(ProviderFactory factory, Service s) { if (getDataBinding() == null && cris.size() > 0) { org.apache.cxf.annotations.DataBinding ann = cris.get(0).getServiceClass().getAnnotation(org.apache.cxf.annotations.DataBinding.class); if (ann != null) { try { setDataBinding(ann.value().newInstance()); } catch (Exception ex) { LOG.warning("DataBinding " + ann.value() + " can not be loaded"); DataBinding db = getDataBinding(); if (db == null) { return;
public static void configureClient(final AbstractJAXRSFactoryBean clientFactory, final String username, final String password, final Map<String, String> oidcProperties) { OIDCRESTOutInterceptor outInterceptor = new OIDCRESTOutInterceptor(username, password, oidcProperties); clientFactory.getOutInterceptors().add(outInterceptor); } }