Search in sources :

Example 1 with TbSysWsConfig

use of com.netsteadfast.greenstep.po.hbm.TbSysWsConfig in project bamboobsc by billchen198318.

the class CxfServerBean method publishRest.

private static int publishRest(JAXRSServerFactoryBean sf, List<TbSysWsConfig> configs) {
    int c = 0;
    for (TbSysWsConfig config : configs) {
        if (!WSConfig.TYPE_REST.equals(config.getType())) {
            continue;
        }
        try {
            sf.setServiceBean(AppContext.getBean(config.getBeanId()));
            c++;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    sf.setProviders(getProvider());
    sf.setAddress(WSConfig.getJAXRSServerFactoryBeanAddress());
    return c;
}
Also used : TbSysWsConfig(com.netsteadfast.greenstep.po.hbm.TbSysWsConfig) Endpoint(javax.xml.ws.Endpoint) JsonParseException(com.fasterxml.jackson.core.JsonParseException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Example 2 with TbSysWsConfig

use of com.netsteadfast.greenstep.po.hbm.TbSysWsConfig in project bamboobsc by billchen198318.

the class CxfServerBean method start.

public static void start(PublishingCXFServlet servlet, ServletConfig servletConfig, Bus bus, boolean loadBusManual) {
    logger.info("start");
    CxfServerBean.servlet = servlet;
    CxfServerBean.servletConfig = servletConfig;
    CxfServerBean.bus = bus;
    if (server != null && serverFactoryBean != null) {
        logger.warn("Server is found , not start");
        return;
    }
    try {
        if (loadBusManual) {
            logger.info("load bus manual mode");
            CxfServerBean.bus = servlet.loadBusManual(servletConfig);
            restartNum = restartNum + 1;
        }
        BusFactory.setDefaultBus(CxfServerBean.bus);
        serverFactoryBean = new JAXRSServerFactoryBean();
        serverFactoryBean.setBus(CxfServerBean.bus);
        List<TbSysWsConfig> configs = getSystemWsConfigs();
        publishDefault(configs);
        int r = publishRest(serverFactoryBean, configs);
        BindingFactoryManager manager = serverFactoryBean.getBus().getExtension(BindingFactoryManager.class);
        bindingFactory = new JAXRSBindingFactory();
        bindingFactory.setBus(serverFactoryBean.getBus());
        manager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, bindingFactory);
        if (r > 0) {
            server = serverFactoryBean.create();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    logger.info("end");
}
Also used : JAXRSBindingFactory(org.apache.cxf.jaxrs.JAXRSBindingFactory) JAXRSServerFactoryBean(org.apache.cxf.jaxrs.JAXRSServerFactoryBean) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) TbSysWsConfig(com.netsteadfast.greenstep.po.hbm.TbSysWsConfig) Endpoint(javax.xml.ws.Endpoint) JsonParseException(com.fasterxml.jackson.core.JsonParseException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Example 3 with TbSysWsConfig

use of com.netsteadfast.greenstep.po.hbm.TbSysWsConfig in project bamboobsc by billchen198318.

the class CxfServerBean method publishDefault.

private static int publishDefault(List<TbSysWsConfig> configs) {
    int c = 0;
    for (TbSysWsConfig config : configs) {
        if (!WSConfig.TYPE_SOAP.equals(config.getType()) || StringUtils.isBlank(config.getPublishAddress())) {
            continue;
        }
        try {
            Endpoint.publish(config.getPublishAddress(), AppContext.getBean(config.getBeanId()));
            c++;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return c;
}
Also used : TbSysWsConfig(com.netsteadfast.greenstep.po.hbm.TbSysWsConfig) Endpoint(javax.xml.ws.Endpoint) JsonParseException(com.fasterxml.jackson.core.JsonParseException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Aggregations

JsonParseException (com.fasterxml.jackson.core.JsonParseException)3 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)3 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)3 TbSysWsConfig (com.netsteadfast.greenstep.po.hbm.TbSysWsConfig)3 Endpoint (javax.xml.ws.Endpoint)3 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)1 JAXRSBindingFactory (org.apache.cxf.jaxrs.JAXRSBindingFactory)1 JAXRSServerFactoryBean (org.apache.cxf.jaxrs.JAXRSServerFactoryBean)1